Function libduckdb_sys::duckdb_vector_get_validity
source · [−]pub unsafe extern "C" fn duckdb_vector_get_validity(
vector: duckdb_vector
) -> *mut u64
Expand description
Retrieves the validity mask pointer of the specified vector.
If all values are valid, this function MIGHT return NULL!
The validity mask is a bitset that signifies null-ness within the data chunk. It is a series of uint64_t values, where each uint64_t value contains validity for 64 tuples. The bit is set to 1 if the value is valid (i.e. not NULL) or 0 if the value is invalid (i.e. NULL).
Validity of a specific value can be obtained like this:
idx_t entry_idx = row_idx / 64; idx_t idx_in_entry = row_idx % 64; bool is_valid = validity_mask[entry_idx] & (1 << idx_in_entry);
Alternatively, the (slower) duckdb_validity_row_is_valid function can be used.
vector: The vector to get the data from returns: The pointer to the validity mask, or NULL if no validity mask is present