Skip to main content

DataChunk

Struct DataChunk 

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

A chunk of data containing multiple columns.

DataChunk is the fundamental unit of data processing in vectorized execution. It holds multiple ValueVectors (columns) and an optional SelectionVector for filtering without copying.

Implementations§

Source§

impl DataChunk

Source

pub fn new(column_types: &[LogicalType]) -> Self

Creates a new empty data chunk with the given schema.

Source

pub fn with_capacity(column_types: &[LogicalType], capacity: usize) -> Self

Creates a new data chunk with the given schema and capacity.

Source

pub fn column_count(&self) -> usize

Returns the number of columns.

Source

pub fn row_count(&self) -> usize

Returns the number of rows (considering selection).

Source

pub fn total_row_count(&self) -> usize

Returns the total number of rows (ignoring selection).

Source

pub fn is_empty(&self) -> bool

Returns true if the chunk is empty.

Source

pub fn capacity(&self) -> usize

Returns the capacity of this chunk.

Source

pub fn is_full(&self) -> bool

Returns true if the chunk is full.

Source

pub fn column(&self, index: usize) -> Option<&ValueVector>

Gets a column by index.

Source

pub fn column_mut(&mut self, index: usize) -> Option<&mut ValueVector>

Gets a mutable column by index.

Source

pub fn selection(&self) -> Option<&SelectionVector>

Returns the selection vector.

Source

pub fn set_selection(&mut self, selection: SelectionVector)

Sets the selection vector.

Source

pub fn clear_selection(&mut self)

Clears the selection vector (selects all rows).

Source

pub fn set_count(&mut self, count: usize)

Sets the row count.

Source

pub fn reset(&mut self)

Resets the chunk for reuse.

Source

pub fn flatten(&mut self)

Flattens the selection by copying only selected rows.

After this operation, selection is None and count equals the previously selected row count.

Source

pub fn selected_indices(&self) -> Box<dyn Iterator<Item = usize> + '_>

Returns an iterator over selected row indices.

Trait Implementations§

Source§

impl Debug for DataChunk

Source§

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

Formats the value using the given formatter. Read more

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.