Skip to main content

Module validity

Module validity 

Source
Expand description

Validity bitmap helpers for DuckDB NULL tracking.

DuckDB tracks NULL values using a packed validity bitmap. Each row’s validity is represented by a single bit in a u64 array. This module provides a safe wrapper that encapsulates the bit manipulation.

§Pitfall L4: ensure_validity_writable

When writing NULL values, duckdb_vector_get_validity returns NULL for a vector that has no validity mask yet (the usual state of a vector no NULL has been written to) unless duckdb_vector_ensure_validity_writable has been called first — and duckdb_validity_set_row_invalid silently ignores a NULL mask, so the NULL would be dropped. ValidityBitmap::ensure_writable wraps this requirement so it cannot be forgotten.

Structs§

ValidityBitmap
A wrapper around a DuckDB validity bitmap for reading or writing NULL flags.