pub struct DataChunkHandle { /* private fields */ }Expand description
An owned-or-borrowed DuckDB data chunk.
A DuckDB data chunk: a batch of rows laid out column-wise, one VectorRef/
VectorMut per column.
Either owned by this handle (allocated via DataChunkHandle::new and
destroyed on drop) or borrowed from a DuckDB callback frame (via a crate-
internal constructor), in which case DuckDB owns the chunk itself and it
must not be destroyed out from under it.
This is a separate type from the crate’s internal, read-only
raw::data_chunk::DataChunk — that type’s Drop unconditionally destroys
the chunk and its next_row destroys-and-nulls on exhaustion, both of which
would double-free a chunk DuckDB owns.
Implementations§
Source§impl DataChunkHandle
impl DataChunkHandle
Sourcepub fn new(types: &[LogicalType]) -> Result<Self>
pub fn new(types: &[LogicalType]) -> Result<Self>
Allocates a new data chunk with the given column types.
§Errors
Returns an error if DuckDB fails to allocate the chunk.
Sourcepub fn vector_mut(&mut self, idx: usize) -> Result<VectorMut<'_>>
pub fn vector_mut(&mut self, idx: usize) -> Result<VectorMut<'_>>
Sourcepub fn vectors_mut(&mut self) -> Result<Vec<VectorMut<'_>>>
pub fn vectors_mut(&mut self) -> Result<Vec<VectorMut<'_>>>
Returns a writable view of every column, in column order.
The views are disjoint by construction (distinct column indices), so they may be held simultaneously despite each being individually exclusive.
§Errors
Returns an error if a column vector cannot be obtained.
Sourcepub fn num_columns(&self) -> usize
pub fn num_columns(&self) -> usize
The number of columns in this chunk.