Skip to main content

reference_vector

Function reference_vector 

Source
pub unsafe fn reference_vector(to: duckdb_vector, from: duckdb_vector)
Expand description

Makes to reference from’s data instead of its own.

duckdb.h: “Changes to_vector to reference from_vector. After, the vectors share ownership of the data.” No payload is copied. That ownership does not always reach the bytes: a column other than the first of a chunk from arrow::data_chunk_from_arrow (duckdb-1-5-4) points into Arrow buffers that only column 0 keeps alive.

§Safety

  • Both vectors must be valid and of the same logical type.
  • from must outlive every read of to.
  • Any VectorReader or VectorWriter built over to before this call caches the old data pointer and must not be used afterwards.