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 byColumnProcessors.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. UnlikeColumnProcessorFactory
, this interface does not have a "defaultType" method, because vector column types are always known, so it isn't necessary.- See Also:
the non-vectorized version
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description T
makeArrayProcessor(ColumnCapabilities capabilities, VectorObjectSelector selector)
Called whenTypeSignature.getType()
is ARRAY.T
makeDoubleProcessor(ColumnCapabilities capabilities, VectorValueSelector selector)
Called whenTypeSignature.getType()
is DOUBLE.T
makeFloatProcessor(ColumnCapabilities capabilities, VectorValueSelector selector)
Called whenTypeSignature.getType()
is FLOAT.T
makeLongProcessor(ColumnCapabilities capabilities, VectorValueSelector selector)
Called whenTypeSignature.getType()
is LONG.T
makeMultiValueDimensionProcessor(ColumnCapabilities capabilities, MultiValueDimensionVectorSelector selector)
Called only ifTypeSignature.getType()
is STRING and the underlying column may have multiple values per row.T
makeObjectProcessor(ColumnCapabilities capabilities, VectorObjectSelector selector)
Called whenTypeSignature.getType()
is COMPLEX.T
makeSingleValueDimensionProcessor(ColumnCapabilities capabilities, SingleValueDimensionVectorSelector selector)
Called only ifTypeSignature.getType()
is STRING and the underlying column always has a single value per row.default boolean
useDictionaryEncodedSelector(ColumnCapabilities capabilities)
The processor factory can influence the decision on whether or not to prefer a dictionary encoded column value selector over a an object selector by examining theColumnCapabilities
.
-
-
-
Method Detail
-
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
T makeFloatProcessor(ColumnCapabilities capabilities, VectorValueSelector selector)
Called whenTypeSignature.getType()
is FLOAT.
-
makeDoubleProcessor
T makeDoubleProcessor(ColumnCapabilities capabilities, VectorValueSelector selector)
Called whenTypeSignature.getType()
is DOUBLE.
-
makeLongProcessor
T makeLongProcessor(ColumnCapabilities capabilities, VectorValueSelector selector)
Called whenTypeSignature.getType()
is LONG.
-
makeArrayProcessor
T makeArrayProcessor(ColumnCapabilities capabilities, VectorObjectSelector selector)
Called whenTypeSignature.getType()
is ARRAY.
-
makeObjectProcessor
T makeObjectProcessor(ColumnCapabilities capabilities, VectorObjectSelector selector)
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
default boolean useDictionaryEncodedSelector(ColumnCapabilities capabilities)
The processor factory can influence the decision on whether or not to prefer a dictionary encoded column value selector over a 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 useSingleValueDimensionVectorSelector
andMultiValueDimensionVectorSelector
, 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.
-
-