pub unsafe fn copy_selected(
src: duckdb_vector,
dst: duckdb_vector,
sel: &SelectionVector,
src_count: usize,
src_offset: usize,
dst_offset: usize,
)Expand description
Copies the rows sel names from src into dst.
The destination stays flat, so the ordinary
VectorReader reads it correctly — which is
why this is the filtering primitive to reach for first, ahead of slice().
duckdb.h on the offsets: src_count is “the number of entries from
selection vector to copy … the effective length of the selection vector
starting from index 0”, src_offset is “the offset in the selection vector
to copy from (important: actual number of items copied = src_count -
src_offset)”, and dst_offset is where in dst to start writing. So to copy
all of sel, pass src_count = sel.len() and src_offset = 0.
§Safety
srcanddstmust be valid vectors of the same logical type.- Every index in
sel[src_offset..src_count]must be a valid row ofsrc. dstmust have room fordst_offset + (src_count - src_offset)rows.src_offset <= src_count <= sel.len().