Struct DataChunk

Source
pub struct DataChunk { /* private fields */ }
Expand description

A Data Chunk represents a set of vectors.

The data chunk class is the intermediate representation used by the execution engine of DuckDB. It effectively represents a subset of a relation. It holds a set of vectors that all have the same length.

DataChunk is initialized using the DataChunk::Initialize function by providing it with a vector of TypeIds for the Vector members. By default, this function will also allocate a chunk of memory in the DataChunk for the vectors and all the vectors will be referencing vectors to the data owned by the chunk. The reason for this behavior is that the underlying vectors can become referencing vectors to other chunks as well (i.e. in the case an operator does not alter the data, such as a Filter operator which only adds a selection vector).

In addition to holding the data of the vectors, the DataChunk also owns the selection vector that underlying vectors can point to.

Implementations§

Source§

impl DataChunk

Source

pub fn new(types: Vec<LogicalType>) -> Self

Creates an empty DataChunk with the specified set of types.

§Arguments
  • types: An array of types of the data chunk.
Source

pub fn get_vector<T>(&self, column_index: idx_t) -> Vector<T>

Retrieves the vector at the specified column index in the data chunk.

The pointer to the vector is valid for as long as the chunk is alive. It does NOT need to be destroyed.

Source

pub fn set_size(&self, size: idx_t)

Sets the current number of tuples in a data chunk.

Source

pub fn reset(&self)

Resets a data chunk, clearing the validity masks and setting the cardinality of the data chunk to 0.

Source

pub fn get_column_count(&self) -> idx_t

Retrieves the number of columns in a data chunk.

Source

pub fn get_size(&self) -> idx_t

Retrieves the current number of tuples in a data chunk.

Trait Implementations§

Source§

impl Debug for DataChunk

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for DataChunk

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl From<*mut c_void> for DataChunk

Source§

fn from(ptr: duckdb_data_chunk) -> Self

Converts to this type from the input type.

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.