Package org.apache.druid.segment
Class StringDimensionHandler
- java.lang.Object
-
- org.apache.druid.segment.StringDimensionHandler
-
- All Implemented Interfaces:
DimensionHandler<Integer,int[],String>
public class StringDimensionHandler extends Object implements DimensionHandler<Integer,int[],String>
-
-
Constructor Summary
Constructors Constructor Description StringDimensionHandler(String dimensionName, DimensionSchema.MultiValueHandling multiValueHandling, boolean hasBitmapIndexes, boolean hasSpatialIndexes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getDimensionName()
Get the name of the column associated with this handler.DimensionSchema
getDimensionSchema(ColumnCapabilities capabilities)
Comparator<ColumnValueSelector>
getEncodedValueSelectorComparator()
Returns a comparator that knows how to compareColumnValueSelector
of the assumed dimension type, corresponding to this DimensionHandler.int
getLengthOfEncodedKeyComponent(int[] dimVals)
Given an key component representing a single set of row value(s) for this dimension as an Object, return the length of the key component after appropriate type-casting.DimensionSchema.MultiValueHandling
getMultivalueHandling()
GetDimensionSchema.MultiValueHandling
for the column associated with this handler.DimensionIndexer<Integer,int[],String>
makeIndexer(boolean useMaxMemoryEstimates)
Creates a new DimensionIndexer, a per-dimension object responsible for processing ingested rows in-memory, used by the IncrementalIndex.DimensionMergerV9
makeMerger(IndexSpec indexSpec, SegmentWriteOutMedium segmentWriteOutMedium, ColumnCapabilities capabilities, ProgressIndicator progress, Closer closer)
Creates a new DimensionMergerV9, a per-dimension object responsible for merging indexes/row data across segments and building the on-disk representation of a dimension.SettableColumnValueSelector
makeNewSettableEncodedValueSelector()
Creates and returns a new object of some implementation ofSettableColumnValueSelector
, that corresponds to the type of this DimensionHandler.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.druid.segment.DimensionHandler
getDimensionSpec
-
-
-
-
Constructor Detail
-
StringDimensionHandler
public StringDimensionHandler(String dimensionName, DimensionSchema.MultiValueHandling multiValueHandling, boolean hasBitmapIndexes, boolean hasSpatialIndexes)
-
-
Method Detail
-
getDimensionName
public String getDimensionName()
Description copied from interface:DimensionHandler
Get the name of the column associated with this handler. This string would be the output name of the column during ingestion, and the name of an input column when querying.- Specified by:
getDimensionName
in interfaceDimensionHandler<Integer,int[],String>
- Returns:
- Dimension name
-
getDimensionSchema
public DimensionSchema getDimensionSchema(ColumnCapabilities capabilities)
- Specified by:
getDimensionSchema
in interfaceDimensionHandler<Integer,int[],String>
-
getMultivalueHandling
public DimensionSchema.MultiValueHandling getMultivalueHandling()
Description copied from interface:DimensionHandler
GetDimensionSchema.MultiValueHandling
for the column associated with this handler. Only string columns can haveDimensionSchema.MultiValueHandling
currently.- Specified by:
getMultivalueHandling
in interfaceDimensionHandler<Integer,int[],String>
-
getLengthOfEncodedKeyComponent
public int getLengthOfEncodedKeyComponent(int[] dimVals)
Description copied from interface:DimensionHandler
Given an key component representing a single set of row value(s) for this dimension as an Object, return the length of the key component after appropriate type-casting. For example, a dictionary encoded String dimension would receive an int[] as input to this method, while a Long numeric dimension would receive a single Long object (no multivalue support)- Specified by:
getLengthOfEncodedKeyComponent
in interfaceDimensionHandler<Integer,int[],String>
- Parameters:
dimVals
- Values for this dimension from a row- Returns:
- Size of dimVals
-
getEncodedValueSelectorComparator
public Comparator<ColumnValueSelector> getEncodedValueSelectorComparator()
Description copied from interface:DimensionHandler
Returns a comparator that knows how to compareColumnValueSelector
of the assumed dimension type, corresponding to this DimensionHandler. E. g.StringDimensionHandler
returns a comparator, that comparesColumnValueSelector
s asDimensionSelector
s. The comparison rules used by this method should match the rules used byDimensionIndexer.compareUnsortedEncodedKeyComponents(EncodedKeyComponentType, EncodedKeyComponentType)
, otherwise incorrect ordering/merging of rows can occur during ingestion, causing issues such as imperfect rollup.- Specified by:
getEncodedValueSelectorComparator
in interfaceDimensionHandler<Integer,int[],String>
-
makeNewSettableEncodedValueSelector
public SettableColumnValueSelector makeNewSettableEncodedValueSelector()
Description copied from interface:DimensionHandler
Creates and returns a new object of some implementation ofSettableColumnValueSelector
, that corresponds to the type of this DimensionHandler. E. g.LongDimensionHandler
returnsSettableLongColumnValueSelector
, etc.- Specified by:
makeNewSettableEncodedValueSelector
in interfaceDimensionHandler<Integer,int[],String>
-
makeIndexer
public DimensionIndexer<Integer,int[],String> makeIndexer(boolean useMaxMemoryEstimates)
Description copied from interface:DimensionHandler
Creates a new DimensionIndexer, a per-dimension object responsible for processing ingested rows in-memory, used by the IncrementalIndex. SeeDimensionIndexer
interface for more information.- Specified by:
makeIndexer
in interfaceDimensionHandler<Integer,int[],String>
- Parameters:
useMaxMemoryEstimates
- true if the created DimensionIndexer should use maximum values to estimate on-heap memory- Returns:
- A new DimensionIndexer object.
-
makeMerger
public DimensionMergerV9 makeMerger(IndexSpec indexSpec, SegmentWriteOutMedium segmentWriteOutMedium, ColumnCapabilities capabilities, ProgressIndicator progress, Closer closer)
Description copied from interface:DimensionHandler
Creates a new DimensionMergerV9, a per-dimension object responsible for merging indexes/row data across segments and building the on-disk representation of a dimension. For use with IndexMergerV9 only. SeeDimensionMergerV9
interface for more information.- Specified by:
makeMerger
in interfaceDimensionHandler<Integer,int[],String>
- Parameters:
indexSpec
- Specification object for the index mergesegmentWriteOutMedium
- this SegmentWriteOutMedium object could be used internally in the created merger, if neededcapabilities
- The ColumnCapabilities of the dimension represented by this DimensionHandlerprogress
- ProgressIndicator used by the merging process- Returns:
- A new DimensionMergerV9 object.
-
-