pub struct Vector<T>(/* private fields */);
Expand description
Vector of values of a specified PhysicalType.
Implementations§
Source§impl<T> Vector<T>
impl<T> Vector<T>
Sourcepub fn get_data(&self) -> *mut T
pub fn get_data(&self) -> *mut T
Retrieves the data pointer of the vector.
The data pointer can be used to read or write values from the vector. How to read or write values depends on the type of the vector.
Sourcepub unsafe fn assign_string_element_len(
&self,
index: idx_t,
str_: *const c_char,
str_len: idx_t,
)
pub unsafe fn assign_string_element_len( &self, index: idx_t, str_: *const c_char, str_len: idx_t, )
Sourcepub unsafe fn assign_string_element(&self, index: idx_t, str_: *const c_char)
pub unsafe fn assign_string_element(&self, index: idx_t, str_: *const c_char)
Sourcepub fn get_data_as_slice(&mut self) -> &mut [T]
pub fn get_data_as_slice(&mut self) -> &mut [T]
Retrieves the data pointer of the vector as a slice
The data pointer can be used to read or write values from the vector. How to read or write values depends on the type of the vector.
Sourcepub fn get_column_type(&self) -> LogicalType
pub fn get_column_type(&self) -> LogicalType
Retrieves the column type of the specified vector.
Sourcepub fn get_validity(&self) -> ValidityMask
pub fn get_validity(&self) -> ValidityMask
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_maskentry_idx & (1 << idx_in_entry);
Alternatively, the (slower) row_is_valid function can be used.
returns: The pointer to the validity mask, or NULL if no validity mask is present
Sourcepub fn ensure_validity_writable(&self)
pub fn ensure_validity_writable(&self)
Ensures the validity mask is writable by allocating it.
After this function is called, get_validity will ALWAYS return non-NULL. This allows null values to be written to the vector, regardless of whether a validity mask was present before.