Skip to main content

Module arrow

Module arrow 

Source
Expand description

std.arrow — Apache Arrow RecordBatch as a first-class Value.

This module is the runtime side of #426. Construction builtins (arrow.from_int_columns, …) take Lex List[Int] / List[Float] / List[Str] columns and pack them into a flat RecordBatch; numeric reductions (arrow.col_sum_int, arrow.col_mean, …) run as a single Rust call over the underlying buffer, bypassing the bytecode VM for the inner loop.

The only Value shape leaving this module that touches the Arrow dependency is Value::ArrowTable(Arc<RecordBatch>). Everything else is plain Lex values.

Functions§

dispatch
Dispatch an arrow.* builtin call. Returns Some(Result) if the op was recognised, None if it should fall through to other dispatch (the caller treats None as “unknown op”).
read_csv_at
Read a CSV file into an Arrow RecordBatch. Header row required; schema is inferred from the first 100 rows. All batches are concatenated into one Table — the v1 API surface returns a single materialised table, not a stream. For 1M-row inputs that’s ~50 MB in memory which is fine for the agentic workloads lex-frame targets; bigger inputs land in a streaming read_csv_iter slice later.
read_parquet_at
Read a Parquet file into an Arrow RecordBatch. Schema comes from the file metadata; all row groups are concatenated into one Table.
read_parquet_cols_at
arrow.read_parquet_cols(path, cols) — projection-pushdown variant. Only the requested columns are decoded from the file; missing column names surface as Err, not silently dropped.
write_csv_at
Write an Arrow RecordBatch to a CSV file (header row + rows). Bool → “true”/“false”; null → empty cell (arrow-csv default).
write_parquet_at
Write an Arrow RecordBatch to a Parquet file. Default writer properties (Snappy compression, default page/row-group sizes).