Requires
feature = "columnar" (also turned on by udf). The types re-export at the crate root:
better_duck_core::{DataChunkHandle, VectorRef, VectorMut, FixedWidth}.columnar feature adds a columnar read/write path alongside the
row-oriented API: pull query results as data chunks, read fixed-width
columns zero-copy, and build chunks to bulk-insert.
It is the same data-chunk machinery user-defined functions use.
Reading results as chunks
DuckResult::fetch_chunk() -> Option<Result<DataChunkHandle>> pulls the next chunk directly,
bypassing per-row DuckRow materialization. None means
the result is exhausted.
When to go columnar
Columnar
Analytical scans over fixed-width columns, where
as_slice gives a zero-copy &[T]; or
building chunks to bulk-append. Minimal per-value overhead.Row-oriented
Mixed-type rows, random column access by name, or small results. Simpler and always available.
The pieces
DataChunkHandle
An owned-or-borrowed batch of columns:
len, capacity, vector / vector_mut, set_len,
reset.Vectors
VectorRef (read) and VectorMut (write), the FixedWidth marker, and validity masks.See also
- Iterating results — the row-oriented counterpart.
- Appender advanced — appending built chunks.
- UDF overview — the same chunk/vector API inside function callbacks.