Class OnHeapAggregateProjection
- java.lang.Object
-
- org.apache.druid.segment.incremental.OnHeapAggregateProjection
-
- All Implemented Interfaces:
Expr.InputBindingInspector,ColumnInspector,IncrementalIndexRowSelector
public class OnHeapAggregateProjection extends Object implements IncrementalIndexRowSelector
Projection ofOnheapIncrementalIndexforAggregateProjectionSpec
-
-
Constructor Summary
Constructors Constructor Description OnHeapAggregateProjection(AggregateProjectionMetadata.Schema schema, List<IncrementalIndex.DimensionDesc> dimensions, Map<String,IncrementalIndex.DimensionDesc> dimensionsMap, int[] parentDimensionIndex, long minTimestamp, boolean useMaxMemoryEstimates, long maxBytesPerRowForAggregators)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddToFacts(IncrementalIndexRow key, InputRow inputRow, List<String> parseExceptionMessages, AtomicLong totalSizeInBytes)Add row to projectionfactsHolder, updating totalSizeInBytes estimateColumnCapabilitiesgetColumnCapabilities(String column)Returns capabilities of a particular column.ColumnFormatgetColumnFormat(String columnName)GetColumnFormatfor a dimension, metrics, or time column, or null if the column does not existIncrementalIndex.DimensionDescgetDimension(String columnName)getIncrementalIndex.DimensionDescfor the specified column, if available, which provides access to things likeDimensionIndexerandDimensionHandleras well as column capabilities and position within the rowList<String>getDimensionNames(boolean includeTime)Returns list of dimension names for the row selector, optionally including the time column.List<IncrementalIndex.DimensionDesc>getDimensions()Returns list ofIncrementalIndex.DimensionDescfor the row selectorMap<String,IncrementalIndex.DimensionDesc>getDimensionsMap()FactsHoldergetFacts()Get theFactsHoldercontaining all of theIncrementalIndexRowbacking this selectorintgetLastRowIndex()Highest valueIncrementalIndexRow.getRowIndex()available in this selector.IncrementalIndex.MetricDescgetMetric(String columnName)GetIncrementalIndex.MetricDescwhich provides column capabilities and position in the aggregators section of the rowdoublegetMetricDoubleValue(int rowOffset, int aggOffset)floatgetMetricFloatValue(int rowOffset, int aggOffset)longgetMetricLongValue(int rowOffset, int aggOffset)List<String>getMetricNames()Returns list of all metric column names for the row selectorObjectgetMetricObjectValue(int rowOffset, int aggOffset)List<OrderBy>getOrdering()Ordering for the data in the facts tableintgetTimePosition()Position of the time column inIncrementalIndexRowSelector.getOrdering()booleanisEmpty()Are there anyIncrementalIndexRowstored in theFactsHolder?booleanisNull(int rowOffset, int aggOffset)intnumRows()Number of rows inFactsHolderAggregateProjectionMetadatatoMetadata()-
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
getType
-
Methods inherited from interface org.apache.druid.math.expr.Expr.InputBindingInspector
areNumeric, areNumeric, areSameTypes, areSameTypes, areScalar, areScalar, canVectorize, canVectorize
-
-
-
-
Constructor Detail
-
OnHeapAggregateProjection
public OnHeapAggregateProjection(AggregateProjectionMetadata.Schema schema, List<IncrementalIndex.DimensionDesc> dimensions, Map<String,IncrementalIndex.DimensionDesc> dimensionsMap, int[] parentDimensionIndex, long minTimestamp, boolean useMaxMemoryEstimates, long maxBytesPerRowForAggregators)
-
-
Method Detail
-
addToFacts
public void addToFacts(IncrementalIndexRow key, InputRow inputRow, List<String> parseExceptionMessages, AtomicLong totalSizeInBytes)
Add row to projectionfactsHolder, updating totalSizeInBytes estimate
-
getFacts
public FactsHolder getFacts()
Description copied from interface:IncrementalIndexRowSelectorGet theFactsHoldercontaining all of theIncrementalIndexRowbacking this selector- Specified by:
getFactsin interfaceIncrementalIndexRowSelector
-
getDimensions
public List<IncrementalIndex.DimensionDesc> getDimensions()
Description copied from interface:IncrementalIndexRowSelectorReturns list ofIncrementalIndex.DimensionDescfor the row selector- Specified by:
getDimensionsin interfaceIncrementalIndexRowSelector
-
getMetricNames
public List<String> getMetricNames()
Description copied from interface:IncrementalIndexRowSelectorReturns list of all metric column names for the row selector- Specified by:
getMetricNamesin interfaceIncrementalIndexRowSelector
-
getDimension
public IncrementalIndex.DimensionDesc getDimension(String columnName)
Description copied from interface:IncrementalIndexRowSelectorgetIncrementalIndex.DimensionDescfor the specified column, if available, which provides access to things likeDimensionIndexerandDimensionHandleras well as column capabilities and position within the row- Specified by:
getDimensionin interfaceIncrementalIndexRowSelector
-
getMetric
public IncrementalIndex.MetricDesc getMetric(String columnName)
Description copied from interface:IncrementalIndexRowSelectorGetIncrementalIndex.MetricDescwhich provides column capabilities and position in the aggregators section of the row- Specified by:
getMetricin interfaceIncrementalIndexRowSelector
-
getOrdering
public List<OrderBy> getOrdering()
Description copied from interface:IncrementalIndexRowSelectorOrdering for the data in the facts table- Specified by:
getOrderingin interfaceIncrementalIndexRowSelector
-
getTimePosition
public int getTimePosition()
Description copied from interface:IncrementalIndexRowSelectorPosition of the time column inIncrementalIndexRowSelector.getOrdering()- Specified by:
getTimePositionin interfaceIncrementalIndexRowSelector
-
isEmpty
public boolean isEmpty()
Description copied from interface:IncrementalIndexRowSelectorAre there anyIncrementalIndexRowstored in theFactsHolder?- Specified by:
isEmptyin interfaceIncrementalIndexRowSelector
-
getLastRowIndex
public int getLastRowIndex()
Description copied from interface:IncrementalIndexRowSelectorHighest valueIncrementalIndexRow.getRowIndex()available in this selector. Note that these values do not reflect the position of the row in theFactsHolder, rather just the order in which they were processed- Specified by:
getLastRowIndexin interfaceIncrementalIndexRowSelector
-
getMetricFloatValue
public float getMetricFloatValue(int rowOffset, int aggOffset)- Specified by:
getMetricFloatValuein interfaceIncrementalIndexRowSelector- Parameters:
rowOffset- row to get float aggregator valueaggOffset- position of the aggregator in the aggregators array of the data schema- Returns:
- float value of the metric
-
getMetricLongValue
public long getMetricLongValue(int rowOffset, int aggOffset)- Specified by:
getMetricLongValuein interfaceIncrementalIndexRowSelector- Parameters:
rowOffset- row to get long aggregator valueaggOffset- position of the aggregator in the aggregators array of the data schema- Returns:
- long value of the aggregator for this row
-
getMetricDoubleValue
public double getMetricDoubleValue(int rowOffset, int aggOffset)- Specified by:
getMetricDoubleValuein interfaceIncrementalIndexRowSelector- Parameters:
rowOffset- row to get double aggregator valueaggOffset- position of the aggregator in the aggregators array of the data schema- Returns:
- double value of the aggregator for this row
-
getMetricObjectValue
@Nullable public Object getMetricObjectValue(int rowOffset, int aggOffset)
- Specified by:
getMetricObjectValuein interfaceIncrementalIndexRowSelector- Parameters:
rowOffset- row to get long aggregator valueaggOffset- position of the aggregator in the aggregators array of the data schema- Returns:
- long value of the aggregator for this row
-
isNull
public boolean isNull(int rowOffset, int aggOffset)- Specified by:
isNullin interfaceIncrementalIndexRowSelector- Parameters:
rowOffset- row to check for a aggregator valueaggOffset- position of the aggregator in the aggregators array of the data schema- Returns:
- is the value null for this row?
-
getColumnFormat
public ColumnFormat getColumnFormat(String columnName)
Description copied from interface:IncrementalIndexRowSelectorGetColumnFormatfor a dimension, metrics, or time column, or null if the column does not exist- Specified by:
getColumnFormatin interfaceIncrementalIndexRowSelector
-
numRows
public int numRows()
Description copied from interface:IncrementalIndexRowSelectorNumber of rows inFactsHolder- Specified by:
numRowsin interfaceIncrementalIndexRowSelector
-
getDimensionNames
public List<String> getDimensionNames(boolean includeTime)
Description copied from interface:IncrementalIndexRowSelectorReturns list of dimension names for the row selector, optionally including the time column. If time is included, the order columns appear in this list will matchIncrementalIndexRowSelector.getOrdering()- Specified by:
getDimensionNamesin interfaceIncrementalIndexRowSelector
-
getColumnCapabilities
@Nullable public ColumnCapabilities getColumnCapabilities(String column)
Description copied from interface:ColumnInspectorReturns capabilities of a particular column.- Specified by:
getColumnCapabilitiesin interfaceColumnInspector- Parameters:
column- column name- Returns:
- capabilities, or null
-
getDimensionsMap
public Map<String,IncrementalIndex.DimensionDesc> getDimensionsMap()
-
toMetadata
public AggregateProjectionMetadata toMetadata()
-
-