pub unsafe fn reference_value(vector: duckdb_vector, value: &Value)Expand description
Fills vector with a single constant value.
duckdb.h: “Copies the value from value to vector.” This is how an
extension emits “the same answer for every row” without writing it row by
row, and it is what DuckDB does internally for a constant expression.
§Safety
vectormust be a valid, writable vector.value’s logical type must equal the vector’s exactly.DuckDBdoes not reinterpret a mismatched value: it sizes the buffers from the value’s type, casts the value (aborting the process when the cast throws, as for'abc'intoBIGINT), and writes data of the vector’s type into those buffers, so a narrower value type can overflow them and aNULLof the wrong type (such asValue::null_value) leaves aLISTvector without its child buffer. To fill a vector withNULL, use a typedNULLof the vector’s own type.- As with
slice(), the result is not a flat vector: do not read it back through aVectorReader.