Interface IndexedTable
-
- All Superinterfaces:
AutoCloseable,Closeable,ReferenceCountedObject
- All Known Implementing Classes:
BroadcastSegmentIndexedTable,FrameBasedIndexedTable,ReferenceCountingIndexedTable,RowBasedIndexedTable
public interface IndexedTable extends ReferenceCountedObject, Closeable
An interface to a table where some columns (the 'key columns') have indexes that enable fast lookups. The main user of this class isIndexedTableJoinable, and its main purpose is to participate in joins.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceIndexedTable.IndexIndexes support fast lookups on key columns.static interfaceIndexedTable.ReaderReaders support reading values out of any column.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description IndexedTable.IndexcolumnIndex(int column)Returns the index for a particular column.IndexedTable.ReadercolumnReader(int column)Returns a reader for a particular column.default byte[]computeCacheKey()Computes abyte[]key for the table that can be used for computing cache keys for join operations.default booleanisCacheable()Returns whether this indexed table can be cached for the join operationsSet<String>keyColumns()Returns the columns of this table that have indexes.default ColumnSelectorFactorymakeColumnSelectorFactory(ReadableOffset offset, boolean descending, Closer closer)This method allows a table to directly provide an optimizedColumnSelectorFactoryforIndexedTableJoinMatcherto create selectors.intnumRows()Returns the number of rows in this table.RowSignaturerowSignature()Returns the signature of this table, which includes all key columns (as well as other columns that can be selected, but are not keys).Stringversion()Returns the version of this table, used to compare against when loading a new version of the table-
Methods inherited from interface org.apache.druid.segment.ReferenceCountedObject
acquireReferences
-
-
-
-
Method Detail
-
version
String version()
Returns the version of this table, used to compare against when loading a new version of the table
-
rowSignature
RowSignature rowSignature()
Returns the signature of this table, which includes all key columns (as well as other columns that can be selected, but are not keys).
-
numRows
int numRows()
Returns the number of rows in this table. It must not change over time, since it is used for things like algorithm selection and reporting of cardinality metadata.
-
columnIndex
IndexedTable.Index columnIndex(int column)
Returns the index for a particular column. The provided column number must be that column's position inrowSignature().
-
columnReader
IndexedTable.Reader columnReader(int column)
Returns a reader for a particular column. The provided column number must be that column's position inrowSignature(). Don't forget to close yourIndexedTable.Readerwhen finished reading, to clean up any resources.
-
makeColumnSelectorFactory
@Nullable default ColumnSelectorFactory makeColumnSelectorFactory(ReadableOffset offset, boolean descending, Closer closer)
This method allows a table to directly provide an optimizedColumnSelectorFactoryforIndexedTableJoinMatcherto create selectors. If this method returns null, the defaultIndexedTableColumnSelectorFactory, which createsIndexedTableDimensionSelectororIndexedTableColumnValueSelectoras appropriate, both backed with acolumnReader(int), will be used instead.
-
computeCacheKey
default byte[] computeCacheKey()
Computes abyte[]key for the table that can be used for computing cache keys for join operations. seeJoinableFactory.computeJoinCacheKey(org.apache.druid.query.DataSource, org.apache.druid.segment.join.JoinConditionAnalysis)- Returns:
- the byte array for cache key
-
isCacheable
default boolean isCacheable()
Returns whether this indexed table can be cached for the join operations
-
-