Class BroadcastSegmentIndexedTable
- java.lang.Object
-
- org.apache.druid.segment.join.table.BroadcastSegmentIndexedTable
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,IndexedTable
,ReferenceCountedObject
public class BroadcastSegmentIndexedTable extends Object implements IndexedTable
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.druid.segment.join.table.IndexedTable
IndexedTable.Index, IndexedTable.Reader
-
-
Constructor Summary
Constructors Constructor Description BroadcastSegmentIndexedTable(QueryableIndexSegment theSegment, Set<String> keyColumns, String version)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<Closeable>
acquireReferences()
This method is expected to increment a reference count and provide aCloseable
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 abyte[]
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 operationsSet<String>
keyColumns()
Returns the columns of this table that have indexes.ColumnSelectorFactory
makeColumnSelectorFactory(ReadableOffset offset, boolean descending, Closer closer)
This method allows a table to directly provide an optimizedColumnSelectorFactory
forIndexedTableJoinMatcher
to create selectors.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
-
-
-
Constructor Detail
-
BroadcastSegmentIndexedTable
public BroadcastSegmentIndexedTable(QueryableIndexSegment theSegment, Set<String> keyColumns, String version)
-
-
Method Detail
-
version
public String version()
Description copied from interface:IndexedTable
Returns the version of this table, used to compare against when loading a new version of the table- Specified by:
version
in interfaceIndexedTable
-
keyColumns
public Set<String> keyColumns()
Description copied from interface:IndexedTable
Returns the columns of this table that have indexes.- Specified by:
keyColumns
in interfaceIndexedTable
-
rowSignature
public RowSignature rowSignature()
Description copied from interface:IndexedTable
Returns the signature of this table, which includes all key columns (as well as other columns that can be selected, but are not keys).- Specified by:
rowSignature
in interfaceIndexedTable
-
numRows
public int numRows()
Description copied from interface:IndexedTable
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.- Specified by:
numRows
in interfaceIndexedTable
-
columnIndex
public IndexedTable.Index columnIndex(int column)
Description copied from interface:IndexedTable
Returns the index for a particular column. The provided column number must be that column's position inIndexedTable.rowSignature()
.- Specified by:
columnIndex
in interfaceIndexedTable
-
columnReader
public IndexedTable.Reader columnReader(int column)
Description copied from interface:IndexedTable
Returns a reader for a particular column. The provided column number must be that column's position inIndexedTable.rowSignature()
. Don't forget to close yourIndexedTable.Reader
when finished reading, to clean up any resources.- Specified by:
columnReader
in interfaceIndexedTable
-
makeColumnSelectorFactory
@Nullable public ColumnSelectorFactory makeColumnSelectorFactory(ReadableOffset offset, boolean descending, Closer closer)
Description copied from interface:IndexedTable
This method allows a table to directly provide an optimizedColumnSelectorFactory
forIndexedTableJoinMatcher
to create selectors. If this method returns null, the defaultIndexedTableColumnSelectorFactory
, which createsIndexedTableDimensionSelector
orIndexedTableColumnValueSelector
as appropriate, both backed with aIndexedTable.columnReader(int)
, will be used instead.- Specified by:
makeColumnSelectorFactory
in interfaceIndexedTable
-
computeCacheKey
public byte[] computeCacheKey()
Description copied from interface:IndexedTable
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)
- Specified by:
computeCacheKey
in interfaceIndexedTable
- Returns:
- the byte array for cache key
-
isCacheable
public boolean isCacheable()
Description copied from interface:IndexedTable
Returns whether this indexed table can be cached for the join operations- Specified by:
isCacheable
in interfaceIndexedTable
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
acquireReferences
public Optional<Closeable> acquireReferences()
Description copied from interface:ReferenceCountedObject
This method is expected to increment a reference count and provide aCloseable
that decrements the reference count when closed. This is likely just a wrapper aroundReferenceCountingCloseableObject.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 theCloseable
it creates to throw exceptions. For callers: if this method returns non-empty, IT MUST BE CLOSED, else reference counts can potentially leak.- Specified by:
acquireReferences
in interfaceReferenceCountedObject
-
-