Skip to main content

Module selection_vector

Module selection_vector 

Source
Expand description

Selection vectors (DuckDB 1.5.0+).

A SelectionVector is a list of row indices used to logically reorder or filter a data vector without copying its payload — the building block behind DuckDB’s zero-copy filtering. Extensions that implement custom filtering or reordering in vectorized callbacks can allocate one, fill in the indices, and hand it to the relevant DuckDB vector operations.

§Example

use quack_rs::selection_vector::SelectionVector;

// Select rows 3, 1, 4, 1, 5 (in that order) from a source vector.
let mut sel = SelectionVector::new(5)?;
sel.as_mut_slice().copy_from_slice(&[3, 1, 4, 1, 5]);
assert_eq!(sel.len(), 5);

Structs§

SelectionVector
RAII wrapper for a duckdb_selection_vector.

Constants§

MAX_LEN
The largest length SelectionVector::new accepts.