Class DataIndexer
java.lang.Object
io.deephaven.engine.table.impl.indexer.DataIndexer
- All Implemented Interfaces:
TrackingRowSet.Indexer
Indexer that provides single and multi-column clustering indexes for a table, linked to a
TrackingRowSet.- ApiNote:
- DataIndexers should not be used after the host
TrackingRowSethas beenclosed.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceInterface forDataIndeximplementations that may opt into strong reachability within the DataIndexer's cache. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDataIndex(@NotNull DataIndex dataIndex) Add aDataIndexto this DataIndexer.dataIndexes(boolean ensureValidAndLive) static DataIndexerexistingOf(@NotNull TrackingRowSet rowSet) DataIndexer lookup method.getCompatibleDataIndexes(@NotNull Collection<ColumnSource<?>> keyColumns) Get a list of all theDataIndexesin this DataIndexer that contain the supplied key columns.getDataIndex(@NotNull ColumnSource<?>... keyColumns) Return aDataIndexfor the given key columns, ornullif no such index exists, if the cached index is invalid, or if therefreshingcached index is no longer live.static @Nullable DataIndexgetDataIndex(@NotNull Table table, String... keyColumnNames) Iftablehas a DataIndexer, return aDataIndexfor the given key columns, ornullif no such index exists, if the cached index is invalid, or if therefreshingcached index is no longer live.static @Nullable DataIndexgetDataIndex(@NotNull Table table, Collection<String> keyColumnNames) Iftablehas a DataIndexer, return aDataIndexfor the given key columns, ornullif no such index exists, if the cached index is invalid, or if therefreshingcached index is no longer live.getDataIndex(@NotNull Collection<ColumnSource<?>> keyColumns) Return aDataIndexfor the given key columns, ornullif no such index exists, if the cached index is invalid, or if therefreshingcached index is no longer live.static @Nullable DataIndexgetOptimalPartialIndex(Table table, String... keyColumnNames) Return a valid, liveDataIndexfor a strict subset of the given key columns, ornullif no such index exists.static DataIndexgetOrCreateDataIndex(@NotNull Table table, @NotNull String... keyColumnNames) Create aDataIndexfortableindexingkeyColumns, if no valid, live data index already exists for these inputs.static DataIndexgetOrCreateDataIndex(@NotNull Table table, @NotNull Collection<String> keyColumnNames) Create aDataIndexfortableindexingkeyColumns, if no valid, live data index already exists for these inputs.booleanhasDataIndex(@NotNull ColumnSource<?>... keyColumns) Test whether this DataIndexer has a usableDataIndexfor the given key columns.static booleanhasDataIndex(@NotNull Table table, @NotNull String... keyColumnNames) Test whethertablehas a DataIndexer with a usableDataIndexfor the given key columns.static booleanhasDataIndex(@NotNull Table table, @NotNull Collection<String> keyColumnNames) Test whethertablehas a DataIndexer with a usableDataIndexfor the given key columns.booleanhasDataIndex(@NotNull Collection<ColumnSource<?>> keyColumns) Test whether this DataIndexer has a usableDataIndexfor the given key columns.static DataIndexerof(@NotNull TrackingRowSet rowSet) DataIndexer factory method.
-
Method Details
-
existingOf
DataIndexer lookup method. Use this call when you will query from the returned DataIndexer but not add new ones.- Parameters:
rowSet- The row set to index- Returns:
- The DataIndexer for
rowSet, or null if none exists
-
of
DataIndexer factory method. Use this call when you will add indexes to the returned DataIndexer.- Parameters:
rowSet- The row set to index- Returns:
- The DataIndexer for
rowSet, created by this call if necessary
-
hasDataIndex
public static boolean hasDataIndex(@NotNull @NotNull Table table, @NotNull @NotNull String... keyColumnNames) Test whethertablehas a DataIndexer with a usableDataIndexfor the given key columns. Note that a result from this method is a snapshot of current state, and does not guarantee anything about future calls tohasDataIndex(io.deephaven.engine.table.Table, java.lang.String...),getDataIndex(io.deephaven.engine.table.Table, java.lang.String...), orgetOrCreateDataIndex(Table, String...). -
hasDataIndex
public static boolean hasDataIndex(@NotNull @NotNull Table table, @NotNull @NotNull Collection<String> keyColumnNames) Test whethertablehas a DataIndexer with a usableDataIndexfor the given key columns. Note that a result from this method is a snapshot of current state, and does not guarantee anything about future calls tohasDataIndex(io.deephaven.engine.table.Table, java.lang.String...),getDataIndex(io.deephaven.engine.table.Table, java.lang.String...), orgetOrCreateDataIndex(Table, String...). -
hasDataIndex
Test whether this DataIndexer has a usableDataIndexfor the given key columns. Note that a result from this method is a snapshot of current state, and does not guarantee anything about future calls tohasDataIndex(io.deephaven.engine.table.Table, java.lang.String...),getDataIndex(io.deephaven.engine.table.Table, java.lang.String...), orgetOrCreateDataIndex(Table, String...).- Parameters:
keyColumns- The key columns to check- Returns:
- Whether this DataIndexer has a
DataIndexfor the given key columns
-
hasDataIndex
Test whether this DataIndexer has a usableDataIndexfor the given key columns. Note that a result from this method is a snapshot of current state, and does not guarantee anything about future calls tohasDataIndex(io.deephaven.engine.table.Table, java.lang.String...),getDataIndex(io.deephaven.engine.table.Table, java.lang.String...), orgetOrCreateDataIndex(Table, String...).- Parameters:
keyColumns- The key columns to check- Returns:
- Whether this DataIndexer has a
DataIndexfor the given key columns
-
getDataIndex
@Nullable public static @Nullable DataIndex getDataIndex(@NotNull @NotNull Table table, String... keyColumnNames) Iftablehas a DataIndexer, return aDataIndexfor the given key columns, ornullif no such index exists, if the cached index is invalid, or if therefreshingcached index is no longer live. -
getDataIndex
@Nullable public static @Nullable DataIndex getDataIndex(@NotNull @NotNull Table table, Collection<String> keyColumnNames) Iftablehas a DataIndexer, return aDataIndexfor the given key columns, ornullif no such index exists, if the cached index is invalid, or if therefreshingcached index is no longer live. -
getDataIndex
Return aDataIndexfor the given key columns, ornullif no such index exists, if the cached index is invalid, or if therefreshingcached index is no longer live.- Parameters:
keyColumns- Thecolumn sourcesfor which to retrieve aDataIndex- Returns:
- The
DataIndex, ornullif one does not exist
-
getDataIndex
Return aDataIndexfor the given key columns, ornullif no such index exists, if the cached index is invalid, or if therefreshingcached index is no longer live.- Parameters:
keyColumns- Thecolumn sourcesfor which to retrieve aDataIndex- Returns:
- The
DataIndex, ornullif one does not exist
-
getOptimalPartialIndex
@Nullable public static @Nullable DataIndex getOptimalPartialIndex(Table table, String... keyColumnNames) Return a valid, liveDataIndexfor a strict subset of the given key columns, ornullif no such index exists. Will choose the DataIndex that results in the largest index table, following the assumption that the largest index table will divide the source table into the most specific partitions. -
getCompatibleDataIndexes
@NotNull public @NotNull List<DataIndex> getCompatibleDataIndexes(@NotNull @NotNull Collection<ColumnSource<?>> keyColumns) Get a list of all theDataIndexesin this DataIndexer that contain the supplied key columns. This will return indexes with key columns that are supersets of the supplied key columns.- Parameters:
keyColumns- Thecolumn sourcesfor which to retrievedata indexes- Returns:
- All the
DataIndexesin this DataIndexer
-
getOrCreateDataIndex
public static DataIndex getOrCreateDataIndex(@NotNull @NotNull Table table, @NotNull @NotNull String... keyColumnNames) Create aDataIndexfortableindexingkeyColumns, if no valid, live data index already exists for these inputs. -
getOrCreateDataIndex
public static DataIndex getOrCreateDataIndex(@NotNull @NotNull Table table, @NotNull @NotNull Collection<String> keyColumnNames) Create aDataIndexfortableindexingkeyColumns, if no valid, live data index already exists for these inputs. -
addDataIndex
Add aDataIndexto this DataIndexer.- Parameters:
dataIndex- TheDataIndexto add- Throws:
IllegalStateException- If a valid, liveDataIndexalready exists for the given key columns
-
dataIndexes
- Parameters:
ensureValidAndLive- Whether to ensure that returnedDataIndexesare valid and live- Returns:
- All the
DataIndexesin this DataIndexer
-