Package org.apache.druid.segment.serde
Class ComplexMetricSerde
java.lang.Object
org.apache.druid.segment.serde.ComplexMetricSerde
- Direct Known Subclasses:
AbstractSerializableLongObjectPairSerde,HyperUniquesSerde,NestedDataComplexTypeSerde,SerializablePairLongStringComplexMetricSerde
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeserializeColumn(ByteBuffer buffer, ColumnBuilder builder) Deprecated.voiddeserializeColumn(ByteBuffer buffer, ColumnBuilder builder, ColumnConfig columnConfig) Deserializes a ByteBuffer and adds it to the ColumnBuilder.fromBytes(byte[] data, int start, int numBytes) Converts byte[] to intermediate representation of the aggregate.abstract ComplexMetricExtractorabstract ObjectStrategyDeprecated.getSerializer(SegmentWriteOutMedium segmentWriteOutMedium, String column) Deprecated.getSerializer(SegmentWriteOutMedium segmentWriteOutMedium, String column, IndexSpec indexSpec) This method provides the ability for a ComplexMetricSerde to control its own serialization.abstract String<T extends Comparable<T>>
TypeStrategy<T> Get aTypeStrategyto assist with writing individual complex values to aByteBuffer.Returns a function that can convert the Object provided by the ComplexColumn created through deserializeColumn into a number of expected input bytes to produce that object.byte[]Converts intermediate representation of aggregate to byte[].
-
Constructor Details
-
ComplexMetricSerde
public ComplexMetricSerde()
-
-
Method Details
-
getTypeName
-
getExtractor
-
getObjectStrategy
Deprecated.This is deprecated because its usage is going to be removed from the code.It was introduced before deserializeColumn() existed. This method creates the assumption that Druid knows how to interpret the actual column representation of the data, but I would much prefer that the ComplexMetricSerde objects be in charge of creating and interpreting the whole column, which is what deserializeColumn lets them do.
- Returns:
- an ObjectStrategy as used by GenericIndexed
-
getTypeStrategy
Get aTypeStrategyto assist with writing individual complex values to aByteBuffer.- See Also:
-
inputSizeFn
Returns a function that can convert the Object provided by the ComplexColumn created through deserializeColumn into a number of expected input bytes to produce that object.This is used to approximate the size of the input data via the SegmentMetadataQuery and does not need to be overridden if you do not care about the query.
- Returns:
- A function that can compute the size of the complex object or null if you cannot/do not want to compute it
-
toBytes
Converts intermediate representation of aggregate to byte[].- Parameters:
val- intermediate representation of aggregate- Returns:
- serialized intermediate representation of aggregate in byte[]
-
fromBytes
Converts byte[] to intermediate representation of the aggregate.- Parameters:
data- arraystart- offset in the byte array where to start readingnumBytes- number of bytes to read in given array- Returns:
- intermediate representation of the aggregate
-
deserializeColumn
Deserializes a ByteBuffer and adds it to the ColumnBuilder. This method allows for the ComplexMetricSerde to implement it's own versioning scheme to allow for changes of binary format in a forward-compatible manner.- Parameters:
buffer- the buffer to deserializebuilder- ColumnBuilder to add the column tocolumnConfig- ColumnConfiguration used during deserialization
-
deserializeColumn
Deprecated.deserializeColumn(ByteBuffer, ColumnBuilder, ColumnConfig)should be used instead of this. This method is left for backward compatibility. -
getSerializer
@Nullable @Deprecated public GenericColumnSerializer getSerializer(SegmentWriteOutMedium segmentWriteOutMedium, String column) Deprecated.getSerializer(SegmentWriteOutMedium, String, IndexSpec)should be used instead of this. This method is left for backward compatibility. -
getSerializer
public GenericColumnSerializer getSerializer(SegmentWriteOutMedium segmentWriteOutMedium, String column, IndexSpec indexSpec) This method provides the ability for a ComplexMetricSerde to control its own serialization. Default implementation usesCompressedComplexColumnSerializerifIndexSpec.complexMetricCompressionis not null or uncompressed/none, orLargeColumnSupportedComplexColumnSerializerif no compression is specified.- Returns:
- an instance of
GenericColumnSerializerused for serialization.
-