Package org.apache.druid.segment.nested
Class GlobalDictionaryEncodedFieldColumnWriter<T>
java.lang.Object
org.apache.druid.segment.nested.GlobalDictionaryEncodedFieldColumnWriter<T>
- Direct Known Subclasses:
ScalarDoubleFieldColumnWriter,ScalarLongFieldColumnWriter,ScalarStringFieldColumnWriter,VariantArrayFieldColumnWriter,VariantFieldColumnWriter
Base class for writer of global dictionary encoded nested field columns for
NestedDataColumnSerializer.
Nested columns are written in multiple passes. The first pass processes the 'raw' nested data with a
StructuredDataProcessor which will call addValue(int, Object) for writers of each field which is
present. For this type of writer, this entails building a local dictionary (localDictionary) to map into
the global dictionary (globalDictionaryIdLookup) and writes this unsorted localId to an intermediate
integer column, intermediateValueWriter.
When processing the 'raw' value column is complete, the writeTo(int, FileSmoosher) method will sort the
local ids and write them out to a local sorted dictionary, iterate over intermediateValueWriter swapping
the unsorted local ids with the sorted ids and writing to the compressed id column writer
encodedValueSerializer, building the bitmap indexes along the way.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final it.unimi.dsi.fastutil.ints.Int2ObjectRBTreeMap<MutableBitmap> protected final NestedCommonFormatColumnFormatSpecprotected final Stringprotected intprotected SingleValueColumnarIntsSerializerprotected final Stringprotected final Closerprotected intprotected final DictionaryIdLookupprotected FixedIndexedIntWriterprotected final LocalDimensionDictionaryprotected final SegmentWriteOutMediumprotected DictionaryEncodedColumnPartSerde.VERSION -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedGlobalDictionaryEncodedFieldColumnWriter(String columnName, String fieldName, SegmentWriteOutMedium segmentWriteOutMedium, NestedCommonFormatColumnFormatSpec columnFormatSpec, DictionaryIdLookup globalDictionaryIdLookup) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a value to the unsorted local dictionary and write to an intermediate columnvoidopen()Open the writer so thataddValue(int, Object)can be calledvoidopenColumnSerializer(SegmentWriteOutMedium medium, int maxId) voidwriteLongAndDoubleColumnLength(WritableByteChannel channel, int longLength, int doubleLength) voidwriteTo(int finalRowCount, FileSmoosher smoosher)
-
Field Details
-
segmentWriteOutMedium
-
columnName
-
fieldName
-
columnFormatSpec
-
globalDictionaryIdLookup
-
localDictionary
-
arrayElements
-
fieldResourceCloser
-
intermediateValueWriter
-
flags
protected int flags -
version
-
encodedValueSerializer
-
cursorPosition
protected int cursorPosition
-
-
Constructor Details
-
GlobalDictionaryEncodedFieldColumnWriter
protected GlobalDictionaryEncodedFieldColumnWriter(String columnName, String fieldName, SegmentWriteOutMedium segmentWriteOutMedium, NestedCommonFormatColumnFormatSpec columnFormatSpec, DictionaryIdLookup globalDictionaryIdLookup)
-
-
Method Details
-
open
Open the writer so thataddValue(int, Object)can be called- Throws:
IOException
-
addValue
Add a value to the unsorted local dictionary and write to an intermediate column- Throws:
IOException
-
writeTo
- Throws:
IOException
-
openColumnSerializer
- Throws:
IOException
-
writeLongAndDoubleColumnLength
public void writeLongAndDoubleColumnLength(WritableByteChannel channel, int longLength, int doubleLength) throws IOException - Throws:
IOException
-