Skip to main content

read_csv_at

Function read_csv_at 

Source
pub fn read_csv_at(path: &Path) -> Result<Value, String>
Expand description

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.

With the df feature (default for the lex toolchain) the read goes through Polars’ parallel CSV reader — same contract, ~10x less wall time on a 1M-row file (see df::read_csv_at_polars). The single-threaded arrow-rs reader below stays as the implementation for default-features = false embedders.

Path checking is the caller’s job. This function takes an already-resolved &Path; the effect-handler dispatch verifies policy.allow_fs_read before calling here.