Class BinaryRawValueData<T>

java.lang.Object
org.apache.flink.table.data.binary.LazyBinaryFormat<T>
org.apache.flink.table.data.binary.BinaryRawValueData<T>
Type Parameters:
T - the java type of the raw value.
All Implemented Interfaces:
BinaryFormat, RawValueData<T>

@Internal public final class BinaryRawValueData<T> extends LazyBinaryFormat<T> implements RawValueData<T>
A lazily binary implementation of RawValueData which is backed by MemorySegments and generic Object.

Either MemorySegments or Object must be provided when constructing BinaryRawValueData. The other representation will be materialized when needed.

  • Constructor Details

    • BinaryRawValueData

      public BinaryRawValueData(T javaObject)
    • BinaryRawValueData

      public BinaryRawValueData(org.apache.flink.core.memory.MemorySegment[] segments, int offset, int sizeInBytes)
    • BinaryRawValueData

      public BinaryRawValueData(org.apache.flink.core.memory.MemorySegment[] segments, int offset, int sizeInBytes, T javaObject)
  • Method Details

    • toObject

      public T toObject(org.apache.flink.api.common.typeutils.TypeSerializer<T> serializer)
      Description copied from interface: RawValueData
      Converts this RawValueData into a Java object.

      The given serializer is required because the "raw value" might be represented in a binary format and needs to be deserialized first.

      Note: The returned Java object may be reused.

      Specified by:
      toObject in interface RawValueData<T>
    • toBytes

      public byte[] toBytes(org.apache.flink.api.common.typeutils.TypeSerializer<T> serializer)
      Description copied from interface: RawValueData
      Converts this RawValueData into a byte array.

      The given serializer is required because the "raw value" might be still be a Java object and needs to be serialized first.

      Note: The returned byte array may be reused.

      Specified by:
      toBytes in interface RawValueData<T>
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • materialize

      protected BinarySection materialize(org.apache.flink.api.common.typeutils.TypeSerializer<T> serializer)
      Description copied from class: LazyBinaryFormat
      Materialize java object to binary format. Inherited classes need to hold the information they need. (For example, RawValueData needs javaObjectSerializer).
      Specified by:
      materialize in class LazyBinaryFormat<T>
    • fromObject

      public static <T> BinaryRawValueData<T> fromObject(T javaObject)
      Creates a BinaryRawValueData instance from the given Java object.
    • fromBytes

      public static <T> BinaryRawValueData<T> fromBytes(byte[] bytes)
      Creates a BinaryStringData instance from the given bytes.
    • fromBytes

      public static <T> BinaryRawValueData<T> fromBytes(byte[] bytes, int offset, int numBytes)
      Creates a BinaryStringData instance from the given bytes with offset and number of bytes.