Class BaseDatabase

java.lang.Object
com.illumon.iris.db.tables.databases.BaseDatabase
All Implemented Interfaces:
Database
Direct Known Subclasses:
AbstractDatabase, DatabaseWrapper, RemoteDatabase

public abstract class BaseDatabase
extends Object
implements Database
Simple, standard implementations for many database operations.
  • Constructor Details

  • Method Details

    • addTablePartition

      public final void addTablePartition​(String namespace, String tableName, String columnPartitionValue, Table data, Database.StorageFormat storageFormat)
      Description copied from interface: Database
      Adds a single table partition (e.g. one date) to a partitioned table.

      Requires that a suitable TableDefinition has already been added.

      This variant implicitly uses internalPartitionValue set by the iris.defaultInternalPartitionNamingFunction property.

      Throws an exception if the partition already exists.

      Specified by:
      addTablePartition in interface Database
      Parameters:
      namespace - table namespace
      tableName - table name
      columnPartitionValue - column partition value (e.g. "2015-09-25" for a Date partitioning column).
      data - data for this partition. Must *not* contain the partitioning column.
      storageFormat - the format used for storage
    • appendTablePartition

      public final void appendTablePartition​(String namespace, String tableName, String columnPartitionValue, Table data)
      Description copied from interface: Database
      Adds or appends to a single table location (e.g. one date) to a partitioned user table.

      Requires that a suitable TableDefinition has already been added.

      This variant implicitly uses internalPartitionName set by the iris.defaultInternalPartitionNamingFunction property.

      Specified by:
      appendTablePartition in interface Database
      Parameters:
      namespace - table namespace
      tableName - table name
      columnPartitionValue - column partition value (e.g. "2015-09-25" for a Date partitioning column).
      data - data to append to this partition. Must *not* contain the partitioning column.
    • removeTablePartition

      public final void removeTablePartition​(String namespace, String tableName, String columnPartitionValue)
      Description copied from interface: Database
      Removes a single table location (e.g. one date) from a partitioned user table.

      Requires that a suitable TableDefinition still exists.

      This variant implicitly uses internalPartitionValue set by the iris.defaultInternalPartitionNamingFunction property.

      Specified by:
      removeTablePartition in interface Database
      Parameters:
      namespace - table namespace
      tableName - table name
      columnPartitionValue - column partition value (e.g. "2015-09-25" for a Date partitioning column).
    • replaceTablePartition

      public final void replaceTablePartition​(String namespace, String tableName, String columnPartitionValue, Table data, Database.StorageFormat storageFormat)
      Description copied from interface: Database
      Removes and re-adds a single table location (e.g. one date) from/to a partitioned table.

      Requires that a suitable TableDefinition has already been added.

      This variant implicitly uses internalPartitionName set by the iris.defaultInternalPartitionNamingFunction property.

      Not guaranteed to be atomic in the case of failures.

      Specified by:
      replaceTablePartition in interface Database
      Parameters:
      namespace - table namespace
      tableName - table name
      columnPartitionValue - column partition value (e.g. "2015-09-25" for a Date partitioning column).
      data - data for this partition. Must *not* contain the partitioning column.
      storageFormat - the storage format to use (ex DeephavenV1 or Parquet)
    • addPartitionedTableDefinitionIfAbsent

      public final void addPartitionedTableDefinitionIfAbsent​(@NotNull String namespace, @NotNull String tableName, @NotNull String partitioningColumnName, @NotNull TableDefinition prototypeDefinition)
      Description copied from interface: Database
      Adds a table definition for a partitioned table, if the table definition is absent.
      Specified by:
      addPartitionedTableDefinitionIfAbsent in interface Database
      Parameters:
      namespace - table namespace
      tableName - table name
      partitioningColumnName - name of the partitioning column
      prototypeDefinition - prototype table definition used to generate the table definition
    • addPartitionedTableDefinitionIfAbsent

      public final void addPartitionedTableDefinitionIfAbsent​(@NotNull String namespace, @NotNull String tableName, @NotNull String partitioningColumnName, @NotNull TableDefinition prototypeDefinition, boolean checkPartitioningColumn)
      Description copied from interface: Database
      Adds a table definition for a partitioned table, if the table definition is absent.
      Specified by:
      addPartitionedTableDefinitionIfAbsent in interface Database
      Parameters:
      namespace - table namespace
      tableName - table name
      partitioningColumnName - name of the partitioning column
      prototypeDefinition - prototype table definition used to generate the table definition
      checkPartitioningColumn - true to make sure the partitioning columns are the same
    • addPartitionedTableDefinition

      public final void addPartitionedTableDefinition​(@NotNull String namespace, @NotNull String tableName, @NotNull String partitioningColumnName, @NotNull TableDefinition tableDefinition)
      Description copied from interface: Database
      Adds a table definition for a partitioned table.
      Specified by:
      addPartitionedTableDefinition in interface Database
      Parameters:
      namespace - table namespace
      tableName - table name
      partitioningColumnName - name of the partitioning column
      tableDefinition - prototype table definition used to generate the table definition
    • addPartitionedTableDefinition

      public final void addPartitionedTableDefinition​(@NotNull String namespace, @NotNull String tableName, @NotNull TableDefinition tableDefinition)
      Description copied from interface: Database
      Adds a table definition for a partitioned table. The partitioning column depends on the iris.defaultColumnPartitionColumnName property.
      Specified by:
      addPartitionedTableDefinition in interface Database
      Parameters:
      namespace - table namespace
      tableName - table name
      tableDefinition - prototype table definition used to generate the table definition
    • addTablePartitionAndDefinition

      public final void addTablePartitionAndDefinition​(@NotNull String namespace, @NotNull String tableName, @NotNull String partitioningColumnName, @NotNull String internalPartitionValue, @NotNull String columnPartitionValue, @NotNull Table data)
      Description copied from interface: Database
      Adds a table definition and data for a partitioned table.

      This operation is not atomic.

      Specified by:
      addTablePartitionAndDefinition in interface Database
      Parameters:
      namespace - table namespace
      tableName - table name
      partitioningColumnName - name of the partitioning column
      internalPartitionValue - internal (not user-visible) partition value.
      columnPartitionValue - column partition value (e.g. "2015-09-25" for a Date partitioning column).
      data - table containing the data and table definition to write out
    • addTablePartitionAndDefinition

      public final void addTablePartitionAndDefinition​(@NotNull String namespace, @NotNull String tableName, @NotNull String partitioningColumnName, @NotNull String columnPartitionValue, @NotNull Table data)
      Description copied from interface: Database
      Adds a table definition and data for a partitioned user table location.

      This operation is not atomic.

      This variant implicitly uses internalPartitionName set by the iris.defaultInternalPartitionNamingFunction property.

      Specified by:
      addTablePartitionAndDefinition in interface Database
      Parameters:
      namespace - table namespace
      tableName - table name
      partitioningColumnName - name of the partitioning column
      columnPartitionValue - column partition value (e.g. "2015-09-25" for a Date partitioning column).
      data - table containing the data and table definition to write out
    • appendCentral

      public void appendCentral​(String namespace, String tableName, Table table, boolean flush) throws IOException
      Description copied from interface: Database
      Append to a table via a centralized table appender.

      This variant implicitly uses a default partitioning column value set by the iris.defaultColumnPartitionNamingFunction function.

      Specified by:
      appendCentral in interface Database
      Parameters:
      namespace - table namespace
      tableName - table name
      table - new data
      flush - true to flush the table to disk; false to wait for flushing (if the implementation supports waiting)
      Throws:
      IOException - problem appending