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
Fields Modifier and Type Field Description protected booleanclosedForWriteprotected Closercloserprotected ByteBuffercolumnNameBytesprotected DictionaryIdLookupdictionaryIdLookupprotected booleandictionarySerializedprotected DictionaryWriter<T>dictionaryWriterprotected booleanhasNullsprotected IndexSpecindexSpecprotected FixedIndexedIntWriterintermediateValueWriterprotected static Loggerlogprotected Stringnameprotected SegmentWriteOutMediumsegmentWriteOutMedium-
Fields inherited from class org.apache.druid.segment.nested.NestedCommonFormatColumnSerializer
ARRAY_DICTIONARY_FILE_NAME, ARRAY_ELEMENT_BITMAP_INDEX_FILE_NAME, ARRAY_ELEMENT_DICTIONARY_FILE_NAME, BITMAP_INDEX_FILE_NAME, DOUBLE_DICTIONARY_FILE_NAME, DOUBLE_VALUE_COLUMN_FILE_NAME, ENCODED_VALUE_COLUMN_FILE_NAME, LONG_DICTIONARY_FILE_NAME, LONG_VALUE_COLUMN_FILE_NAME, NESTED_FIELD_PREFIX, NULL_BITMAP_FILE_NAME, RAW_FILE_NAME, STRING_DICTIONARY_FILE_NAME, V0
-
-
Constructor Summary
Constructors Constructor Description ScalarNestedCommonFormatColumnSerializer(String name, IndexSpec indexSpec, SegmentWriteOutMedium segmentWriteOutMedium, Closer closer)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description StringgetColumnName()DictionaryIdLookupgetGlobalLookup()longgetSerializedSize()Returns 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 voidopenValueColumnSerializer()Called 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)protected abstract voidwriteDictionaryFile(FileSmoosher smoosher)voidwriteTo(WritableByteChannel channel, FileSmoosher smoosher)Writes serialized form of this object to the given channel.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, getInternalFileName, openDictionaryWriter, serializeDictionaries, serializeFields, writeInternal, writeInternal, writeV0Header
-
-
-
-
Field Detail
-
log
protected static final Logger log
-
name
protected final String name
-
segmentWriteOutMedium
protected final SegmentWriteOutMedium segmentWriteOutMedium
-
indexSpec
protected final IndexSpec indexSpec
-
closer
protected final Closer closer
-
dictionaryIdLookup
protected DictionaryIdLookup dictionaryIdLookup
-
dictionaryWriter
protected DictionaryWriter<T> dictionaryWriter
-
closedForWrite
protected boolean closedForWrite
-
dictionarySerialized
protected boolean dictionarySerialized
-
intermediateValueWriter
protected FixedIndexedIntWriter intermediateValueWriter
-
columnNameBytes
protected ByteBuffer columnNameBytes
-
hasNulls
protected boolean hasNulls
-
-
Constructor Detail
-
ScalarNestedCommonFormatColumnSerializer
public ScalarNestedCommonFormatColumnSerializer(String name, IndexSpec indexSpec, SegmentWriteOutMedium segmentWriteOutMedium, Closer closer)
-
-
Method Detail
-
processValue
protected abstract int processValue(@Nullable Object rawValue) throws IOException
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
protected abstract void openValueColumnSerializer() throws IOExceptionCalled duringopen()to allow opening any separate type specific value column serializers- Throws:
IOException
-
writeValueColumn
protected abstract void writeValueColumn(FileSmoosher smoosher) throws IOException
Called duringwriteTo(WritableByteChannel, FileSmoosher)to allow any type specific value column serializers to use theFileSmoosherto write stuff to places.- Throws:
IOException
-
writeDictionaryFile
protected abstract void writeDictionaryFile(FileSmoosher smoosher) throws IOException
- Throws:
IOException
-
getColumnName
public String getColumnName()
- Specified by:
getColumnNamein classNestedCommonFormatColumnSerializer
-
getGlobalLookup
public DictionaryIdLookup getGlobalLookup()
- Specified by:
getGlobalLookupin classNestedCommonFormatColumnSerializer
-
hasNulls
public boolean hasNulls()
- Specified by:
hasNullsin classNestedCommonFormatColumnSerializer
-
open
public void open() throws IOException- Throws:
IOException
-
serialize
public void serialize(ColumnValueSelector<? extends StructuredData> selector) throws IOException
- 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
public void writeTo(WritableByteChannel channel, FileSmoosher smoosher) throws IOException
Description copied from interface:SerializerWrites serialized form of this object to the given channel. If parallel data streams are needed, they could be created with the provided smoosher.- Throws:
IOException
-
-