Package org.apache.druid.segment
Interface StorageAdapter
-
- All Superinterfaces:
ColumnInspector
,CursorFactory
,Expr.InputBindingInspector
- All Known Implementing Classes:
FilteredStorageAdapter
,FrameStorageAdapter
,HashJoinSegmentStorageAdapter
,IncrementalIndexStorageAdapter
,QueryableIndexStorageAdapter
,RowBasedStorageAdapter
,UnnestStorageAdapter
public interface StorageAdapter extends CursorFactory, ColumnInspector
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Indexed<String>
getAvailableDimensions()
Iterable<String>
getAvailableMetrics()
ColumnCapabilities
getColumnCapabilities(String column)
Returns capabilities of a particular column, if known.int
getDimensionCardinality(String column)
Returns the number of distinct values for a column, orDimensionDictionarySelector.CARDINALITY_UNKNOWN
if unknown.org.joda.time.Interval
getInterval()
org.joda.time.DateTime
getMaxIngestedEventTime()
org.joda.time.DateTime
getMaxTime()
Metadata-only operation that returns an upper bound onColumnHolder.TIME_COLUMN_NAME
values for this adapter.Comparable
getMaxValue(String column)
Returns the minimum value of the provided column, if known through an index, dictionary, or cache.Metadata
getMetadata()
org.joda.time.DateTime
getMinTime()
Metadata-only operation that returns a lower bound onColumnHolder.TIME_COLUMN_NAME
values for this adapter.Comparable
getMinValue(String column)
Returns the minimum value of the provided column, if known through an index, dictionary, or cache.int
getNumRows()
default RowSignature
getRowSignature()
Returns the row signature of the data available from this adapter.default boolean
hasBuiltInFilters()
Returns true if this storage adapter can filter some rows out.default boolean
isFromTombstone()
-
Methods inherited from interface org.apache.druid.segment.ColumnInspector
getColumnCapabilitiesWithDefault, getType
-
Methods inherited from interface org.apache.druid.segment.CursorFactory
canVectorize, makeCursors, makeVectorCursor
-
Methods inherited from interface org.apache.druid.math.expr.Expr.InputBindingInspector
areNumeric, areNumeric, areSameTypes, areSameTypes, areScalar, areScalar, canVectorize, canVectorize
-
-
-
-
Method Detail
-
getInterval
org.joda.time.Interval getInterval()
-
getRowSignature
default RowSignature getRowSignature()
Returns the row signature of the data available from this adapter. For mutable adapters, even though the signature may evolve over time, any particular object returned by this method is an immutable snapshot.
-
getDimensionCardinality
int getDimensionCardinality(String column)
Returns the number of distinct values for a column, orDimensionDictionarySelector.CARDINALITY_UNKNOWN
if unknown. If the column doesn't exist, returns 1, because a column that doesn't exist is treated as a column of default (or null) values.
-
getMinTime
org.joda.time.DateTime getMinTime()
Metadata-only operation that returns a lower bound onColumnHolder.TIME_COLUMN_NAME
values for this adapter. May be earlier than the actual minimum data timestamp. ForQueryableIndexStorageAdapter
andIncrementalIndexStorageAdapter
specifically, which back regular tables (i.e.TableDataSource
), this method contract is tighter: it does return the actual minimum data timestamp. This fact is leveraged byTimeBoundaryQuery
to return results using metadata only.
-
getMaxTime
org.joda.time.DateTime getMaxTime()
Metadata-only operation that returns an upper bound onColumnHolder.TIME_COLUMN_NAME
values for this adapter. May be later than the actual maximum data timestamp. ForQueryableIndexStorageAdapter
andIncrementalIndexStorageAdapter
specifically, which back regular tables (i.e.TableDataSource
), this method contract is tighter: it does return the actual maximum data timestamp. This fact is leveraged byTimeBoundaryQuery
to return results using metadata only.
-
getMinValue
@Nullable Comparable getMinValue(String column)
Returns the minimum value of the provided column, if known through an index, dictionary, or cache. Returns null if not known. Does not scan the column to find the minimum value.
-
getMaxValue
@Nullable Comparable getMaxValue(String column)
Returns the minimum value of the provided column, if known through an index, dictionary, or cache. Returns null if not known. Does not scan the column to find the maximum value.
-
getColumnCapabilities
@Nullable ColumnCapabilities getColumnCapabilities(String column)
Returns capabilities of a particular column, if known. May be null if the column doesn't exist, or if the column does exist but the capabilities are unknown. The latter is possible with dynamically discovered columns. Note that StorageAdapters are representations of "real" segments, so they are not aware of any virtual columns that may be involved in a query. In general, query engines should instead use the methodColumnSelectorFactory.getColumnCapabilities(String)
, which returns capabilities for virtual columns as well.- Specified by:
getColumnCapabilities
in interfaceColumnInspector
- Parameters:
column
- column name- Returns:
- capabilities, or null
-
getNumRows
int getNumRows()
-
getMaxIngestedEventTime
org.joda.time.DateTime getMaxIngestedEventTime()
-
hasBuiltInFilters
default boolean hasBuiltInFilters()
Returns true if this storage adapter can filter some rows out. The actual column cardinality can be lower than whatgetDimensionCardinality(java.lang.String)
returns if this returns true. Dimension selectors for such storage adapter can return non-contiguous dictionary IDs because the dictionary IDs in filtered rows will not be returned. Note that the number of rows accessible via this storage adapter will not necessarily decrease because of the built-in filters. For inner joins, for example, the number of joined rows can be larger than the number of rows in the base adapter even though this method returns true.
-
isFromTombstone
default boolean isFromTombstone()
- Returns:
- true if this index was created from a tombstone or false otherwise
-
-