public abstract class LazyBinaryFormat<T> extends Object implements BinaryFormat
If the Binary format is used in all the SQL representations, consider the following Case: udf0(input) -> udf1(result0) -> udf2(result1) ->udf3 (result2) Such nested calls, if udf's return values are JavaObject format, will result in multiple conversions if store local variables in Binary format: converterToBinary(Udf0(converterToJavaObject(input))) -> converterToBinary(Udf1(converterToJavaObject(result0))) .....
So we introduced Lazy Binary Format to avoid this situation, Lazy Binary Format has three forms: 1. Binary form 2. JavaObject form 3. Binary and JavaObject coexist It can lazy the conversions as much as possible. Only when it is needed can it be converted into the required form.
HIGHEST_FIRST_BIT, HIGHEST_SECOND_TO_EIGHTH_BIT, MAX_FIX_PART_DATA_SIZE| Constructor and Description |
|---|
LazyBinaryFormat() |
LazyBinaryFormat(org.apache.flink.core.memory.MemorySegment[] segments,
int offset,
int sizeInBytes) |
LazyBinaryFormat(org.apache.flink.core.memory.MemorySegment[] segments,
int offset,
int sizeInBytes,
T javaObject) |
LazyBinaryFormat(T javaObject) |
LazyBinaryFormat(T javaObject,
BinarySection binarySection) |
| Modifier and Type | Method and Description |
|---|---|
void |
ensureMaterialized(org.apache.flink.api.common.typeutils.TypeSerializer<T> serializer)
Ensure we have materialized binary format.
|
T |
getJavaObject() |
int |
getOffset() |
org.apache.flink.core.memory.MemorySegment[] |
getSegments() |
int |
getSizeInBytes() |
protected abstract BinarySection |
materialize(org.apache.flink.api.common.typeutils.TypeSerializer<T> serializer)
Materialize java object to binary format.
|
void |
setJavaObject(T javaObject)
Must be public as it is used during code generation.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitreadBinaryFieldFromSegments, readBinaryStringFieldFromSegmentspublic LazyBinaryFormat()
public LazyBinaryFormat(org.apache.flink.core.memory.MemorySegment[] segments,
int offset,
int sizeInBytes,
T javaObject)
public LazyBinaryFormat(org.apache.flink.core.memory.MemorySegment[] segments,
int offset,
int sizeInBytes)
public LazyBinaryFormat(T javaObject)
public LazyBinaryFormat(T javaObject, BinarySection binarySection)
public T getJavaObject()
public void setJavaObject(T javaObject)
public org.apache.flink.core.memory.MemorySegment[] getSegments()
getSegments in interface BinaryFormatpublic int getOffset()
getOffset in interface BinaryFormatpublic int getSizeInBytes()
getSizeInBytes in interface BinaryFormatpublic final void ensureMaterialized(org.apache.flink.api.common.typeutils.TypeSerializer<T> serializer)
protected abstract BinarySection materialize(org.apache.flink.api.common.typeutils.TypeSerializer<T> serializer) throws IOException
IOExceptionCopyright © 2014–2020 The Apache Software Foundation. All rights reserved.