Package org.apache.druid.segment.nested
Class CompressedNestedDataComplexColumn<TKeyDictionary extends Indexed<ByteBuffer>,TStringDictionary extends Indexed<ByteBuffer>>
java.lang.Object
org.apache.druid.segment.nested.NestedDataComplexColumn
org.apache.druid.segment.nested.CompressedNestedDataComplexColumn<TKeyDictionary,TStringDictionary>
- All Implemented Interfaces:
Closeable,AutoCloseable,BaseColumn,ComplexColumn,SelectableColumn,NestedColumnIndexSupplier,NestedColumnSelectorFactory,NestedColumnTypeInspector,NestedCommonFormatColumn,NestedVectorColumnSelectorFactory
- Direct Known Subclasses:
NestedDataColumnV3,NestedDataColumnV4,NestedDataColumnV5
public abstract class CompressedNestedDataComplexColumn<TKeyDictionary extends Indexed<ByteBuffer>,TStringDictionary extends Indexed<ByteBuffer>>
extends NestedDataComplexColumn
implements NestedCommonFormatColumn
Implementation of
NestedDataComplexColumn which uses a CompressedVariableSizedBlobColumn for the
'raw' StructuredData values and provides selectors for nested field columns specified by ordered lists of
NestedPathPart.
The list of available nested paths is stored in fieldsSupplier, and their associated types stored in
fieldInfo which can be accessed by the index of the field in fieldsSupplier.
In the case that the nested column has only a single field, and that field is the 'root' path, specified by
rootFieldPath, the selectors created for the complex column itself will use the 'root' path selectors
instead.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.druid.segment.nested.NestedCommonFormatColumn
NestedCommonFormatColumn.Format -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.apache.druid.segment.nested.CompressedNestedDataComplexColumn.IntTypeStrategy -
Constructor Summary
ConstructorsConstructorDescriptionCompressedNestedDataComplexColumn(String columnName, ColumnType logicalType, ColumnConfig columnConfig, CompressedVariableSizedBlobColumnSupplier compressedRawColumnSupplier, ImmutableBitmap nullValues, com.google.common.base.Supplier<TKeyDictionary> fieldsSupplier, FieldTypeInfo fieldInfo, com.google.common.base.Supplier<TStringDictionary> stringDictionary, com.google.common.base.Supplier<FixedIndexed<Long>> longDictionarySupplier, com.google.common.base.Supplier<FixedIndexed<Double>> doubleDictionarySupplier, com.google.common.base.Supplier<FrontCodedIntArrayIndexed> arrayDictionarySupplier, SegmentFileMapper fileMapper, NestedCommonFormatColumnFormatSpec formatSpec, ByteOrder byteOrder, String rootFieldPath) -
Method Summary
Modifier and TypeMethodDescription<T> TRequest an implementation of a particular interface.voidclose()Close and release any resources associated with this column.getColumnHolder(List<NestedPathPart> path) Get aBaseColumnHolderfor a nested field column to retrieve metadata, the column itself, or indexes.Make aColumnIndexSupplierfor a nested field column.abstract StringgetField(List<NestedPathPart> path) abstract StringgetFieldFileName(String fileNameBase, String field, int fieldIndex) ReducesNestedColumnTypeInspector.getFieldTypes(List)for the nested field column usingColumnType.leastRestrictiveType(ColumnType, ColumnType)getFieldTypes(List<NestedPathPart> path) Get allColumnTypefor the nested field columnintGet list of fields represented as a sequence ofNestedPathPartgetRowValue(int rowNum) Return rows in the column.booleanisNumeric(List<NestedPathPart> path) Shortcut to check if a nested field column isTypeSignature.isNumeric(), useful when broadly choosing the type of vector selector to be used when dealing with the pathmakeColumnValueSelector(List<NestedPathPart> path, ColumnSelectorFactory selectorFactory, ReadableOffset readableOffset) Create a selector for a nested path.Optionally overridden when complex column serialization is not based on default serialization based onGenericIndexedinComplexColumnSerializer.makeDimensionSelector(List<NestedPathPart> path, ExtractionFn extractionFn, ColumnSelectorFactory selectorFactory, ReadableOffset readableOffset) Create a selector for a nested path.makeSingleValueDimensionVectorSelector(List<NestedPathPart> path, VectorColumnSelectorFactory selectorFactory, ReadableVectorOffset readableOffset) Make aSingleValueDimensionVectorSelectorfor a nested field columnmakeVectorObjectSelector(List<NestedPathPart> path, VectorColumnSelectorFactory selectorFactory, ReadableVectorOffset readableOffset) Create a selector for a nested path.makeVectorValueSelector(List<NestedPathPart> path, VectorColumnSelectorFactory selectorFactory, ReadableVectorOffset readableOffset) Create a selector for a nested path.abstract List<NestedPathPart>Methods inherited from class org.apache.druid.segment.nested.NestedDataComplexColumn
getClazz, getTypeName
-
Field Details
-
INT_TYPE_STRATEGY
public static final org.apache.druid.segment.nested.CompressedNestedDataComplexColumn.IntTypeStrategy INT_TYPE_STRATEGY
-
-
Constructor Details
-
CompressedNestedDataComplexColumn
public CompressedNestedDataComplexColumn(String columnName, ColumnType logicalType, ColumnConfig columnConfig, @Nullable CompressedVariableSizedBlobColumnSupplier compressedRawColumnSupplier, ImmutableBitmap nullValues, com.google.common.base.Supplier<TKeyDictionary> fieldsSupplier, FieldTypeInfo fieldInfo, com.google.common.base.Supplier<TStringDictionary> stringDictionary, com.google.common.base.Supplier<FixedIndexed<Long>> longDictionarySupplier, com.google.common.base.Supplier<FixedIndexed<Double>> doubleDictionarySupplier, @Nullable com.google.common.base.Supplier<FrontCodedIntArrayIndexed> arrayDictionarySupplier, SegmentFileMapper fileMapper, NestedCommonFormatColumnFormatSpec formatSpec, ByteOrder byteOrder, String rootFieldPath)
-
-
Method Details
-
parsePath
-
getField
-
getFieldFileName
-
getFieldTypeInfo
- Specified by:
getFieldTypeInfoin interfaceNestedCommonFormatColumn
-
getLogicalType
- Specified by:
getLogicalTypein interfaceNestedCommonFormatColumn
-
getNestedFields
Description copied from interface:NestedColumnTypeInspectorGet list of fields represented as a sequence ofNestedPathPart- Specified by:
getNestedFieldsin interfaceNestedColumnTypeInspector
-
getUtf8BytesDictionary
-
getStringDictionary
- Specified by:
getStringDictionaryin interfaceNestedCommonFormatColumn
-
getLongDictionary
- Specified by:
getLongDictionaryin interfaceNestedCommonFormatColumn
-
getDoubleDictionary
- Specified by:
getDoubleDictionaryin interfaceNestedCommonFormatColumn
-
getArrayDictionary
- Specified by:
getArrayDictionaryin interfaceNestedCommonFormatColumn
-
getNullValues
-
getRowValue
Description copied from interface:ComplexColumnReturn rows in the column.- Specified by:
getRowValuein interfaceComplexColumn- Parameters:
rowNum- the row number- Returns:
- row object of type same as
ComplexColumn.getClazz()} at row number "rowNum" .
-
makeColumnValueSelector
Description copied from interface:ComplexColumnOptionally overridden when complex column serialization is not based on default serialization based onGenericIndexedinComplexColumnSerializer.- Specified by:
makeColumnValueSelectorin interfaceBaseColumn- Specified by:
makeColumnValueSelectorin interfaceComplexColumn- Parameters:
offset- object to retrieve row number- Returns:
- the
ColumnValueSelectorobject
-
makeVectorObjectSelector
- Specified by:
makeVectorObjectSelectorin interfaceBaseColumn- Specified by:
makeVectorObjectSelectorin interfaceComplexColumn
-
makeVectorValueSelector
- Specified by:
makeVectorValueSelectorin interfaceBaseColumn
-
getLength
public int getLength()- Specified by:
getLengthin interfaceComplexColumn- Returns:
- serialized size (in bytes) of this column. -1 for unknown
-
close
public void close()Description copied from interface:ComplexColumnClose and release any resources associated with this column.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceComplexColumn
-
makeDimensionSelector
public DimensionSelector makeDimensionSelector(List<NestedPathPart> path, ExtractionFn extractionFn, ColumnSelectorFactory selectorFactory, ReadableOffset readableOffset) Create a selector for a nested path.- Specified by:
makeDimensionSelectorin interfaceNestedColumnSelectorFactory- Parameters:
path- the pathselectorFactory- unusedreadableOffset- offset for the selectorextractionFn- extraction fn to apply in the selector
-
makeColumnValueSelector
public ColumnValueSelector<?> makeColumnValueSelector(List<NestedPathPart> path, ColumnSelectorFactory selectorFactory, ReadableOffset readableOffset) Create a selector for a nested path.- Specified by:
makeColumnValueSelectorin interfaceNestedColumnSelectorFactory- Parameters:
path- the pathselectorFactory- unusedreadableOffset- offset for the selector
-
makeSingleValueDimensionVectorSelector
public SingleValueDimensionVectorSelector makeSingleValueDimensionVectorSelector(List<NestedPathPart> path, VectorColumnSelectorFactory selectorFactory, ReadableVectorOffset readableOffset) Description copied from interface:NestedVectorColumnSelectorFactoryMake aSingleValueDimensionVectorSelectorfor a nested field column- Specified by:
makeSingleValueDimensionVectorSelectorin interfaceNestedVectorColumnSelectorFactory- Parameters:
path- nested path, or empty list to read the rootselectorFactory- factory for underlying selectors, if neededreadableOffset- offset for the selector
-
makeVectorObjectSelector
public VectorObjectSelector makeVectorObjectSelector(List<NestedPathPart> path, VectorColumnSelectorFactory selectorFactory, ReadableVectorOffset readableOffset) Create a selector for a nested path.- Specified by:
makeVectorObjectSelectorin interfaceNestedVectorColumnSelectorFactory- Parameters:
path- the pathselectorFactory- unusedreadableOffset- offset for the selector
-
makeVectorValueSelector
public VectorValueSelector makeVectorValueSelector(List<NestedPathPart> path, VectorColumnSelectorFactory selectorFactory, ReadableVectorOffset readableOffset) Create a selector for a nested path.- Specified by:
makeVectorValueSelectorin interfaceNestedVectorColumnSelectorFactory- Parameters:
path- the pathselectorFactory- unusedreadableOffset- offset for the selector
-
getFieldTypes
Description copied from interface:NestedColumnTypeInspectorGet allColumnTypefor the nested field column- Specified by:
getFieldTypesin interfaceNestedColumnTypeInspector
-
getFieldLogicalType
Description copied from interface:NestedColumnTypeInspectorReducesNestedColumnTypeInspector.getFieldTypes(List)for the nested field column usingColumnType.leastRestrictiveType(ColumnType, ColumnType)- Specified by:
getFieldLogicalTypein interfaceNestedColumnTypeInspector
-
getColumnHolder
Description copied from class:NestedDataComplexColumnGet aBaseColumnHolderfor a nested field column to retrieve metadata, the column itself, or indexes.- Specified by:
getColumnHolderin classNestedDataComplexColumn
-
getColumnIndexSupplier
Description copied from interface:NestedColumnIndexSupplierMake aColumnIndexSupplierfor a nested field column. Returns null if the field does not exist. ReturnsNoIndexesColumnIndexSupplier.getInstance()if the field exists but has no indexes.- Specified by:
getColumnIndexSupplierin interfaceNestedColumnIndexSupplier
-
isNumeric
Description copied from interface:NestedColumnTypeInspectorShortcut to check if a nested field column isTypeSignature.isNumeric(), useful when broadly choosing the type of vector selector to be used when dealing with the path- Specified by:
isNumericin interfaceNestedColumnTypeInspector
-
as
Description copied from interface:SelectableColumnRequest an implementation of a particular interface. Physical nested columns, and virtual columns that act as a nested column, should implement:-
NestedColumnTypeInspector, required. -
NestedColumnSelectorFactory, required. -
NestedVectorColumnSelectorFactory, required. -
NestedColumnIndexSupplier, if the column has indexes.
- Specified by:
asin interfaceSelectableColumn- Overrides:
asin classNestedDataComplexColumn- Type Parameters:
T- desired interface- Parameters:
clazz- desired interface- Returns:
- instance of clazz, or null if the interface is not supported by this segment
-
-