Requires
feature = "columnar" (or udf). better_duck_core::DataChunkHandle.DataChunkHandle is a batch of rows laid out column-wise — one vector per
column. You get one from DuckResult::fetch_chunk
(DuckDB-owned, read-only in practice) or allocate one with new to build and
append.
Allocating and building
API
Allocate a chunk with one
LogicalType per
column. Owned — destroyed on drop.A read-only view of column
idx. Many VectorRefs may coexist.
InvalidColumnIndex out of range.A writable view of every column at once — disjoint by construction, so they may be held
together.
Current valid row count.
Mark
n valid rows. Errors if n > capacity().DuckDB’s build-time vector size — the max rows per chunk. Read it, never hardcode a limit.
Column count.
The DuckDB type id of column
idx. InvalidColumnIndex out of range.Clear to zero rows, keeping the allocation to refill and append again.
Capacity, not a constant
cap
rather than assuming any particular value, and split large writes into multiple chunks of at most
cap rows each.
See also
- Vectors — reading and writing individual columns.
- Columnar overview —
fetch_chunkand the row-vs-chunk rule. - Appender advanced —
append_chunk_handle.