Class SourceTableMapFactory

java.lang.Object
com.illumon.iris.db.v2.SourceTableMapFactory

public class SourceTableMapFactory
extends Object
Factory for creating SourceTableMaps.

When run from a standard query, you should use the forDatabase(OnDiskQueryDatabase) method to create a SourceTableMapFactory. When used from an in-worker DataImportServer, use the forDataImportServer(DataImportServer) method.

After creating the SourceTableMapFactory, you can use one of several overloads of the createTableMap(com.illumon.iris.db.v2.locations.TableKey, boolean, boolean, java.util.function.Predicate<com.illumon.iris.db.v2.locations.TableLocation>) method. The lowest level of these methods takes a TableKey and predicate to match the available table locations. You may also choose whether or not you would like to refresh the available locations (adding a new key to the result SourceTableMap) and the sizes of the constituent tables tables (as new rows are added to a location).

The convenience methods createHistoricalTableMap(String, String, String) and createIntradayTableMap(String, String, String) are provided that mimic Database.getTable(String, String) and Database.getIntradayTable(String, String) followed by a where filter on the partitioning column.

  • Method Details

    • forDataImportServer

      public static SourceTableMapFactory forDataImportServer​(@NotNull DataImportServer dataImportServer)
      Construct a SourceTableMapFactory from the supplied DataImportServer.
      Parameters:
      dataImportServer - The data import server to use for metadata and data
      Returns:
      A new source table map factory backed by the data import server
    • forDatabase

      public static SourceTableMapFactory forDatabase​(@NotNull OnDiskQueryDatabase database)
      Construct a SourceTableMapFactory from the supplied OnDiskQueryDatabase.
      Parameters:
      database - The database to use for metadata and data
      Returns:
      A new source table map factory backed by the database
    • createTableMap

      public TableMap createTableMap​(@NotNull TableKey tableKey, boolean refreshLocations, boolean refreshSizes, @NotNull Predicate<TableLocation> locationMatcher)
      Create a new SourceTableMap for the supplied parameters.
      Parameters:
      tableKey - Identifier for the underlying table
      refreshLocations - Whether locations should be refreshed
      refreshSizes - Whether location sizes should be refreshed
      locationMatcher - Filter function for locations to include
      Returns:
      A new source table map
    • createTableMap

      public TableMap createTableMap​(@NotNull TableKey tableKey, boolean refreshLocations, boolean refreshSizes, @NotNull Predicate<CharSequence> internalPartitionMatcher, @NotNull Predicate<CharSequence> columnPartitionMatcher)
      Create a new SourceTableMap for the supplied parameters.
      Parameters:
      tableKey - Identifier for the underlying table
      refreshLocations - Whether locations should be refreshed
      refreshSizes - Whether location sizes should be refreshed
      internalPartitionMatcher - Filter function for internal partitions to include
      columnPartitionMatcher - Filter function for column partitions to include
      Returns:
      A new source table map
    • createTableMap

      public TableMap createTableMap​(@NotNull TableKey tableKey, boolean refreshLocations, boolean refreshSizes, @NotNull String internalPartitionValue, @NotNull String columnPartitionValue)
      Create a new SourceTableMap for the supplied parameters.
      Parameters:
      tableKey - Identifier for the underlying table
      refreshLocations - Whether locations should be refreshed
      refreshSizes - Whether location sizes should be refreshed
      internalPartitionValue - Specific internal partition to include
      columnPartitionValue - Specific column partition to include
      Returns:
      A new source table map
    • createTableMap

      public TableMap createTableMap​(@NotNull TableKey tableKey, boolean refreshLocations, boolean refreshSizes, @NotNull String columnPartitionValue)
      Create a new SourceTableMap for the supplied parameters.
      Parameters:
      tableKey - Identifier for the underlying table
      refreshLocations - Whether locations should be refreshed
      refreshSizes - Whether location sizes should be refreshed
      columnPartitionValue - Specific column partition to include
      Returns:
      A new source table map
    • createTableMap

      public TableMap createTableMap​(@NotNull TableKey tableKey, boolean refreshLocations, boolean refreshSizes)
      Create a new SourceTableMap for the supplied parameters.
      Parameters:
      tableKey - Identifier for the underlying table
      refreshLocations - Whether locations should be refreshed
      refreshSizes - Whether location sizes should be refreshed
      Returns:
      A new source table map
    • createHistoricalTableMap

      public TableMap createHistoricalTableMap​(String namespace, String tablename, String columnPartitionValue)
      Create a new SourceTableMap for the supplied parameters.

      Creates a static TableMap for the given historical system table.

      Parameters:
      namespace - The namespace of the source table
      tablename - The table name of the source table
      columnPartitionValue - Specific column partition to include
      Returns:
      A new source table map
    • createHistoricalTableMap

      public TableMap createHistoricalTableMap​(String namespace, String tablename)
      Create a new SourceTableMap for the supplied parameters.

      Creates a static TableMap for the given historical system table, all column partitions are included.

      Parameters:
      namespace - The namespace of the source table
      tablename - The table name of the source table
      Returns:
      A new source table map
    • createIntradayTableMap

      public TableMap createIntradayTableMap​(String namespace, String tablename, String columnPartitionValue)
      Create a new SourceTableMap for the supplied parameters.

      Creates a static TableMap for the given intraday system table.

      Parameters:
      namespace - The namespace of the table
      tablename - The table name to examine in the intraday data space
      columnPartitionValue - Specific column partition to include
      Returns:
      A new source table map