Class ComplexMetricSerde

    • Constructor Detail

      • ComplexMetricSerde

        public ComplexMetricSerde()
    • Method Detail

      • getTypeName

        public abstract String getTypeName()
      • deserializeColumn

        public void deserializeColumn​(ByteBuffer buffer,
                                      ColumnBuilder builder,
                                      ColumnConfig columnConfig)
        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 deserialize
        builder - ColumnBuilder to add the column to
        columnConfig - ColumnConfiguration used during deserialization
      • getObjectStrategy

        @Deprecated
        public abstract ObjectStrategy 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
      • inputSizeFn

        @Nullable
        public com.google.common.base.Function<Object,​Long> 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

        public byte[] toBytes​(@Nullable
                              Object val)
        Converts intermediate representation of aggregate to byte[].
        Parameters:
        val - intermediate representation of aggregate
        Returns:
        serialized intermediate representation of aggregate in byte[]
      • fromBytes

        public Object fromBytes​(byte[] data,
                                int start,
                                int numBytes)
        Converts byte[] to intermediate representation of the aggregate.
        Parameters:
        data - array
        start - offset in the byte array where to start reading
        numBytes - number of bytes to read in given array
        Returns:
        intermediate representation of the aggregate