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(MemorySegment[] segments,
int offset,
int sizeInBytes) |
LazyBinaryFormat(MemorySegment[] segments,
int offset,
int sizeInBytes,
T javaObject) |
LazyBinaryFormat(T javaObject) |
LazyBinaryFormat(T javaObject,
BinarySection binarySection) |
Modifier and Type | Method and Description |
---|---|
void |
ensureMaterialized(TypeSerializer<T> serializer)
Ensure we have materialized binary format.
|
T |
getJavaObject() |
int |
getOffset() |
MemorySegment[] |
getSegments() |
int |
getSizeInBytes() |
protected abstract BinarySection |
materialize(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, wait
readBinaryFieldFromSegments, readBinaryStringFieldFromSegments
public LazyBinaryFormat()
public LazyBinaryFormat(MemorySegment[] segments, int offset, int sizeInBytes, T javaObject)
public LazyBinaryFormat(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 MemorySegment[] getSegments()
getSegments
in interface BinaryFormat
public int getOffset()
getOffset
in interface BinaryFormat
public int getSizeInBytes()
getSizeInBytes
in interface BinaryFormat
public final void ensureMaterialized(TypeSerializer<T> serializer)
protected abstract BinarySection materialize(TypeSerializer<T> serializer) throws IOException
IOException
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.