public class RowBasedIndexedTable<RowType> extends Object implements IndexedTable
RowAdapter to work with any sort of object.
The class allows passing in a cache key. If the key is non-null, results of any join on this table can be cached.
That cache becomes invalidated if this key changes. Creators of this class can pass in a non-null cache key if its
possible to construct a small identifier
- that must change when contents of this indexed table chances
- May remain unchanged when contents of this indexed table
How the cache key is constructed itself, depends on how the RowBasedIndexedTable is being built.IndexedTable.Index, IndexedTable.Reader| Constructor and Description |
|---|
RowBasedIndexedTable(List<RowType> table,
RowAdapter<RowType> rowAdapter,
RowSignature rowSignature,
Set<String> keyColumns,
String version) |
RowBasedIndexedTable(List<RowType> table,
RowAdapter<RowType> rowAdapter,
RowSignature rowSignature,
Set<String> keyColumns,
String version,
byte[] cacheKey) |
| Modifier and Type | Method and Description |
|---|---|
Optional<Closeable> |
acquireReferences()
This method is expected to increment a reference count and provide a
Closeable that decrements the
reference count when closed. |
void |
close() |
IndexedTable.Index |
columnIndex(int column)
Returns the index for a particular column.
|
IndexedTable.Reader |
columnReader(int column)
Returns a reader for a particular column.
|
byte[] |
computeCacheKey()
Computes a
byte[] key for the table that can be used for computing cache keys for join operations. |
boolean |
isCacheable()
Returns whether this indexed table can be cached for the join operations
|
Set<String> |
keyColumns()
Returns the columns of this table that have indexes.
|
int |
numRows()
Returns the number of rows in this table.
|
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).
|
String |
version()
Returns the version of this table, used to compare against when loading a new version of the table
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitmakeColumnSelectorFactorypublic RowBasedIndexedTable(List<RowType> table, RowAdapter<RowType> rowAdapter, RowSignature rowSignature, Set<String> keyColumns, String version)
public RowBasedIndexedTable(List<RowType> table, RowAdapter<RowType> rowAdapter, RowSignature rowSignature, Set<String> keyColumns, String version, @Nullable byte[] cacheKey)
public String version()
IndexedTableversion in interface IndexedTablepublic Set<String> keyColumns()
IndexedTablekeyColumns in interface IndexedTablepublic RowSignature rowSignature()
IndexedTablerowSignature in interface IndexedTablepublic IndexedTable.Index columnIndex(int column)
IndexedTableIndexedTable.rowSignature().columnIndex in interface IndexedTablepublic IndexedTable.Reader columnReader(int column)
IndexedTableIndexedTable.rowSignature(). Don't forget to close your IndexedTable.Reader when finished reading, to clean up any
resources.columnReader in interface IndexedTablepublic byte[] computeCacheKey()
IndexedTablebyte[] key for the table that can be used for computing cache keys for join operations.
see JoinableFactory.computeJoinCacheKey(org.apache.druid.query.DataSource, org.apache.druid.segment.join.JoinConditionAnalysis)computeCacheKey in interface IndexedTablepublic boolean isCacheable()
IndexedTableisCacheable in interface IndexedTablepublic int numRows()
IndexedTablenumRows in interface IndexedTablepublic Optional<Closeable> acquireReferences()
ReferenceCountedObjectCloseable that decrements the
reference count when closed. This is likely just a wrapper around
ReferenceCountingCloseableObject.incrementReferenceAndDecrementOnceCloseable(), but may also include any
other associated references which should be incremented when this method is called, and decremented/released by the
closeable.
IMPORTANT NOTE: to fulfill the contract of this method, implementors must return a closeable to indicate that the
reference can be acquired, even if there is nothing to close. Implementors should avoid allowing this method or the
Closeable it creates to throw exceptions.
For callers: if this method returns non-empty, IT MUST BE CLOSED, else reference counts can potentially leak.acquireReferences in interface ReferenceCountedObjectpublic void close()
close in interface Closeableclose in interface AutoCloseableCopyright © 2011–2022 The Apache Software Foundation. All rights reserved.