Package org.apache.druid.frame.segment
Class FrameStorageAdapter
- java.lang.Object
-
- org.apache.druid.frame.segment.FrameStorageAdapter
-
- All Implemented Interfaces:
Expr.InputBindingInspector
,ColumnInspector
,CursorFactory
,StorageAdapter
public class FrameStorageAdapter extends Object implements StorageAdapter
AStorageAdapter
implementation based on a singleFrame
. This class is used for both columnar and row-based frames.
-
-
Constructor Summary
Constructors Constructor Description FrameStorageAdapter(Frame frame, FrameReader frameReader, org.joda.time.Interval interval)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canVectorize(Filter filter, VirtualColumns virtualColumns, boolean descending)
Returns true if the provided combination of parameters can be handled by "makeVectorCursor".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()
RowSignature
getRowSignature()
Returns the row signature of the data available from this adapter.Sequence<Cursor>
makeCursors(Filter filter, org.joda.time.Interval interval, VirtualColumns virtualColumns, Granularity gran, boolean descending, QueryMetrics<?> queryMetrics)
Creates a sequence of Cursors, one for each time-granular bucket (based on the provided Granularity).VectorCursor
makeVectorCursor(Filter filter, org.joda.time.Interval interval, VirtualColumns virtualColumns, boolean descending, int vectorSize, QueryMetrics<?> queryMetrics)
Creates a VectorCursor.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.druid.segment.ColumnInspector
getColumnCapabilitiesWithDefault, getType
-
Methods inherited from interface org.apache.druid.math.expr.Expr.InputBindingInspector
areNumeric, areNumeric, areSameTypes, areSameTypes, areScalar, areScalar, canVectorize, canVectorize
-
Methods inherited from interface org.apache.druid.segment.StorageAdapter
hasBuiltInFilters, isFromTombstone
-
-
-
-
Constructor Detail
-
FrameStorageAdapter
public FrameStorageAdapter(Frame frame, FrameReader frameReader, org.joda.time.Interval interval)
-
-
Method Detail
-
getInterval
public org.joda.time.Interval getInterval()
- Specified by:
getInterval
in interfaceStorageAdapter
-
getRowSignature
public RowSignature getRowSignature()
Description copied from interface:StorageAdapter
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.- Specified by:
getRowSignature
in interfaceStorageAdapter
-
getAvailableDimensions
public Indexed<String> getAvailableDimensions()
- Specified by:
getAvailableDimensions
in interfaceStorageAdapter
-
getAvailableMetrics
public Iterable<String> getAvailableMetrics()
- Specified by:
getAvailableMetrics
in interfaceStorageAdapter
-
getDimensionCardinality
public int getDimensionCardinality(String column)
Description copied from interface:StorageAdapter
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.- Specified by:
getDimensionCardinality
in interfaceStorageAdapter
-
getMinTime
public org.joda.time.DateTime getMinTime()
Description copied from interface:StorageAdapter
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.- Specified by:
getMinTime
in interfaceStorageAdapter
-
getMaxTime
public org.joda.time.DateTime getMaxTime()
Description copied from interface:StorageAdapter
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.- Specified by:
getMaxTime
in interfaceStorageAdapter
-
getMinValue
@Nullable public Comparable getMinValue(String column)
Description copied from interface:StorageAdapter
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.- Specified by:
getMinValue
in interfaceStorageAdapter
-
getMaxValue
@Nullable public Comparable getMaxValue(String column)
Description copied from interface:StorageAdapter
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.- Specified by:
getMaxValue
in interfaceStorageAdapter
-
getColumnCapabilities
@Nullable public ColumnCapabilities getColumnCapabilities(String column)
Description copied from interface:StorageAdapter
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
- Specified by:
getColumnCapabilities
in interfaceStorageAdapter
- Parameters:
column
- column name- Returns:
- capabilities, or null
-
getNumRows
public int getNumRows()
- Specified by:
getNumRows
in interfaceStorageAdapter
-
getMaxIngestedEventTime
public org.joda.time.DateTime getMaxIngestedEventTime()
- Specified by:
getMaxIngestedEventTime
in interfaceStorageAdapter
-
getMetadata
@Nullable public Metadata getMetadata()
- Specified by:
getMetadata
in interfaceStorageAdapter
-
canVectorize
public boolean canVectorize(@Nullable Filter filter, VirtualColumns virtualColumns, boolean descending)
Description copied from interface:CursorFactory
Returns true if the provided combination of parameters can be handled by "makeVectorCursor". Query engines should use this before running in vectorized mode, and be prepared to fall back to non-vectorized mode if this method returns false.- Specified by:
canVectorize
in interfaceCursorFactory
-
makeCursors
public Sequence<Cursor> makeCursors(@Nullable Filter filter, org.joda.time.Interval interval, VirtualColumns virtualColumns, Granularity gran, boolean descending, @Nullable QueryMetrics<?> queryMetrics)
Description copied from interface:CursorFactory
Creates a sequence of Cursors, one for each time-granular bucket (based on the provided Granularity).- Specified by:
makeCursors
in interfaceCursorFactory
-
makeVectorCursor
@Nullable public VectorCursor makeVectorCursor(@Nullable Filter filter, org.joda.time.Interval interval, VirtualColumns virtualColumns, boolean descending, int vectorSize, @Nullable QueryMetrics<?> queryMetrics)
Description copied from interface:CursorFactory
Creates a VectorCursor. Unlike the Cursor returned by "makeCursor", there is just one of these. Hence, this method does not take a "granularity" parameter. Before calling this method, check "canVectorize" to see if the call you are about to make will throw an error or not. Returns null if there is no data to walk over (for example, if the "interval" does not overlap the data interval of this segment).- Specified by:
makeVectorCursor
in interfaceCursorFactory
-
-