public class NestedDataColumnIndexer extends Object implements DimensionIndexer<StructuredData,StructuredData,StructuredData>
| Modifier and Type | Field and Description |
|---|---|
protected SortedMap<String,org.apache.druid.segment.NestedDataColumnIndexer.FieldIndexer> |
fieldIndexers |
protected ValueDictionary |
globalDictionary |
protected boolean |
hasNulls |
protected StructuredDataProcessor |
indexerProcessor |
| Constructor and Description |
|---|
NestedDataColumnIndexer() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
checkUnsortedEncodedKeyComponentsEqual(StructuredData lhs,
StructuredData rhs)
Check if two row value arrays from Row keys are equal.
|
int |
compareUnsortedEncodedKeyComponents(StructuredData lhs,
StructuredData rhs)
Compares the row values for this DimensionIndexer's dimension from a Row key.
|
Object |
convertUnsortedEncodedKeyComponentToActualList(StructuredData key)
Given a row value array from a Row key, as described in the documentation for
DimensionIndexer.compareUnsortedEncodedKeyComponents(EncodedKeyComponentType, EncodedKeyComponentType), convert the unsorted encoded values to a list of actual values. |
ColumnValueSelector |
convertUnsortedValuesToSorted(ColumnValueSelector selectorWithUnsortedValues)
Converts dictionary-encoded row values from unspecified (random) encoding order, to sorted encoding.
|
void |
fillBitmapsFromUnsortedEncodedKeyComponent(StructuredData key,
int rowNum,
MutableBitmap[] bitmapIndexes,
BitmapFactory factory)
Helper function for building bitmap indexes for integer-encoded dimensions.
|
int |
getCardinality()
Get the cardinality of this dimension's values.
|
ColumnCapabilities |
getColumnCapabilities() |
SortedMap<String,FieldTypeInfo.MutableTypeSet> |
getFieldTypeInfo() |
ColumnFormat |
getFormat() |
StructuredData |
getMaxValue()
Get the maximum dimension value seen by this indexer.
|
StructuredData |
getMinValue()
Get the minimum dimension value seen by this indexer.
|
CloseableIndexed<StructuredData> |
getSortedIndexedValues()
Returns an indexed structure of this dimension's sorted actual values.
|
SortedValueDictionary |
getSortedValueLookups() |
int |
getUnsortedEncodedKeyComponentHashCode(StructuredData key)
Given a row value array from a Row key, generate a hashcode.
|
StructuredData |
getUnsortedEncodedValueFromSorted(StructuredData sortedIntermediateValue)
Given an encoded value that was ordered by associated actual value, return the equivalent
encoded value ordered by time of ingestion.
|
ColumnValueSelector<?> |
makeColumnValueSelector(IncrementalIndexRowHolder currEntry,
IncrementalIndex.DimensionDesc desc)
Return an object used to read values from this indexer's column.
|
DimensionSelector |
makeDimensionSelector(DimensionSpec spec,
IncrementalIndexRowHolder currEntry,
IncrementalIndex.DimensionDesc desc)
Return an object used to read values from this indexer's column as Strings.
|
EncodedKeyComponent<StructuredData> |
processRowValsToUnsortedEncodedKeyComponent(Object dimValues,
boolean reportParseExceptions)
Encodes the given row value(s) of the dimension to be used within a row key.
|
void |
setSparseIndexed()
This method will be called while building an
IncrementalIndex whenever a known dimension column (either
through an explicit schema on the ingestion spec, or auto-discovered while processing rows) is absent in any row
that is processed, to allow an indexer to account for any missing rows if necessary. |
protected volatile boolean hasNulls
protected SortedMap<String,org.apache.druid.segment.NestedDataColumnIndexer.FieldIndexer> fieldIndexers
protected final ValueDictionary globalDictionary
protected final StructuredDataProcessor indexerProcessor
public EncodedKeyComponent<StructuredData> processRowValsToUnsortedEncodedKeyComponent(@Nullable Object dimValues, boolean reportParseExceptions)
DimensionIndexerFor example, the dictionary-encoded String-type column will return an int[] containing dictionary IDs.
processRowValsToUnsortedEncodedKeyComponent in interface DimensionIndexer<StructuredData,StructuredData,StructuredData>dimValues - Value(s) of the dimension in a row. This can
either be a single value or a list of values
(for multi-valued dimensions)reportParseExceptions - true if parse exceptions should be reported,
false otherwiseEncodedKeyComponentType and the effective
size of the key component in bytes.public void setSparseIndexed()
DimensionIndexerIncrementalIndex whenever a known dimension column (either
through an explicit schema on the ingestion spec, or auto-discovered while processing rows) is absent in any row
that is processed, to allow an indexer to account for any missing rows if necessary. Useful so that a string
DimensionSelector built on top of an IncrementalIndex may accurately report
DimensionDictionarySelector.nameLookupPossibleInAdvance() by allowing it to track if it has any implicit null valued
rows.
At index persist/merge time all missing columns for a row will be explicitly replaced with the value appropriate
null or default value.setSparseIndexed in interface DimensionIndexer<StructuredData,StructuredData,StructuredData>public StructuredData getUnsortedEncodedValueFromSorted(StructuredData sortedIntermediateValue)
DimensionIndexergetUnsortedEncodedValueFromSorted in interface DimensionIndexer<StructuredData,StructuredData,StructuredData>sortedIntermediateValue - value to convertpublic CloseableIndexed<StructuredData> getSortedIndexedValues()
DimensionIndexergetSortedIndexedValues in interface DimensionIndexer<StructuredData,StructuredData,StructuredData>public StructuredData getMinValue()
DimensionIndexergetMinValue in interface DimensionIndexer<StructuredData,StructuredData,StructuredData>public StructuredData getMaxValue()
DimensionIndexergetMaxValue in interface DimensionIndexer<StructuredData,StructuredData,StructuredData>public int getCardinality()
DimensionIndexergetCardinality in interface DimensionIndexer<StructuredData,StructuredData,StructuredData>public DimensionSelector makeDimensionSelector(DimensionSpec spec, IncrementalIndexRowHolder currEntry, IncrementalIndex.DimensionDesc desc)
DimensionIndexermakeDimensionSelector in interface DimensionIndexer<StructuredData,StructuredData,StructuredData>spec - Specifies the output name of a dimension and any extraction functions to be applied.currEntry - Provides access to the current Row object in the Cursordesc - Descriptor object for this dimension within an IncrementalIndexpublic ColumnValueSelector<?> makeColumnValueSelector(IncrementalIndexRowHolder currEntry, IncrementalIndex.DimensionDesc desc)
DimensionIndexermakeColumnValueSelector in interface DimensionIndexer<StructuredData,StructuredData,StructuredData>currEntry - Provides access to the current Row object in the Cursordesc - Descriptor object for this dimension within an IncrementalIndexpublic ColumnCapabilities getColumnCapabilities()
getColumnCapabilities in interface DimensionIndexer<StructuredData,StructuredData,StructuredData>public ColumnFormat getFormat()
getFormat in interface DimensionIndexer<StructuredData,StructuredData,StructuredData>public SortedValueDictionary getSortedValueLookups()
public SortedMap<String,FieldTypeInfo.MutableTypeSet> getFieldTypeInfo()
public int compareUnsortedEncodedKeyComponents(@Nullable StructuredData lhs, @Nullable StructuredData rhs)
DimensionIndexerDimensionHandler.getEncodedValueSelectorComparator(), otherwise incorrect ordering/merging of rows
can occur during ingestion, causing issues such as imperfect rollup.compareUnsortedEncodedKeyComponents in interface DimensionIndexer<StructuredData,StructuredData,StructuredData>lhs - dimension value array from a Row keyrhs - dimension value array from a Row keypublic boolean checkUnsortedEncodedKeyComponentsEqual(@Nullable StructuredData lhs, @Nullable StructuredData rhs)
DimensionIndexercheckUnsortedEncodedKeyComponentsEqual in interface DimensionIndexer<StructuredData,StructuredData,StructuredData>lhs - dimension value array from a Row keyrhs - dimension value array from a Row keypublic int getUnsortedEncodedKeyComponentHashCode(@Nullable StructuredData key)
DimensionIndexergetUnsortedEncodedKeyComponentHashCode in interface DimensionIndexer<StructuredData,StructuredData,StructuredData>key - dimension value array from a Row keypublic Object convertUnsortedEncodedKeyComponentToActualList(StructuredData key)
DimensionIndexerDimensionIndexer.compareUnsortedEncodedKeyComponents(EncodedKeyComponentType, EncodedKeyComponentType), convert the unsorted encoded values to a list of actual values.
If the key has one element, this method should return a single Object instead of a list.convertUnsortedEncodedKeyComponentToActualList in interface DimensionIndexer<StructuredData,StructuredData,StructuredData>key - dimension value array from a Row keypublic ColumnValueSelector convertUnsortedValuesToSorted(ColumnValueSelector selectorWithUnsortedValues)
DimensionIndexerDimensionMerger.convertSortedSegmentRowValuesToMergedRowValues(int, org.apache.druid.segment.ColumnValueSelector). The latter method requires sorted encoding
values on the input, because DimensionMerger.writeMergedValueDictionary(java.util.List<org.apache.druid.segment.IndexableAdapter>) takes sorted lookups as it's input.
For columns which do not use the DimensionMerger to merge dictionary encoded values, this method should
provide a selector which is compatible with the expectations of
DimensionMerger.processMergedRow(ColumnValueSelector), which might simply be to pass-through the 'unsorted'
selector.convertUnsortedValuesToSorted in interface DimensionIndexer<StructuredData,StructuredData,StructuredData>public void fillBitmapsFromUnsortedEncodedKeyComponent(StructuredData key, int rowNum, MutableBitmap[] bitmapIndexes, BitmapFactory factory)
DimensionIndexerfillBitmapsFromUnsortedEncodedKeyComponent in interface DimensionIndexer<StructuredData,StructuredData,StructuredData>key - dimension value array from a Row keyrowNum - current row numberbitmapIndexes - array of bitmaps, indexed by integer dimension valuefactory - bitmap factoryCopyright © 2011–2023 The Apache Software Foundation. All rights reserved.