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
impl DataChunk
Sourcepub fn new(column_types: &[LogicalType]) -> Self
pub fn new(column_types: &[LogicalType]) -> Self
Creates a new empty data chunk with the given schema.
Sourcepub fn with_capacity(column_types: &[LogicalType], capacity: usize) -> Self
pub fn with_capacity(column_types: &[LogicalType], capacity: usize) -> Self
Creates a new data chunk with the given schema and capacity.
Sourcepub fn column_count(&self) -> usize
pub fn column_count(&self) -> usize
Returns the number of columns.
Sourcepub fn total_row_count(&self) -> usize
pub fn total_row_count(&self) -> usize
Returns the total number of rows (ignoring selection).
Sourcepub fn column(&self, index: usize) -> Option<&ValueVector>
pub fn column(&self, index: usize) -> Option<&ValueVector>
Gets a column by index.
Sourcepub fn column_mut(&mut self, index: usize) -> Option<&mut ValueVector>
pub fn column_mut(&mut self, index: usize) -> Option<&mut ValueVector>
Gets a mutable column by index.
Sourcepub fn selection(&self) -> Option<&SelectionVector>
pub fn selection(&self) -> Option<&SelectionVector>
Returns the selection vector.
Sourcepub fn set_selection(&mut self, selection: SelectionVector)
pub fn set_selection(&mut self, selection: SelectionVector)
Sets the selection vector.
Sourcepub fn clear_selection(&mut self)
pub fn clear_selection(&mut self)
Clears the selection vector (selects all rows).
Sourcepub fn flatten(&mut self)
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.
Sourcepub fn selected_indices(&self) -> Box<dyn Iterator<Item = usize> + '_>
pub fn selected_indices(&self) -> Box<dyn Iterator<Item = usize> + '_>
Returns an iterator over selected row indices.