Package org.apache.druid.query.dimension
Class DefaultDimensionSpec
- java.lang.Object
-
- org.apache.druid.query.dimension.DefaultDimensionSpec
-
- All Implemented Interfaces:
Cacheable,DimensionSpec
- Direct Known Subclasses:
LegacyDimensionSpec
public class DefaultDimensionSpec extends Object implements DimensionSpec
-
-
Constructor Summary
Constructors Constructor Description DefaultDimensionSpec(String dimension, String outputName)DefaultDimensionSpec(String dimension, String outputName, ColumnType outputType)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanVectorize()Does this DimensionSpec have workingDimensionSpec.decorate(SingleValueDimensionVectorSelector)andDimensionSpec.decorate(MultiValueDimensionVectorSelector)methods?DimensionSelectordecorate(DimensionSelector selector)Decorate aDimensionSelector, allowing custom transformation of underlying behavior (e.g.MultiValueDimensionVectorSelectordecorate(MultiValueDimensionVectorSelector selector)SingleValueDimensionVectorSelectordecorate(SingleValueDimensionVectorSelector selector)Vectorized analog ofDimensionSpec.decorate(DimensionSelector)forSingleValueDimensionVectorSelector, most likely produced withVectorColumnSelectorFactory.makeSingleValueDimensionSelector(DimensionSpec)Decoration allows aDimensionSpecto customize the behavior of the underlying selector, for example transforming or filtering values.booleanequals(Object o)byte[]getCacheKey()Get a byte array used as a cache key.StringgetDimension()ExtractionFngetExtractionFn()StringgetOutputName()ColumnTypegetOutputType()inthashCode()booleanmustDecorate()Does this DimensionSpec require that decorate() be called to produce correct results?static DefaultDimensionSpecof(String dimensionName)static DefaultDimensionSpecof(String dimensionName, ColumnType columnType)booleanpreservesOrdering()If theDimensionSpec.decorate(org.apache.druid.segment.DimensionSelector)methods alter the underlying behavior of the dimension selector, does this alteration preserve the original ordering?StringtoString()DimensionSpecwithDimension(String newDimension)Returns a copy of this DimensionSpec with the underlying dimension (the value ofDimensionSpec.getDimension()) replaced by "newDimension".
-
-
-
Method Detail
-
of
public static DefaultDimensionSpec of(String dimensionName)
-
of
public static DefaultDimensionSpec of(String dimensionName, ColumnType columnType)
-
getDimension
public String getDimension()
- Specified by:
getDimensionin interfaceDimensionSpec
-
getOutputName
public String getOutputName()
- Specified by:
getOutputNamein interfaceDimensionSpec
-
getOutputType
public ColumnType getOutputType()
- Specified by:
getOutputTypein interfaceDimensionSpec
-
getExtractionFn
public ExtractionFn getExtractionFn()
- Specified by:
getExtractionFnin interfaceDimensionSpec
-
decorate
public DimensionSelector decorate(DimensionSelector selector)
Description copied from interface:DimensionSpecDecorate aDimensionSelector, allowing custom transformation of underlying behavior (e.g. performing extraction functions in the case ofExtractionDimensionSpec, regex filtering in the case ofRegexFilteredDimensionSpec, and so on).- Specified by:
decoratein interfaceDimensionSpec
-
decorate
public SingleValueDimensionVectorSelector decorate(SingleValueDimensionVectorSelector selector)
Description copied from interface:DimensionSpecVectorized analog ofDimensionSpec.decorate(DimensionSelector)forSingleValueDimensionVectorSelector, most likely produced withVectorColumnSelectorFactory.makeSingleValueDimensionSelector(DimensionSpec)Decoration allows aDimensionSpecto customize the behavior of the underlying selector, for example transforming or filtering values.- Specified by:
decoratein interfaceDimensionSpec
-
decorate
public MultiValueDimensionVectorSelector decorate(MultiValueDimensionVectorSelector selector)
Description copied from interface:DimensionSpec- Specified by:
decoratein interfaceDimensionSpec
-
canVectorize
public boolean canVectorize()
Description copied from interface:DimensionSpecDoes this DimensionSpec have workingDimensionSpec.decorate(SingleValueDimensionVectorSelector)andDimensionSpec.decorate(MultiValueDimensionVectorSelector)methods?- Specified by:
canVectorizein interfaceDimensionSpec
-
mustDecorate
public boolean mustDecorate()
Description copied from interface:DimensionSpecDoes this DimensionSpec require that decorate() be called to produce correct results?- Specified by:
mustDecoratein interfaceDimensionSpec
-
getCacheKey
public byte[] getCacheKey()
Description copied from interface:CacheableGet a byte array used as a cache key.- Specified by:
getCacheKeyin interfaceCacheable- Returns:
- a cache key
-
preservesOrdering
public boolean preservesOrdering()
Description copied from interface:DimensionSpecIf theDimensionSpec.decorate(org.apache.druid.segment.DimensionSelector)methods alter the underlying behavior of the dimension selector, does this alteration preserve the original ordering?- Specified by:
preservesOrderingin interfaceDimensionSpec
-
withDimension
public DimensionSpec withDimension(String newDimension)
Description copied from interface:DimensionSpecReturns a copy of this DimensionSpec with the underlying dimension (the value ofDimensionSpec.getDimension()) replaced by "newDimension".- Specified by:
withDimensionin interfaceDimensionSpec
-
-