Documentation
¶
Overview ¶
Package binaryrow decodes Paimon's compact BinaryRow binary format.
Wire format (matches Java org.apache.paimon.data.BinaryRow):
[4 bytes big-endian: arity] [null_bits_size bytes: header + per-field null flags] byte 0 = RowKind (0=INSERT,1=UPDATE_BEFORE,2=UPDATE_AFTER,3=DELETE) bits 8+: one null flag per field (bit set = null) [arity * 8 bytes: fixed-size slots] fixed types stored inline; variable-length types store pointer [variable-length data region]
String/bytes slot encoding:
inline (len <= 7): data in bytes 0–6 of slot, byte 7 = 0x80 | len heap (len > 7): int64 little-endian = (offset << 32) | length
Index ¶
- func Compare(a, b *BinaryRow, fields []schema.DataField) int
- func GetField(r *BinaryRow, i int, typeTag string) (interface{}, error)
- func NullBitsSize(arity int) int
- type BinaryRow
- func (r *BinaryRow) Arity() int
- func (r *BinaryRow) Bytes() []byte
- func (r *BinaryRow) GetBool(i int) (bool, error)
- func (r *BinaryRow) GetBytes(i int) ([]byte, error)
- func (r *BinaryRow) GetDate(i int) (time.Time, error)
- func (r *BinaryRow) GetDecimal(i int, precision, scale int) (*big.Rat, error)
- func (r *BinaryRow) GetFloat32(i int) (float32, error)
- func (r *BinaryRow) GetFloat64(i int) (float64, error)
- func (r *BinaryRow) GetInt8(i int) (int8, error)
- func (r *BinaryRow) GetInt16(i int) (int16, error)
- func (r *BinaryRow) GetInt32(i int) (int32, error)
- func (r *BinaryRow) GetInt64(i int) (int64, error)
- func (r *BinaryRow) GetString(i int) (string, error)
- func (r *BinaryRow) GetTimestampMillis(i int) (time.Time, error)
- func (r *BinaryRow) GetTimestampNanos(i int) (time.Time, error)
- func (r *BinaryRow) IsNull(i int) bool
- func (r *BinaryRow) RowKind() RowKind
- type RowKind
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Compare ¶
Compare compares two BinaryRows field-by-field using the provided key fields (which must correspond to positions 0..len(fields)-1 in each row). Returns -1, 0, or +1. Nulls sort before non-nulls.
func GetField ¶
GetField decodes field i as an interface{} based on the provided type tag. typeTag values match Paimon type names (uppercase), e.g. "INT", "BIGINT", "STRING", etc. For DECIMAL pass "DECIMAL:precision:scale" (handled by caller mapping — use typed methods directly for precision/scale control).
func NullBitsSize ¶
NullBitsSize returns the number of bytes occupied by the header + null bit-set.
Types ¶
type BinaryRow ¶
type BinaryRow struct {
// contains filtered or unexported fields
}
BinaryRow holds raw Paimon binary row bytes and decodes fields lazily.
func (*BinaryRow) Bytes ¶
Bytes returns the raw bytes of the BinaryRow (including the 4-byte arity prefix). The returned slice shares the underlying array; do not modify it.
func (*BinaryRow) GetDecimal ¶
GetDecimal decodes a DECIMAL field. Paimon stores decimals unscaled as a 16-byte big-endian two's-complement integer in the heap. For precision <= 18, it is stored inline as int64 little-endian.
func (*BinaryRow) GetFloat32 ¶
GetFloat32 decodes a FLOAT field.
func (*BinaryRow) GetFloat64 ¶
GetFloat64 decodes a DOUBLE field.
func (*BinaryRow) GetTimestampMillis ¶
GetTimestampMillis decodes a TIMESTAMP field (stored as epoch millis int64).
func (*BinaryRow) GetTimestampNanos ¶
GetTimestampNanos decodes a TIMESTAMP(p>=7) field. Paimon stores these as two int32 values: millis in the lower 4 bytes, nanos-of-millis adjustment in upper 4.