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 StringgetDimensionName()Get the name of the column associated with this handler.DimensionSchemagetDimensionSchema(ColumnCapabilities capabilities)Comparator<ColumnValueSelector>getEncodedValueSelectorComparator()Returns a comparator that knows how to compareColumnValueSelectorof the assumed dimension type, corresponding to this DimensionHandler.intgetLengthOfEncodedKeyComponent(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.MultiValueHandlinggetMultivalueHandling()GetDimensionSchema.MultiValueHandlingfor 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.DimensionMergerV9makeMerger(String outputName, IndexSpec indexSpec, SegmentWriteOutMedium segmentWriteOutMedium, ColumnCapabilities capabilities, ProgressIndicator progress, File segmentBaseDir, 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.SettableColumnValueSelectormakeNewSettableEncodedValueSelector()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, makeMerger
-
-
-
-
Constructor Detail
-
StringDimensionHandler
public StringDimensionHandler(String dimensionName, DimensionSchema.MultiValueHandling multiValueHandling, boolean hasBitmapIndexes, boolean hasSpatialIndexes)
-
-
Method Detail
-
getDimensionName
public String getDimensionName()
Description copied from interface:DimensionHandlerGet 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:
getDimensionNamein interfaceDimensionHandler<Integer,int[],String>- Returns:
- Dimension name
-
getDimensionSchema
public DimensionSchema getDimensionSchema(ColumnCapabilities capabilities)
- Specified by:
getDimensionSchemain interfaceDimensionHandler<Integer,int[],String>
-
getMultivalueHandling
public DimensionSchema.MultiValueHandling getMultivalueHandling()
Description copied from interface:DimensionHandlerGetDimensionSchema.MultiValueHandlingfor the column associated with this handler. Only string columns can haveDimensionSchema.MultiValueHandlingcurrently.- Specified by:
getMultivalueHandlingin interfaceDimensionHandler<Integer,int[],String>
-
getLengthOfEncodedKeyComponent
public int getLengthOfEncodedKeyComponent(int[] dimVals)
Description copied from interface:DimensionHandlerGiven 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:
getLengthOfEncodedKeyComponentin 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:DimensionHandlerReturns a comparator that knows how to compareColumnValueSelectorof the assumed dimension type, corresponding to this DimensionHandler. E. g.StringDimensionHandlerreturns a comparator, that comparesColumnValueSelectors asDimensionSelectors. 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:
getEncodedValueSelectorComparatorin interfaceDimensionHandler<Integer,int[],String>
-
makeNewSettableEncodedValueSelector
public SettableColumnValueSelector makeNewSettableEncodedValueSelector()
Description copied from interface:DimensionHandlerCreates and returns a new object of some implementation ofSettableColumnValueSelector, that corresponds to the type of this DimensionHandler. E. g.LongDimensionHandlerreturnsSettableLongColumnValueSelector, etc.- Specified by:
makeNewSettableEncodedValueSelectorin interfaceDimensionHandler<Integer,int[],String>
-
makeIndexer
public DimensionIndexer<Integer,int[],String> makeIndexer(boolean useMaxMemoryEstimates)
Description copied from interface:DimensionHandlerCreates a new DimensionIndexer, a per-dimension object responsible for processing ingested rows in-memory, used by the IncrementalIndex. SeeDimensionIndexerinterface for more information.- Specified by:
makeIndexerin 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(String outputName, IndexSpec indexSpec, SegmentWriteOutMedium segmentWriteOutMedium, ColumnCapabilities capabilities, ProgressIndicator progress, File segmentBaseDir, Closer closer)
Description copied from interface:DimensionHandlerCreates 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. SeeDimensionMergerV9interface for more information.- Specified by:
makeMergerin interfaceDimensionHandler<Integer,int[],String>- Parameters:
outputName- Output "file" name for the column to use for serializers, to control where it is stored in the segments internal filesindexSpec- 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 processsegmentBaseDir- segment write out path; temporary files may be created here, though should delete after merge is finished OR be registered with the Closer parametercloser- Closer tied to segment completion. Anything which is not cleaned up inside of the merger after merge is complete should be registered with this closer. For example, resources which are required for final serialization of the column- Returns:
- A new DimensionMergerV9 object.
-
-