Skip to main content

MapVector

Struct MapVector 

Source
pub struct MapVector;
Expand description

Operations on MAP vectors.

DuckDB stores maps as LIST<STRUCT{key: K, value: V}>. The child of the list vector is a STRUCT vector with two fields:

  • field index 0: keys
  • field index 1: values

§Example

use quack_rs::vector::complex::MapVector;
use libduckdb_sys::duckdb_vector;

// Reading MAP keys from a MAP vector:
// let keys_vec = unsafe { MapVector::keys(map_vector) };
// let vals_vec = unsafe { MapVector::values(map_vector) };

Implementations§

Source§

impl MapVector

Source

pub unsafe fn struct_child(vector: duckdb_vector) -> duckdb_vector

Returns the child STRUCT vector (contains both keys and values as fields).

§Safety

vector must be a valid DuckDB MAP vector.

Source

pub unsafe fn keys(vector: duckdb_vector) -> duckdb_vector

Returns the keys vector (STRUCT field 0 of the MAP’s child).

§Safety

vector must be a valid DuckDB MAP vector.

Source

pub unsafe fn values(vector: duckdb_vector) -> duckdb_vector

Returns the values vector (STRUCT field 1 of the MAP’s child).

§Safety

vector must be a valid DuckDB MAP vector.

Source

pub unsafe fn total_entry_count(vector: duckdb_vector) -> usize

Returns the total number of key-value pairs across all rows.

§Safety

vector must be a valid DuckDB MAP vector.

Source

pub unsafe fn reserve(vector: duckdb_vector, capacity: usize)

Reserves capacity in the MAP’s child vector for at least capacity entries.

§Safety

vector must be a valid DuckDB MAP vector.

Source

pub unsafe fn set_size(vector: duckdb_vector, size: usize)

Sets the total number of key-value entries written.

§Safety

vector must be a valid DuckDB MAP vector.

Source

pub unsafe fn set_entry( vector: duckdb_vector, row_idx: usize, offset: u64, length: u64, )

Writes the offset/length metadata for a parent MAP row.

This has the same semantics as ListVector::set_entry, since MAP is a LIST.

§Safety

Same as ListVector::set_entry.

Source

pub unsafe fn get_entry( vector: duckdb_vector, row_idx: usize, ) -> duckdb_list_entry

Returns the duckdb_list_entry for a given MAP row (for reading).

§Safety

Same as ListVector::get_entry.

Source

pub unsafe fn key_writer(vector: duckdb_vector) -> VectorWriter

Creates a VectorWriter for the keys vector (STRUCT field 0).

§Safety

vector must be a valid DuckDB MAP vector.

Source

pub unsafe fn value_writer(vector: duckdb_vector) -> VectorWriter

Creates a VectorWriter for the values vector (STRUCT field 1).

§Safety

vector must be a valid DuckDB MAP vector.

Source

pub unsafe fn key_reader( vector: duckdb_vector, element_count: usize, ) -> VectorReader

Creates a VectorReader for the keys vector.

§Safety
  • vector must be a valid DuckDB MAP vector.
  • element_count must equal the total number of key-value entries.
Source

pub unsafe fn value_reader( vector: duckdb_vector, element_count: usize, ) -> VectorReader

Creates a VectorReader for the values vector.

§Safety
  • vector must be a valid DuckDB MAP vector.
  • element_count must equal the total number of key-value entries.

Auto Trait Implementations§

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.