@Internal public final class BinaryRecordData extends BinarySection implements RecordData, NullAwareGetters
RecordData which is backed by MemorySegment instead of
Object. It can significantly reduce the serialization/deserialization of Java objects.
A BinaryRecordData has two part: Fixed-length part and variable-length part.
Fixed-length part contains 1 byte header and null bit set and field values. Null bit set is used for null tracking and is aligned to 8-byte word boundaries. `Field values` holds fixed-length primitive types and variable-length values which can be stored in 8 bytes inside. If it do not fit the variable-length field, then store the length and offset of variable-length part.
Fixed-length part will certainly fall into a MemorySegment, which will speed up the read and write of field. During the write phase, if the target memory segment has less space than fixed length part size, we will skip the space. So the number of fields in a single Row cannot exceed the capacity of a single MemorySegment, if there are too many fields, we suggest that user set a bigger pageSize of MemorySegment.
Variable-length part may fall into multiple MemorySegments.
RecordData.FieldGetter| 限定符和类型 | 字段和说明 |
|---|---|
static int |
HEADER_SIZE_IN_BITS |
static boolean |
LITTLE_ENDIAN |
static String |
TIMESTAMP_DELIMITER |
offset, segments, sizeInBytesHIGHEST_FIRST_BIT, HIGHEST_SECOND_TO_EIGHTH_BIT, MAX_FIX_PART_DATA_SIZE| 构造器和说明 |
|---|
BinaryRecordData(int arity) |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
anyNull()
The bit is 1 when the field is null.
|
boolean |
anyNull(int[] fields)
For the input fields, if no field is null, return false.
|
static int |
calculateBitSetWidthInBytes(int arity) |
void |
clear() |
BinaryRecordData |
copy() |
BinaryRecordData |
copy(BinaryRecordData reuse) |
boolean |
equals(Object o) |
int |
getArity()
Returns the number of fields in this record.
|
ArrayData |
getArray(int pos)
Returns the array value at the given position.
|
byte[] |
getBinary(int pos)
Returns the binary value at the given position.
|
boolean |
getBoolean(int pos)
Returns the boolean value at the given position.
|
byte |
getByte(int pos)
Returns the byte value at the given position.
|
DecimalData |
getDecimal(int pos,
int precision,
int scale)
Returns the decimal value at the given position.
|
double |
getDouble(int pos)
Returns the double value at the given position.
|
int |
getFixedLengthPartSize() |
float |
getFloat(int pos)
Returns the float value at the given position.
|
int |
getInt(int pos)
Returns the integer value at the given position.
|
LocalZonedTimestampData |
getLocalZonedTimestampData(int pos,
int precision)
Returns the local zoned timestamp value at the given position.
|
long |
getLong(int pos)
Returns the long value at the given position.
|
MapData |
getMap(int pos)
Returns the map value at the given position.
|
RecordData |
getRow(int pos,
int numFields)
Returns the row value at the given position.
|
short |
getShort(int pos)
Returns the short value at the given position.
|
StringData |
getString(int pos)
Returns the string value at the given position.
|
TimestampData |
getTimestamp(int pos,
int precision)
Returns the timestamp value at the given position.
|
ZonedTimestampData |
getZonedTimestamp(int pos,
int precision)
Returns the zoned timestamp value at the given position.
|
int |
hashCode() |
boolean |
isNullAt(int pos)
Returns true if the field is null at the given position.
|
void |
setTotalSize(int sizeInBytes) |
getOffset, getSegments, getSizeInBytes, pointTo, pointTocreateFieldGetterpublic static final boolean LITTLE_ENDIAN
public static final int HEADER_SIZE_IN_BITS
public static int calculateBitSetWidthInBytes(int arity)
public int getFixedLengthPartSize()
public int getArity()
RecordDatagetArity 在接口中 RecordDatapublic boolean isNullAt(int pos)
RecordDataisNullAt 在接口中 RecordDatapublic boolean getBoolean(int pos)
RecordDatagetBoolean 在接口中 RecordDatapublic byte getByte(int pos)
RecordDatagetByte 在接口中 RecordDatapublic short getShort(int pos)
RecordDatagetShort 在接口中 RecordDatapublic int getInt(int pos)
RecordDatagetInt 在接口中 RecordDatapublic long getLong(int pos)
RecordDatagetLong 在接口中 RecordDatapublic float getFloat(int pos)
RecordDatagetFloat 在接口中 RecordDatapublic double getDouble(int pos)
RecordDatagetDouble 在接口中 RecordDatapublic StringData getString(int pos)
RecordDatagetString 在接口中 RecordDatapublic DecimalData getDecimal(int pos, int precision, int scale)
RecordDataThe precision and scale are required to determine whether the decimal value was stored in
a compact representation (see DecimalData).
getDecimal 在接口中 RecordDatapublic TimestampData getTimestamp(int pos, int precision)
RecordDataThe precision is required to determine whether the timestamp value was stored in a compact
representation (see TimestampData).
getTimestamp 在接口中 RecordDatapublic ZonedTimestampData getZonedTimestamp(int pos, int precision)
RecordDataThe precision is required to determine whether the zoned timestamp value was stored in a
compact representation (see ZonedTimestampData).
getZonedTimestamp 在接口中 RecordDatapublic LocalZonedTimestampData getLocalZonedTimestampData(int pos, int precision)
RecordDataThe precision is required to determine whether the local zoned timestamp value was stored
in a compact representation (see LocalZonedTimestampData).
getLocalZonedTimestampData 在接口中 RecordDatapublic byte[] getBinary(int pos)
RecordDatagetBinary 在接口中 RecordDatapublic ArrayData getArray(int pos)
RecordDatagetArray 在接口中 RecordDatapublic MapData getMap(int pos)
RecordDatagetMap 在接口中 RecordDatapublic RecordData getRow(int pos, int numFields)
RecordDataThe number of fields is required to correctly extract the record.
getRow 在接口中 RecordDatapublic boolean anyNull()
anyNull 在接口中 NullAwareGetterspublic boolean anyNull(int[] fields)
NullAwareGettersanyNull 在接口中 NullAwareGetterspublic BinaryRecordData copy()
public BinaryRecordData copy(BinaryRecordData reuse)
public void clear()
public boolean equals(Object o)
equals 在类中 BinarySectionpublic int hashCode()
hashCode 在类中 BinarySectionpublic void setTotalSize(int sizeInBytes)
Copyright © 2025 The Apache Software Foundation. All rights reserved.