Module row_serialization

Module row_serialization 

Source
Expand description

Row serialization for disk spilling

This module provides compact binary serialization for rows and sort keys, optimized for external sort and aggregate operations.

§Format

Each row is serialized as:

[num_values: u16] [value1] [value2] ... [valueN]

Each value is serialized as:

[type_tag: u8] [data...]

§Design Decisions

  • No length prefix for entire row: We write rows sequentially and read them back in chunks, so we don’t need random access within a run.
  • Compact type tags: Single byte discriminant for common types
  • Little-endian: Matches most modern hardware for zero-copy potential

Functions§

deserialize_row
Deserialize a row from the reader
deserialize_row_with_keys
Deserialize a row with its sort keys
deserialize_value
Deserialize a single SqlValue from the reader
estimate_serialized_size
Estimate the serialized size of a row in bytes
serialize_row
Serialize a row to the writer
serialize_row_with_keys
Serialize a row with its sort keys
serialize_value
Serialize a single SqlValue to the writer