thrift · API

thrift.parquet_footer

Locating and decoding the Parquet footer and page headers.

A Parquet file is PAR1 <data...> <thrift FileMetaData> <i32 length> PAR1, where the length is little-endian and covers just the serialised metadata. Page headers are the same compact-protocol encoding, written inline in the data area with no length prefix — the decoder tells you how many bytes it consumed so you can find the page body that follows.

from thrift import read_footer, read_parquet_file

var bytes = read_parquet_file("part-0.parquet")
var meta = read_footer(Span(bytes))
print(meta.num_rows, len(meta.row_groups))

Functions

read_parquet_file

def read_parquet_file(path: StringSpan) -> List[UInt8]

Slurp a whole file. Convenience for the CLI and the tests.

read_page_header

def read_page_header(data: Span[UInt8], offset: Int) -> Tuple[PageHeader, Int]

Decode one page header at offset, and say how long it was.

The second element is the header's byte length, so the page body starts at offset + header_len and runs for compressed_page_size bytes.

Aliases

comptime PARQUET_MAGIC = "PAR1"
comptime PARQUET_MAGIC_ENCRYPTED = "PARE"