Package org.apache.druid.segment.nested
Class NestedDataColumnSerializer
java.lang.Object
org.apache.druid.segment.nested.NestedCommonFormatColumnSerializer
org.apache.druid.segment.nested.NestedDataColumnSerializer
- All Implemented Interfaces:
GenericColumnSerializer<StructuredData>,Serializer
Serializer for
NestedCommonFormatColumn which can store nested data. The serializer stores several components
including:
- a field list and associated type info
- value dictionaries for string, long, double, and array values (where the arrays are stored as int[] that point to
the string, long, and double values)
- raw data is stored with a CompressedVariableSizedBlobColumnSerializer as blobs of SMILE encoded data
- a null value bitmap to track which 'raw' rows are null
For each nested field, a GlobalDictionaryEncodedFieldColumnWriter will write a sub-column to specialize
fast reading and filtering of that path.- See Also:
-
Field Summary
Fields inherited from class org.apache.druid.segment.nested.NestedCommonFormatColumnSerializer
NESTED_FIELD_PREFIX, RAW_FILE_NAME, V0 -
Constructor Summary
ConstructorsConstructorDescriptionNestedDataColumnSerializer(String name, NestedCommonFormatColumnFormatSpec columnFormatSpec, SegmentWriteOutMedium segmentWriteOutMedium, Closer closer) -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the number of bytes, that this Serializer will write to the output _channel_ (not smoosher) on aSerializer.writeTo(java.nio.channels.WritableByteChannel, org.apache.druid.java.util.common.io.smoosh.FileSmoosher)call.booleanhasNulls()voidopen()voidopenDictionaryWriter(File segmentBaseDir) voidserialize(ColumnValueSelector<? extends StructuredData> selector) voidserialize(StructuredData data) voidserializeDictionaries(Iterable<String> strings, Iterable<Long> longs, Iterable<Double> doubles, Iterable<int[]> arrays) voidvoidsetDictionaryIdLookup(DictionaryIdLookup dictionaryIdLookup) voidsetFieldsAndOpenWriters(NestedDataColumnSerializer serializer) voidwriteTo(WritableByteChannel channel, FileSmoosher smoosher) Writes the serialized form of this object.Methods inherited from class org.apache.druid.segment.nested.NestedCommonFormatColumnSerializer
computeFilenameBytes, copyFromTempSmoosh, writeInternal, writeV0Header
-
Constructor Details
-
NestedDataColumnSerializer
public NestedDataColumnSerializer(String name, NestedCommonFormatColumnFormatSpec columnFormatSpec, SegmentWriteOutMedium segmentWriteOutMedium, Closer closer)
-
-
Method Details
-
getColumnName
- Specified by:
getColumnNamein classNestedCommonFormatColumnSerializer
-
getDictionaryIdLookup
- Specified by:
getDictionaryIdLookupin classNestedCommonFormatColumnSerializer
-
hasNulls
public boolean hasNulls()- Specified by:
hasNullsin classNestedCommonFormatColumnSerializer
-
openDictionaryWriter
- Specified by:
openDictionaryWriterin classNestedCommonFormatColumnSerializer- Throws:
IOException
-
open
- Throws:
IOException
-
serializeFields
public void serializeFields(SortedMap<String, FieldTypeInfo.MutableTypeSet> fields) throws IOException- Overrides:
serializeFieldsin classNestedCommonFormatColumnSerializer- Throws:
IOException
-
serializeDictionaries
public void serializeDictionaries(Iterable<String> strings, Iterable<Long> longs, Iterable<Double> doubles, Iterable<int[]> arrays) throws IOException - Specified by:
serializeDictionariesin classNestedCommonFormatColumnSerializer- Throws:
IOException
-
serialize
- Throws:
IOException
-
serialize
- Throws:
IOException
-
getSerializedSize
Description copied from interface:SerializerReturns the number of bytes, that this Serializer will write to the output _channel_ (not smoosher) on aSerializer.writeTo(java.nio.channels.WritableByteChannel, org.apache.druid.java.util.common.io.smoosh.FileSmoosher)call.- Throws:
IOException
-
writeTo
Description copied from interface:SerializerWrites the serialized form of this object. The entire object may be written to the provided channel, or the object may be split over the provided channel and files added to thewhere additional channels can be created viainvalid @link
{@link FileSmoosher],FileSmoosher.addWithSmooshedWriter(String, long). The latter approach is useful when the serialized form of the object is too large for a single smoosh container. At the time this javadoc was written, the max smoosh container size is limit to the maxByteBuffersize.- Throws:
IOException
-
setDictionaryIdLookup
- Specified by:
setDictionaryIdLookupin classNestedCommonFormatColumnSerializer
-
setFieldsAndOpenWriters
- Throws:
IOException
-