Package org.apache.druid.segment.nested
Class ScalarNestedCommonFormatColumnSerializer<T>
java.lang.Object
org.apache.druid.segment.nested.NestedCommonFormatColumnSerializer
org.apache.druid.segment.nested.ScalarNestedCommonFormatColumnSerializer<T>
- All Implemented Interfaces:
GenericColumnSerializer<StructuredData>,Serializer
- Direct Known Subclasses:
ScalarDoubleColumnSerializer,ScalarLongColumnSerializer,ScalarStringColumnSerializer
public abstract class ScalarNestedCommonFormatColumnSerializer<T>
extends NestedCommonFormatColumnSerializer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected final Closerprotected final NestedCommonFormatColumnFormatSpecprotected ByteBufferprotected DictionaryIdLookupprotected booleanprotected DictionaryWriter<T> protected booleanprotected FixedIndexedIntWriterprotected static final Loggerprotected final Stringprotected final SegmentWriteOutMediumprotected booleanFields inherited from class org.apache.druid.segment.nested.NestedCommonFormatColumnSerializer
NESTED_FIELD_PREFIX, RAW_FILE_NAME, V0 -
Constructor Summary
ConstructorsConstructorDescriptionScalarNestedCommonFormatColumnSerializer(String name, NestedCommonFormatColumnFormatSpec columnFormatSpec, SegmentWriteOutMedium segmentWriteOutMedium, Closer closer) -
Method Summary
Modifier and TypeMethodDescriptionabstract intlongReturns 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()protected abstract voidCalled duringopen()to allow opening any separate type specific value column serializersprotected abstract intprocessValue(Object rawValue) Called duringserialize(ColumnValueSelector)to convert value to dictionary id.voidserialize(ColumnValueSelector<? extends StructuredData> selector) voidsetDictionaryIdLookup(DictionaryIdLookup dictionaryIdLookup) protected abstract voidwriteDictionaryFile(FileSmoosher smoosher) voidwriteTo(WritableByteChannel channel, FileSmoosher smoosher) Writes the serialized form of this object.protected abstract voidwriteValueColumn(FileSmoosher smoosher) Called duringwriteTo(WritableByteChannel, FileSmoosher)to allow any type specific value column serializers to use theFileSmoosherto write stuff to places.Methods inherited from class org.apache.druid.segment.nested.NestedCommonFormatColumnSerializer
computeFilenameBytes, copyFromTempSmoosh, openDictionaryWriter, serializeDictionaries, serializeFields, writeInternal, writeV0Header
-
Field Details
-
log
-
name
-
segmentWriteOutMedium
-
columnFormatSpec
-
closer
-
dictionaryIdLookup
-
dictionaryWriter
-
closedForWrite
protected boolean closedForWrite -
dictionarySerialized
protected boolean dictionarySerialized -
intermediateValueWriter
-
columnNameBytes
-
hasNulls
protected boolean hasNulls -
writeDictionary
protected boolean writeDictionary
-
-
Constructor Details
-
ScalarNestedCommonFormatColumnSerializer
public ScalarNestedCommonFormatColumnSerializer(String name, NestedCommonFormatColumnFormatSpec columnFormatSpec, SegmentWriteOutMedium segmentWriteOutMedium, Closer closer)
-
-
Method Details
-
processValue
Called duringserialize(ColumnValueSelector)to convert value to dictionary id.Implementations may optionally also serialize the value to a type specific value column if they opened one with
openValueColumnSerializer(), or do whatever else is useful to do while handling a single row value.- Throws:
IOException
-
openValueColumnSerializer
Called duringopen()to allow opening any separate type specific value column serializers- Throws:
IOException
-
writeValueColumn
Called duringwriteTo(WritableByteChannel, FileSmoosher)to allow any type specific value column serializers to use theFileSmoosherto write stuff to places.- Throws:
IOException
-
writeDictionaryFile
- Throws:
IOException
-
getCardinality
public abstract int getCardinality() -
getColumnName
- Specified by:
getColumnNamein classNestedCommonFormatColumnSerializer
-
getDictionaryIdLookup
- Specified by:
getDictionaryIdLookupin classNestedCommonFormatColumnSerializer
-
setDictionaryIdLookup
- Specified by:
setDictionaryIdLookupin classNestedCommonFormatColumnSerializer
-
hasNulls
public boolean hasNulls()- Specified by:
hasNullsin classNestedCommonFormatColumnSerializer
-
open
- Throws:
IOException
-
serialize
- Throws:
IOException
-
getSerializedSize
public long 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. -
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
-