read_parquet_file
def read_parquet_file(path: StringSpan) -> List[UInt8] Slurp a whole file. Convenience for the CLI and the tests.
thrift.parquet_footerLocating 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))
read_parquet_filedef read_parquet_file(path: StringSpan) -> List[UInt8] Slurp a whole file. Convenience for the CLI and the tests.
footer_lengthdef footer_length(data: Span[UInt8]) -> Int The declared byte length of the serialised FileMetaData.
read_footerdef read_footer(file_bytes: Span[UInt8]) -> FileMetaData Decode the FileMetaData at the end of a whole Parquet file.
read_footer_bytesdef read_footer_bytes(metadata_bytes: Span[UInt8]) -> FileMetaData Decode a FileMetaData that has already been sliced out of a file.
write_footerdef write_footer(meta: FileMetaData) -> List[UInt8] Serialise a FileMetaData with the compact protocol.
This is the footer body only — no magic, no length trailer. Use
write_footer_trailer to append the 8-byte tail a writer needs.
write_footer_trailerdef write_footer_trailer(mut out: List[UInt8], metadata_length: Int) Append the little-endian i32 length and the trailing PAR1.
read_page_headerdef 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.
comptime PARQUET_MAGIC = "PAR1"comptime PARQUET_MAGIC_ENCRYPTED = "PARE"comptime FOOTER_TRAILER_SIZE = 8