public abstract class DictionaryEncodedColumnMerger<T extends Comparable<T>> extends Object implements DimensionMergerV9
| Modifier and Type | Class and Description |
|---|---|
static class |
DictionaryEncodedColumnMerger.ConvertingBitmapValues |
protected static interface |
DictionaryEncodedColumnMerger.IndexSeeker |
protected static class |
DictionaryEncodedColumnMerger.IndexSeekerWithConversion
Get old dictId from new dictId, and only support access in order
|
protected static class |
DictionaryEncodedColumnMerger.IndexSeekerWithoutConversion |
| Modifier and Type | Field and Description |
|---|---|
protected List<IndexableAdapter> |
adapters |
protected GenericIndexedWriter<ImmutableBitmap> |
bitmapWriter |
protected ColumnCapabilities |
capabilities |
protected int |
cardinality |
protected Closer |
closer |
protected DictionaryMergingIterator<T> |
dictionaryMergeIterator |
protected int |
dictionarySize |
protected DictionaryWriter<T> |
dictionaryWriter |
protected ArrayList<IntBuffer> |
dimConversions |
protected String |
dimensionName |
protected ColumnarIntsSerializer |
encodedValueSerializer |
protected T |
firstDictionaryValue |
protected boolean |
hasNull |
protected IndexSpec |
indexSpec |
protected MutableBitmap |
nullRowsBitmap |
protected ProgressIndicator |
progress |
protected int |
rowCount |
protected SegmentWriteOutMedium |
segmentWriteOutMedium |
| Constructor and Description |
|---|
DictionaryEncodedColumnMerger(String dimensionName,
IndexSpec indexSpec,
SegmentWriteOutMedium segmentWriteOutMedium,
ColumnCapabilities capabilities,
ProgressIndicator progress,
Closer closer) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract T |
coerceValue(T value) |
ColumnValueSelector |
convertSortedSegmentRowValuesToMergedRowValues(int segmentIndex,
ColumnValueSelector source)
Creates a value selector, which converts values with per-segment, _sorted order_ (see
DimensionIndexer.convertUnsortedValuesToSorted(org.apache.druid.segment.ColumnValueSelector)) encoding from the given selector to their equivalent
representation in the merged set of rows. |
protected abstract Comparator<Pair<Integer,com.google.common.collect.PeekingIterator<T>>> |
getDictionaryMergingComparator() |
protected org.apache.druid.segment.DictionaryEncodedColumnMerger.ExtendedIndexesMerger |
getExtendedIndexesMerger() |
protected abstract Indexed<T> |
getNullDimValue() |
protected abstract ObjectStrategy<T> |
getObjectStrategy() |
boolean |
hasOnlyNulls()
Returns true if this dimension has no data besides nulls.
|
protected DictionaryWriter<T> |
makeDictionaryWriter(String fileName) |
protected MutableBitmap |
mergeBitmaps(List<IntBuffer> segmentRowNumConversions,
BitmapFactory bmpFactory,
DictionaryEncodedColumnMerger.IndexSeeker[] dictIdSeeker,
int dictId) |
void |
processMergedRow(ColumnValueSelector selector)
Process a column value(s) (potentially multi-value) of a row from the given selector and update the
DimensionMerger's internal state.
|
protected void |
setupEncodedValueWriter() |
protected DictionaryEncodedColumnMerger.IndexSeeker[] |
toIndexSeekers(List<IndexableAdapter> adapters,
ArrayList<IntBuffer> dimConversions,
String dimension) |
protected void |
writeDictionary(Iterable<T> dictionaryValues) |
void |
writeIndexes(List<IntBuffer> segmentRowNumConversions)
Internally construct any index structures relevant to this DimensionMerger.
|
void |
writeMergedValueDictionary(List<IndexableAdapter> adapters)
Given a list of segment adapters:
- Read _sorted order_ (e.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitmakeColumnDescriptorprotected final String dimensionName
protected final ProgressIndicator progress
protected final Closer closer
protected final IndexSpec indexSpec
protected final SegmentWriteOutMedium segmentWriteOutMedium
protected final MutableBitmap nullRowsBitmap
protected final ColumnCapabilities capabilities
protected int dictionarySize
protected int rowCount
protected int cardinality
protected boolean hasNull
@Nullable protected GenericIndexedWriter<ImmutableBitmap> bitmapWriter
@Nullable protected List<IndexableAdapter> adapters
@Nullable protected DictionaryMergingIterator<T extends Comparable<T>> dictionaryMergeIterator
@Nullable protected ColumnarIntsSerializer encodedValueSerializer
@Nullable protected DictionaryWriter<T extends Comparable<T>> dictionaryWriter
@Nullable protected T extends Comparable<T> firstDictionaryValue
public DictionaryEncodedColumnMerger(String dimensionName, IndexSpec indexSpec, SegmentWriteOutMedium segmentWriteOutMedium, ColumnCapabilities capabilities, ProgressIndicator progress, Closer closer)
protected abstract Comparator<Pair<Integer,com.google.common.collect.PeekingIterator<T>>> getDictionaryMergingComparator()
protected abstract ObjectStrategy<T> getObjectStrategy()
public void writeMergedValueDictionary(List<IndexableAdapter> adapters) throws IOException
DimensionMergerIncrementalIndexAdapter.getDimValueLookup(String)) dictionary encoding information
from the adapters
- Merge those sorted order dictionary into a one big sorted order dictionary and write this merged dictionary.
The implementer should maintain knowledge of the "index number" of the adapters in the input list,
i.e., the position of each adapter in the input list.
This "index number" will be used to refer to specific segments later
in DimensionMerger.convertSortedSegmentRowValuesToMergedRowValues(int, org.apache.druid.segment.ColumnValueSelector).writeMergedValueDictionary in interface DimensionMergeradapters - List of adapters to be merged.IOExceptionDimensionIndexer.convertUnsortedValuesToSorted(org.apache.druid.segment.ColumnValueSelector)public ColumnValueSelector convertSortedSegmentRowValuesToMergedRowValues(int segmentIndex, ColumnValueSelector source)
DimensionMergerDimensionIndexer.convertUnsortedValuesToSorted(org.apache.druid.segment.ColumnValueSelector)) encoding from the given selector to their equivalent
representation in the merged set of rows.
This method is used by the index merging process to build the merged sequence of rows.
The implementing class is expected to use the merged value metadata constructed
during DimensionMerger.writeMergedValueDictionary(List), if applicable.
For example, an implementation of this function for a dictionary-encoded String column would convert the
segment-specific, sorted order dictionary values within the row to the common merged dictionary values
determined during DimensionMerger.writeMergedValueDictionary(List).convertSortedSegmentRowValuesToMergedRowValues in interface DimensionMergersegmentIndex - indicates which segment the row originated from, in the order established in
DimensionMerger.writeMergedValueDictionary(List)source - the selector from which to take values to convertpublic void processMergedRow(ColumnValueSelector selector) throws IOException
DimensionMergerprocessMergedRow in interface DimensionMergerIOExceptionpublic void writeIndexes(@Nullable List<IntBuffer> segmentRowNumConversions) throws IOException
DimensionMergerDimensionMerger.processMergedRow(org.apache.druid.segment.ColumnValueSelector) calls, the DimensionMerger
can now build any index structures it needs.
For example, a dictionary encoded String implementation would create its bitmap indexes
for the merged segment during this step.
The index merger will provide a list of row number conversion IntBuffer objects.
Each IntBuffer is associated with one of the segments being merged; the position of the IntBuffer in the list
corresponds to the position of segment adapters within the input list of DimensionMerger.writeMergedValueDictionary(List).
For example, suppose there are two segments A and B.
Row 24 from segment A maps to row 99 in the merged sequence of rows,
The IntBuffer for segment A would have a mapping of 24 -> 99.writeIndexes in interface DimensionMergersegmentRowNumConversions - A list of row number conversion IntBuffer objects.IOExceptionprotected DictionaryWriter<T> makeDictionaryWriter(String fileName)
@Nullable protected org.apache.druid.segment.DictionaryEncodedColumnMerger.ExtendedIndexesMerger getExtendedIndexesMerger()
protected void setupEncodedValueWriter()
throws IOException
IOExceptionprotected void writeDictionary(Iterable<T> dictionaryValues) throws IOException
IOExceptionprotected MutableBitmap mergeBitmaps(@Nullable List<IntBuffer> segmentRowNumConversions, BitmapFactory bmpFactory, DictionaryEncodedColumnMerger.IndexSeeker[] dictIdSeeker, int dictId) throws IOException
IOExceptionpublic boolean hasOnlyNulls()
DimensionMergerNullColumnPartSerde for how null-only columns are stored in the segment.hasOnlyNulls in interface DimensionMergerprotected DictionaryEncodedColumnMerger.IndexSeeker[] toIndexSeekers(List<IndexableAdapter> adapters, ArrayList<IntBuffer> dimConversions, String dimension)
Copyright © 2011–2023 The Apache Software Foundation. All rights reserved.