Package org.apache.druid.segment
Interface VectorColumnProcessorFactory<T>
- All Known Implementing Classes:
CardinalityVectorProcessorFactory,GroupByVectorColumnProcessorFactory,VectorValueMatcherColumnProcessorFactory
public interface VectorColumnProcessorFactory<T>
Class that encapsulates knowledge about how to create vector column processors. Used by
ColumnProcessors.makeVectorProcessor(java.lang.String, org.apache.druid.segment.VectorColumnProcessorFactory<T>, org.apache.druid.segment.vector.VectorColumnSelectorFactory).
Column processors can be any type "T". The idea is that a ColumnProcessorFactory embodies the logic for wrapping
and processing selectors of various types, and so enables nice code design, where type-dependent code is not
sprinkled throughout.
Unlike ColumnProcessorFactory, this interface does not have a "defaultType" method, because vector
column types are always known, so it isn't necessary.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionmakeArrayProcessor(ColumnCapabilities capabilities, VectorObjectSelector selector) Called whenTypeSignature.getType()is ARRAY.makeDoubleProcessor(ColumnCapabilities capabilities, VectorValueSelector selector) Called whenTypeSignature.getType()is DOUBLE.makeFloatProcessor(ColumnCapabilities capabilities, VectorValueSelector selector) Called whenTypeSignature.getType()is FLOAT.makeLongProcessor(ColumnCapabilities capabilities, VectorValueSelector selector) Called whenTypeSignature.getType()is LONG.makeMultiValueDimensionProcessor(ColumnCapabilities capabilities, MultiValueDimensionVectorSelector selector) Called only ifTypeSignature.getType()is STRING and the underlying column may have multiple values per row.makeObjectProcessor(ColumnCapabilities capabilities, VectorObjectSelector selector) Called whenTypeSignature.getType()is COMPLEX.makeSingleValueDimensionProcessor(ColumnCapabilities capabilities, SingleValueDimensionVectorSelector selector) Called only ifTypeSignature.getType()is STRING and the underlying column always has a single value per row.default booleanuseDictionaryEncodedSelector(ColumnCapabilities capabilities) The processor factory can influence the decision on whether to prefer a dictionary encoded column value selector over an object selector by examining theColumnCapabilities.
-
Method Details
-
makeSingleValueDimensionProcessor
T makeSingleValueDimensionProcessor(ColumnCapabilities capabilities, SingleValueDimensionVectorSelector selector) Called only ifTypeSignature.getType()is STRING and the underlying column always has a single value per row. Note that for STRING-typed columns where the dictionary does not exist or is not expected to be useful,makeObjectProcessor(org.apache.druid.segment.column.ColumnCapabilities, org.apache.druid.segment.vector.VectorObjectSelector)may be called instead. To handle all string inputs properly, processors must implement all three methods (single-value, multi-value, object). -
makeMultiValueDimensionProcessor
T makeMultiValueDimensionProcessor(ColumnCapabilities capabilities, MultiValueDimensionVectorSelector selector) Called only ifTypeSignature.getType()is STRING and the underlying column may have multiple values per row. Note that for STRING-typed columns where the dictionary does not exist or is not expected to be useful,makeObjectProcessor(org.apache.druid.segment.column.ColumnCapabilities, org.apache.druid.segment.vector.VectorObjectSelector)may be called instead. To handle all string inputs properly, processors must implement all three methods (single-value, multi-value, object). -
makeFloatProcessor
Called whenTypeSignature.getType()is FLOAT. -
makeDoubleProcessor
Called whenTypeSignature.getType()is DOUBLE. -
makeLongProcessor
Called whenTypeSignature.getType()is LONG. -
makeArrayProcessor
Called whenTypeSignature.getType()is ARRAY. -
makeObjectProcessor
Called whenTypeSignature.getType()is COMPLEX. May also be called for STRING typed columns in cases where the dictionary does not exist or is not expected to be useful. -
useDictionaryEncodedSelector
The processor factory can influence the decision on whether to prefer a dictionary encoded column value selector over an object selector by examining theColumnCapabilities. By default, all processor factories prefer to use a dictionary encoded selector if the column has a dictionary available (ColumnCapabilities.isDictionaryEncoded()is true), and there is a unique mapping of dictionary id to value (ColumnCapabilities.areDictionaryValuesUnique()is true), but this can be overridden if there is more appropriate behavior for a given processor. For processors, this means by default only actual dictionary encoded string columns (likely from real segments) will useSingleValueDimensionVectorSelectorandMultiValueDimensionVectorSelector, while processors on things like string expression virtual columns will prefer to useVectorObjectSelector. In other words, it is geared towards use cases where there is a clear opportunity to benefit to deferring having to deal with the actual string value in exchange for the increased complexity of dealing with dictionary encoded selectors.
-