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 ofRawValueDatawhich is backed byMemorySegments and genericObject.Either
MemorySegments orObjectmust be provided when constructingBinaryRawValueData. The other representation will be materialized when needed.
-
-
Field Summary
-
Fields inherited from interface org.apache.flink.table.data.binary.BinaryFormat
HIGHEST_FIRST_BIT, HIGHEST_SECOND_TO_EIGHTH_BIT, MAX_FIX_PART_DATA_SIZE
-
-
Constructor Summary
Constructors Constructor Description BinaryRawValueData(org.apache.flink.core.memory.MemorySegment[] segments, int offset, int sizeInBytes)BinaryRawValueData(org.apache.flink.core.memory.MemorySegment[] segments, int offset, int sizeInBytes, T javaObject)BinaryRawValueData(T javaObject)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)static <T> BinaryRawValueData<T>fromBytes(byte[] bytes)Creates aBinaryStringDatainstance from the given bytes.static <T> BinaryRawValueData<T>fromBytes(byte[] bytes, int offset, int numBytes)Creates aBinaryStringDatainstance from the given bytes with offset and number of bytes.static <T> BinaryRawValueData<T>fromObject(T javaObject)Creates aBinaryRawValueDatainstance from the given Java object.inthashCode()protected BinarySectionmaterialize(org.apache.flink.api.common.typeutils.TypeSerializer<T> serializer)Materialize java object to binary format.byte[]toBytes(org.apache.flink.api.common.typeutils.TypeSerializer<T> serializer)Converts thisRawValueDatainto a byte array.TtoObject(org.apache.flink.api.common.typeutils.TypeSerializer<T> serializer)Converts thisRawValueDatainto a Java object.StringtoString()-
Methods inherited from class org.apache.flink.table.data.binary.LazyBinaryFormat
ensureMaterialized, getBinarySection, getJavaObject, getOffset, getSegments, getSizeInBytes, setJavaObject
-
-
-
-
Constructor Detail
-
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 Detail
-
toObject
public T toObject(org.apache.flink.api.common.typeutils.TypeSerializer<T> serializer)
Description copied from interface:RawValueDataConverts thisRawValueDatainto 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:
toObjectin interfaceRawValueData<T>
-
toBytes
public byte[] toBytes(org.apache.flink.api.common.typeutils.TypeSerializer<T> serializer)
Description copied from interface:RawValueDataConverts thisRawValueDatainto 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:
toBytesin interfaceRawValueData<T>
-
materialize
protected BinarySection materialize(org.apache.flink.api.common.typeutils.TypeSerializer<T> serializer)
Description copied from class:LazyBinaryFormatMaterialize java object to binary format. Inherited classes need to hold the information they need. (For example,RawValueDataneeds javaObjectSerializer).- Specified by:
materializein classLazyBinaryFormat<T>
-
fromObject
public static <T> BinaryRawValueData<T> fromObject(T javaObject)
Creates aBinaryRawValueDatainstance from the given Java object.
-
fromBytes
public static <T> BinaryRawValueData<T> fromBytes(byte[] bytes)
Creates aBinaryStringDatainstance from the given bytes.
-
fromBytes
public static <T> BinaryRawValueData<T> fromBytes(byte[] bytes, int offset, int numBytes)
Creates aBinaryStringDatainstance from the given bytes with offset and number of bytes.
-
-