public abstract class IncrementalIndex extends AbstractIndex implements Iterable<Row>, Closeable, ColumnInspector
| Modifier and Type | Class and Description |
|---|---|
static class |
IncrementalIndex.DimensionDesc |
static class |
IncrementalIndex.MetricDesc |
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
preserveExistingMetrics |
| Modifier | Constructor and Description |
|---|---|
protected |
IncrementalIndex(IncrementalIndexSchema incrementalIndexSchema,
boolean deserializeComplexMetrics,
boolean concurrentEventAdd,
boolean preserveExistingMetrics,
boolean useMaxMemoryEstimates)
Setting deserializeComplexMetrics to false is necessary for intermediate aggregation such as groupBy that
should not deserialize input columns using ComplexMetricSerde for aggregators that return complex metrics.
|
| Modifier and Type | Method and Description |
|---|---|
IncrementalIndexAddResult |
add(InputRow row)
Adds a new row.
|
IncrementalIndexAddResult |
add(InputRow row,
boolean skipMaxRowsInMemoryCheck)
Adds a new row.
|
protected abstract org.apache.druid.segment.incremental.IncrementalIndex.AddToFactsResult |
addToFacts(InputRow row,
IncrementalIndexRow key,
ThreadLocal<InputRow> rowContainer,
com.google.common.base.Supplier<InputRow> rowSupplier,
boolean skipMaxRowsInMemoryCheck) |
abstract boolean |
canAppendRow() |
void |
close() |
protected Comparator<IncrementalIndexRow> |
dimsComparator() |
InputRow |
formatRow(InputRow row) |
AtomicLong |
getBytesInMemory() |
Map<String,ColumnCapabilities> |
getColumnCapabilities() |
ColumnCapabilities |
getColumnCapabilities(String columnName)
Returns capabilities of a particular column.
|
List<String> |
getColumnNames() |
static ParseException |
getCombinedParseException(InputRow row,
List<String> dimParseExceptionMessages,
List<String> aggParseExceptionMessages) |
IncrementalIndex.DimensionDesc |
getDimension(String dimension) |
Integer |
getDimensionIndex(String dimension) |
List<String> |
getDimensionNames() |
List<String> |
getDimensionOrder() |
List<IncrementalIndex.DimensionDesc> |
getDimensions() |
DimensionsSpec |
getDimensionsSpec()
Returns dimensionsSpec from the ingestionSpec.
|
abstract org.apache.druid.segment.incremental.IncrementalIndex.FactsHolder |
getFacts() |
org.joda.time.Interval |
getInterval() |
abstract int |
getLastRowIndex() |
org.joda.time.DateTime |
getMaxIngestedEventTime() |
org.joda.time.DateTime |
getMaxTime() |
Metadata |
getMetadata() |
AggregatorFactory[] |
getMetricAggs() |
protected abstract double |
getMetricDoubleValue(int rowOffset,
int aggOffset) |
protected abstract float |
getMetricFloatValue(int rowOffset,
int aggOffset) |
protected abstract long |
getMetricLongValue(int rowOffset,
int aggOffset) |
List<String> |
getMetricNames() |
protected abstract Object |
getMetricObjectValue(int rowOffset,
int aggOffset) |
String |
getMetricType(String metric) |
org.joda.time.DateTime |
getMinTime() |
abstract String |
getOutOfRowsReason() |
protected abstract void |
initAggs(AggregatorFactory[] metrics,
com.google.common.base.Supplier<InputRow> rowSupplier,
boolean deserializeComplexMetrics,
boolean concurrentEventAdd) |
boolean |
isEmpty() |
protected abstract boolean |
isNull(int rowOffset,
int aggOffset) |
boolean |
isRollup() |
abstract Iterable<Row> |
iterableWithPostAggregations(List<PostAggregator> postAggs,
boolean descending) |
Iterator<Row> |
iterator() |
void |
loadDimensionIterable(Iterable<String> oldDimensionOrder,
Map<String,ColumnCapabilities> oldColumnCapabilities)
Currently called to initialize IncrementalIndex dimension order during index creation
Index dimension ordering could be changed to initialize from DimensionsSpec after resolution of
https://github.com/apache/druid/issues/2011
|
protected ColumnSelectorFactory |
makeColumnSelectorFactory(AggregatorFactory agg,
com.google.common.base.Supplier<InputRow> in,
boolean deserializeComplexMetrics) |
static ColumnSelectorFactory |
makeColumnSelectorFactory(VirtualColumns virtualColumns,
AggregatorFactory agg,
com.google.common.base.Supplier<InputRow> in,
boolean deserializeComplexMetrics)
Column selector used at ingestion time for inputs to aggregators.
|
ColumnValueSelector<?> |
makeMetricColumnValueSelector(String metric,
IncrementalIndexRowHolder currEntry) |
int |
size() |
StorageAdapter |
toStorageAdapter() |
toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitforEach, spliteratorgetColumnCapabilitiesWithDefault, getTypeareNumeric, areNumeric, areSameTypes, areSameTypes, areScalar, areScalar, canVectorize, canVectorizeprotected IncrementalIndex(IncrementalIndexSchema incrementalIndexSchema, boolean deserializeComplexMetrics, boolean concurrentEventAdd, boolean preserveExistingMetrics, boolean useMaxMemoryEstimates)
Set concurrentEventAdd to true to indicate that adding of input row should be thread-safe (for example, groupBy where the multiple threads can add concurrently to the IncrementalIndex).
incrementalIndexSchema - the schema to use for incremental indexdeserializeComplexMetrics - flag whether or not to call ComplexMetricExtractor.extractValue() on the input
value for aggregators that return metrics other than float.concurrentEventAdd - flag whether ot not adding of input rows should be thread-safepreserveExistingMetrics - When set to true, for any row that already has metric
(with the same name defined in metricSpec), the metric aggregator in metricSpec
is skipped and the existing metric is unchanged. If the row does not already have
the metric, then the metric aggregator is applied on the source column as usual.
This should only be set for DruidInputSource since that is the only case where we
can have existing metrics. This is currently only use by auto compaction and
should not be use for anything else.useMaxMemoryEstimates - true if max values should be used to estimate memorypublic static ColumnSelectorFactory makeColumnSelectorFactory(VirtualColumns virtualColumns, AggregatorFactory agg, com.google.common.base.Supplier<InputRow> in, boolean deserializeComplexMetrics)
agg - the aggregatorin - ingestion-time input row supplierdeserializeComplexMetrics - whether complex objects should be deserialized by a ComplexMetricExtractorpublic abstract org.apache.druid.segment.incremental.IncrementalIndex.FactsHolder getFacts()
public abstract boolean canAppendRow()
public abstract String getOutOfRowsReason()
protected abstract void initAggs(AggregatorFactory[] metrics, com.google.common.base.Supplier<InputRow> rowSupplier, boolean deserializeComplexMetrics, boolean concurrentEventAdd)
protected abstract org.apache.druid.segment.incremental.IncrementalIndex.AddToFactsResult addToFacts(InputRow row, IncrementalIndexRow key, ThreadLocal<InputRow> rowContainer, com.google.common.base.Supplier<InputRow> rowSupplier, boolean skipMaxRowsInMemoryCheck) throws IndexSizeExceededException
IndexSizeExceededExceptionpublic abstract int getLastRowIndex()
protected abstract float getMetricFloatValue(int rowOffset,
int aggOffset)
protected abstract long getMetricLongValue(int rowOffset,
int aggOffset)
protected abstract Object getMetricObjectValue(int rowOffset, int aggOffset)
protected abstract double getMetricDoubleValue(int rowOffset,
int aggOffset)
protected abstract boolean isNull(int rowOffset,
int aggOffset)
public boolean isRollup()
public void close()
close in interface Closeableclose in interface AutoCloseablepublic Map<String,ColumnCapabilities> getColumnCapabilities()
@Nullable public ColumnCapabilities getColumnCapabilities(String columnName)
ColumnInspectorgetColumnCapabilities in interface ColumnInspectorcolumnName - column namepublic IncrementalIndexAddResult add(InputRow row) throws IndexSizeExceededException
Calls to add() are thread safe.
row - the row of data to addParseException is returned in IncrementalIndexAddResult.IndexSizeExceededExceptionpublic IncrementalIndexAddResult add(InputRow row, boolean skipMaxRowsInMemoryCheck) throws IndexSizeExceededException
Calls to add() are thread safe.
row - the row of data to addskipMaxRowsInMemoryCheck - whether or not to skip the check of rows exceeding the max rows limitParseException is returned in IncrementalIndexAddResult.IndexSizeExceededException - this exception is thrown once it reaches max rows limit and skipMaxRowsInMemoryCheck is set to false.@Nullable public static ParseException getCombinedParseException(InputRow row, @Nullable List<String> dimParseExceptionMessages, @Nullable List<String> aggParseExceptionMessages)
public boolean isEmpty()
public int size()
public AtomicLong getBytesInMemory()
public AggregatorFactory[] getMetricAggs()
public DimensionsSpec getDimensionsSpec()
public List<IncrementalIndex.DimensionDesc> getDimensions()
@Nullable public IncrementalIndex.DimensionDesc getDimension(String dimension)
public ColumnValueSelector<?> makeMetricColumnValueSelector(String metric, IncrementalIndexRowHolder currEntry)
public org.joda.time.Interval getInterval()
@Nullable public org.joda.time.DateTime getMinTime()
@Nullable public org.joda.time.DateTime getMaxTime()
public void loadDimensionIterable(Iterable<String> oldDimensionOrder, Map<String,ColumnCapabilities> oldColumnCapabilities)
public List<String> getColumnNames()
getColumnNames in class AbstractIndexpublic StorageAdapter toStorageAdapter()
toStorageAdapter in class AbstractIndexpublic Metadata getMetadata()
public abstract Iterable<Row> iterableWithPostAggregations(@Nullable List<PostAggregator> postAggs, boolean descending)
public org.joda.time.DateTime getMaxIngestedEventTime()
protected ColumnSelectorFactory makeColumnSelectorFactory(AggregatorFactory agg, com.google.common.base.Supplier<InputRow> in, boolean deserializeComplexMetrics)
protected final Comparator<IncrementalIndexRow> dimsComparator()
Copyright © 2011–2022 The Apache Software Foundation. All rights reserved.