parquet · API

parquet.stats

Column statistics, decoded from their raw bytes to typed values.

Statistics.min_value / max_value are the physical bytes of a value — four little-endian bytes for an INT32 column, the raw string for a BYTE_ARRAY one — so every consumer has to decode them against the column's physical type. TypedStats does that once and hands back Int64, Float64, String or raw bytes, which is what iceberg.mojo wants for lower_bounds / upper_bounds.

The deprecated min / max fields are used only when min_value / max_value are absent, and only for types whose old sort order was already correct (everything except signed comparisons of BYTE_ARRAY, where parquet-mr's historical order was wrong — such a column reports no bounds rather than a wrong one).

Structs

ScalarValue

struct ScalarValue

One decoded statistic, or one predicate literal.

Implements Copyable, Defaultable, Movable, Writable

Fields
kind: Int
i: Int64
u: UInt64
f: Float64
b: List[UInt8]

__init__

def __init__(out self)

of_int

def of_int(v: Int64) -> Self

of_uint

def of_uint(v: UInt64) -> Self

of_float

def of_float(v: Float64) -> Self

of_bool

def of_bool(v: Bool) -> Self

of_bytes

def of_bytes(data: Span[UInt8]) -> Self

of_string

def of_string(text: StringSpan) -> Self

as_string

def as_string(self) -> String

write_to

def write_to(self, mut writer: T)

TypedStats

struct TypedStats

One column chunk's statistics, decoded.

Implements Copyable, Defaultable, Movable

Fields
has_min_max: Bool
min: ScalarValue
max: ScalarValue
has_null_count: Bool
null_count: Int64
has_distinct_count: Bool
distinct_count: Int64

__init__

def __init__(out self)

Functions

compare_bytes

def compare_bytes(a: Span[UInt8], b: Span[UInt8]) -> Int

compare_scalars

def compare_scalars(a: ScalarValue, b: ScalarValue) -> Int

Order two scalars of the same kind. Raises on a kind mismatch.

decode_statistic

def decode_statistic(leaf: LeafColumn, raw: Span[UInt8]) -> ScalarValue

Decode one raw statistic against the leaf's physical and Arrow types.

decode_stats

def decode_stats(leaf: LeafColumn, st: Statistics) -> TypedStats

Decode a Statistics struct against one leaf column.

Aliases

comptime SV_NONE = 0
comptime SV_INT = 1
comptime SV_UINT = 2
comptime SV_FLOAT = 3
comptime SV_BYTES = 4
comptime SV_BOOL = 5