pub struct DataChunk { /* private fields */ }Expand description
A batch of tuples in columnar layout.
Rows 0..len hold data; sel narrows which rows are “live” after filtering.
When sel is None, all rows 0..len are live (avoids allocation on non-
filtering operators).
Implementations§
Source§impl DataChunk
impl DataChunk
Sourcepub fn from_columns(columns: Vec<ColumnVector>) -> Self
pub fn from_columns(columns: Vec<ColumnVector>) -> Self
Create a chunk from a set of column vectors.
§Panics
Panics in debug mode if columns have different lengths.
Sourcepub fn from_two_vecs(
col0_id: u32,
col0: Vec<u64>,
col1_id: u32,
col1: Vec<u64>,
) -> Self
pub fn from_two_vecs( col0_id: u32, col0: Vec<u64>, col1_id: u32, col1: Vec<u64>, ) -> Self
Create a chunk with exactly two u64 columns (typically src_slot, dst_slot).
Convenience constructor used by GetNeighbors.
pub fn is_empty(&self) -> bool
Sourcepub fn column(&self, pos: usize) -> &ColumnVector
pub fn column(&self, pos: usize) -> &ColumnVector
Get a reference to a column by position.
Sourcepub fn column_mut(&mut self, pos: usize) -> &mut ColumnVector
pub fn column_mut(&mut self, pos: usize) -> &mut ColumnVector
Get a mutable reference to a column by position.
Sourcepub fn num_columns(&self) -> usize
pub fn num_columns(&self) -> usize
Number of columns.
Sourcepub fn find_column(&self, col_id: u32) -> Option<&ColumnVector>
pub fn find_column(&self, col_id: u32) -> Option<&ColumnVector>
Find a column by col_id. Returns None if not present.
Sourcepub fn push_column(&mut self, col: ColumnVector)
pub fn push_column(&mut self, col: ColumnVector)
Add a column to the chunk.
§Panics
Panics in debug mode if the new column length differs from self.len.
Sourcepub fn sel(&self) -> Option<&[u32]>
pub fn sel(&self) -> Option<&[u32]>
Return the current selection vector, or None if all rows are live.
Sourcepub fn filter_sel<F>(&mut self, pred: F)
pub fn filter_sel<F>(&mut self, pred: F)
Apply a predicate to each live row and update the selection vector.
pred receives the row index i and returns true if the row should
remain live. Rows that return false are removed from sel.
This is the core Filter operation: it never copies column data, only updates the selection vector. O(live_len) time, O(1) extra memory (modifies sel in place).
Sourcepub fn live_rows(&self) -> LiveRows<'_> ⓘ
pub fn live_rows(&self) -> LiveRows<'_> ⓘ
Materialize this chunk into an iterator over live row indices.
When sel is None, yields 0..len. When sel is Some(sel),
yields indices from the selection vector.
Sourcepub fn into_columns(self) -> Vec<ColumnVector>
pub fn into_columns(self) -> Vec<ColumnVector>
Consume the chunk and extract its column vectors.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DataChunk
impl RefUnwindSafe for DataChunk
impl Send for DataChunk
impl Sync for DataChunk
impl Unpin for DataChunk
impl UnsafeUnpin for DataChunk
impl UnwindSafe for DataChunk
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more