Struct Vector

Source
pub struct Vector<T>(/* private fields */);
Expand description

Vector of values of a specified PhysicalType.

Implementations§

Source§

impl<T> Vector<T>

Source

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.

Source

pub unsafe fn assign_string_element_len( &self, index: idx_t, str_: *const c_char, str_len: idx_t, )

Assigns a string element in the vector at the specified location.

§Arguments
  • index - The row position in the vector to assign the string to
  • str - The string
  • str_len - The length of the string (in bytes)
§Safety
Source

pub unsafe fn assign_string_element(&self, index: idx_t, str_: *const c_char)

Assigns a string element in the vector at the specified location.

§Arguments
  • index - The row position in the vector to assign the string to
  • str - The null-terminated string“]
§Safety
Source

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.

Source

pub fn get_column_type(&self) -> LogicalType

Retrieves the column type of the specified vector.

Source

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

Source

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.

Trait Implementations§

Source§

impl<T> From<*mut c_void> for Vector<T>

Source§

fn from(ptr: duckdb_vector) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<T> Freeze for Vector<T>

§

impl<T> RefUnwindSafe for Vector<T>
where T: RefUnwindSafe,

§

impl<T> !Send for Vector<T>

§

impl<T> !Sync for Vector<T>

§

impl<T> Unpin for Vector<T>
where T: Unpin,

§

impl<T> UnwindSafe for Vector<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.