pub struct Columns {
pub row_numbers: CowVec<RowNumber>,
pub created_at: CowVec<DateTime>,
pub updated_at: CowVec<DateTime>,
pub columns: CowVec<ColumnBuffer>,
pub names: CowVec<Fragment>,
}Fields§
§row_numbers: CowVec<RowNumber>§created_at: CowVec<DateTime>§updated_at: CowVec<DateTime>§columns: CowVec<ColumnBuffer>§names: CowVec<Fragment>Implementations§
Source§impl Columns
impl Columns
Sourcepub fn scalar_value(&self) -> Value
pub fn scalar_value(&self) -> Value
Extract the single value from a 1-column, 1-row Columns. Panics if the Columns does not have exactly 1 column and 1 row.
pub fn new(columns: Vec<ColumnWithName>) -> Self
pub fn with_system_columns( columns: Vec<ColumnWithName>, row_numbers: Vec<RowNumber>, created_at: Vec<DateTime>, updated_at: Vec<DateTime>, ) -> Self
pub fn single_row<'b>( rows: impl IntoIterator<Item = (&'b str, Value)>, ) -> Columns
pub fn with_row_numbers(self, row_numbers: Vec<RowNumber>) -> Self
pub fn from_catalog_columns(cols: &[CatalogColumn]) -> Self
pub fn apply_headers(&mut self, headers: &ColumnHeaders)
Source§impl Columns
impl Columns
Sourcepub fn number(&self) -> RowNumber
pub fn number(&self) -> RowNumber
Get the row number (for single-row Columns). Panics if Columns has 0 or multiple rows.
pub fn shape(&self) -> (usize, usize)
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn iter(&self) -> impl Iterator<Item = ColumnRef<'_>> + '_
pub fn first(&self) -> Option<ColumnRef<'_>>
pub fn last(&self) -> Option<ColumnRef<'_>>
pub fn get(&self, index: usize) -> Option<ColumnRef<'_>>
pub fn name_at(&self, index: usize) -> &Fragment
pub fn data_at(&self, index: usize) -> &ColumnBuffer
pub fn data_at_mut(&mut self, index: usize) -> &mut ColumnBuffer
pub fn row(&self, i: usize) -> Vec<Value>
pub fn column(&self, name: &str) -> Option<ColumnRef<'_>>
pub fn row_count(&self) -> usize
pub fn has_rows(&self) -> bool
pub fn is_scalar(&self) -> bool
pub fn get_row(&self, index: usize) -> Vec<Value>
Source§impl Columns
impl Columns
Sourcepub fn extract_by_indices(&self, indices: &[usize]) -> Columns
pub fn extract_by_indices(&self, indices: &[usize]) -> Columns
Extract a subset of rows by indices, returning a new Columns
Sourcepub fn extract_row(&self, index: usize) -> Columns
pub fn extract_row(&self, index: usize) -> Columns
Extract a single row by index, returning a new Columns with 1 row
Sourcepub fn append_rows_by_indices(&mut self, source: &Columns, indices: &[usize])
pub fn append_rows_by_indices(&mut self, source: &Columns, indices: &[usize])
Append rows from source at the given indices to self.
If self is empty (no columns), it is initialized to match the shape
of source and populated from the selected indices. Otherwise the
per-column data, row_numbers, created_at, and updated_at are extended
in place.
Panics if self and source have different column counts (only
checked when self is non-empty).
Sourcepub fn remove_row(&mut self, row_number: RowNumber) -> bool
pub fn remove_row(&mut self, row_number: RowNumber) -> bool
Remove the row whose row_number equals row_number, if present.
Returns true if a row was removed.
Sourcepub fn project_by_names(&self, names: &[String]) -> Columns
pub fn project_by_names(&self, names: &[String]) -> Columns
Project to a subset of columns by name, preserving the order of the provided names. Columns not found in self are silently skipped.
Sourcepub fn partition_by_keys<K: Hash + Eq + Clone>(
&self,
keys: &[K],
) -> IndexMap<K, Columns>
pub fn partition_by_keys<K: Hash + Eq + Clone>( &self, keys: &[K], ) -> IndexMap<K, Columns>
Partition Columns into groups based on keys (one key per row). Returns an IndexMap preserving insertion order of first occurrence.
Sourcepub fn from_row(row: &Row) -> Self
pub fn from_row(row: &Row) -> Self
Create Columns from a Row by decoding its encoded values.
Allocates fresh CowVec storage. For hot paths that repeatedly
rebuild a Columns per row (e.g. CdcProducerActor), prefer
reset_from_row on a reusable Columns slab to retain the inner
Vec capacities across calls.
Sourcepub fn reset_from_row(&mut self, row: &Row)
pub fn reset_from_row(&mut self, row: &Row)
Refill this Columns from a single row, retaining inner Vec
capacities when this slab is uniquely owned. When shared (e.g. a
previous Diff is still in flight referencing one of the inner
CowVecs), Arc::make_mut forks to a fresh capacity-preserving
copy.
Sourcepub fn reset_from_row_with_pool(&mut self, row: &Row, pool: &ColumnBufferPool)
pub fn reset_from_row_with_pool(&mut self, row: &Row, pool: &ColumnBufferPool)
Refill from a row, sourcing inner column buffers from a shared
ColumnBufferPool. Existing buffers whose get_type() matches
the field type are cleared in place; mismatches are released to
the pool and replaced with pool.acquire(...). New columns
(slab last held a narrower row) come from pool.acquire. Excess
columns (slab last held a wider row) are released to the pool.
Sourcepub fn to_single_row(&self) -> Row
pub fn to_single_row(&self) -> Row
Convert Columns back to a Row (assumes single row) Panics if Columns contains more than 1 row
Source§impl Columns
impl Columns
Sourcepub fn get_bool(&self, name: &str, row_idx: usize) -> Option<bool>
pub fn get_bool(&self, name: &str, row_idx: usize) -> Option<bool>
Get a boolean value from a column at the given row index
Sourcepub fn get_f32(&self, name: &str, row_idx: usize) -> Option<f32>
pub fn get_f32(&self, name: &str, row_idx: usize) -> Option<f32>
Get an f32 value from a column at the given row index
Sourcepub fn get_f64(&self, name: &str, row_idx: usize) -> Option<f64>
pub fn get_f64(&self, name: &str, row_idx: usize) -> Option<f64>
Get an f64 value from a column at the given row index
Sourcepub fn get_float8(&self, name: &str, row_idx: usize) -> Option<OrderedF64>
pub fn get_float8(&self, name: &str, row_idx: usize) -> Option<OrderedF64>
Get a Float8 (OrderedF64) value from a column at the given row index
Sourcepub fn get_i8(&self, name: &str, row_idx: usize) -> Option<i8>
pub fn get_i8(&self, name: &str, row_idx: usize) -> Option<i8>
Get an i8 value from a column at the given row index
Sourcepub fn get_i16(&self, name: &str, row_idx: usize) -> Option<i16>
pub fn get_i16(&self, name: &str, row_idx: usize) -> Option<i16>
Get an i16 value from a column at the given row index
Sourcepub fn get_i32(&self, name: &str, row_idx: usize) -> Option<i32>
pub fn get_i32(&self, name: &str, row_idx: usize) -> Option<i32>
Get an i32 value from a column at the given row index
Sourcepub fn get_i64(&self, name: &str, row_idx: usize) -> Option<i64>
pub fn get_i64(&self, name: &str, row_idx: usize) -> Option<i64>
Get an i64 value from a column at the given row index
Sourcepub fn get_i128(&self, name: &str, row_idx: usize) -> Option<i128>
pub fn get_i128(&self, name: &str, row_idx: usize) -> Option<i128>
Get an i128 value from a column at the given row index
Sourcepub fn get_u8(&self, name: &str, row_idx: usize) -> Option<u8>
pub fn get_u8(&self, name: &str, row_idx: usize) -> Option<u8>
Get a u8 value from a column at the given row index
Sourcepub fn get_u16(&self, name: &str, row_idx: usize) -> Option<u16>
pub fn get_u16(&self, name: &str, row_idx: usize) -> Option<u16>
Get a u16 value from a column at the given row index
Sourcepub fn get_u32(&self, name: &str, row_idx: usize) -> Option<u32>
pub fn get_u32(&self, name: &str, row_idx: usize) -> Option<u32>
Get a u32 value from a column at the given row index
Sourcepub fn get_u64(&self, name: &str, row_idx: usize) -> Option<u64>
pub fn get_u64(&self, name: &str, row_idx: usize) -> Option<u64>
Get a u64 value from a column at the given row index
Sourcepub fn get_u128(&self, name: &str, row_idx: usize) -> Option<u128>
pub fn get_u128(&self, name: &str, row_idx: usize) -> Option<u128>
Get a u128 value from a column at the given row index
Sourcepub fn get_string(&self, name: &str, row_idx: usize) -> Option<String>
pub fn get_string(&self, name: &str, row_idx: usize) -> Option<String>
Get a UTF-8 string value from a column at the given row index
Sourcepub fn get_date(&self, name: &str, row_idx: usize) -> Option<Date>
pub fn get_date(&self, name: &str, row_idx: usize) -> Option<Date>
Get a Date value from a column at the given row index
Sourcepub fn get_datetime(&self, name: &str, row_idx: usize) -> Option<DateTime>
pub fn get_datetime(&self, name: &str, row_idx: usize) -> Option<DateTime>
Get a DateTime value from a column at the given row index
Sourcepub fn get_time(&self, name: &str, row_idx: usize) -> Option<Time>
pub fn get_time(&self, name: &str, row_idx: usize) -> Option<Time>
Get a Time value from a column at the given row index
Sourcepub fn get_duration(&self, name: &str, row_idx: usize) -> Option<Duration>
pub fn get_duration(&self, name: &str, row_idx: usize) -> Option<Duration>
Get a Duration value from a column at the given row index
Sourcepub fn get_identity_id(&self, name: &str, row_idx: usize) -> Option<IdentityId>
pub fn get_identity_id(&self, name: &str, row_idx: usize) -> Option<IdentityId>
Get an IdentityId value from a column at the given row index
Sourcepub fn get_uuid4(&self, name: &str, row_idx: usize) -> Option<Uuid4>
pub fn get_uuid4(&self, name: &str, row_idx: usize) -> Option<Uuid4>
Get a Uuid4 value from a column at the given row index
Sourcepub fn get_uuid7(&self, name: &str, row_idx: usize) -> Option<Uuid7>
pub fn get_uuid7(&self, name: &str, row_idx: usize) -> Option<Uuid7>
Get a Uuid7 value from a column at the given row index
Sourcepub fn get_blob(&self, name: &str, row_idx: usize) -> Option<Blob>
pub fn get_blob(&self, name: &str, row_idx: usize) -> Option<Blob>
Get a Blob value from a column at the given row index
Sourcepub fn get_int(&self, name: &str, row_idx: usize) -> Option<Int>
pub fn get_int(&self, name: &str, row_idx: usize) -> Option<Int>
Get an arbitrary-precision signed integer from a column at the given row index
Sourcepub fn get_uint(&self, name: &str, row_idx: usize) -> Option<Uint>
pub fn get_uint(&self, name: &str, row_idx: usize) -> Option<Uint>
Get an arbitrary-precision unsigned integer from a column at the given row index
Sourcepub fn get_decimal(&self, name: &str, row_idx: usize) -> Option<Decimal>
pub fn get_decimal(&self, name: &str, row_idx: usize) -> Option<Decimal>
Get an arbitrary-precision decimal from a column at the given row index
Sourcepub fn get_value(&self, name: &str, row_idx: usize) -> Option<Value>
pub fn get_value(&self, name: &str, row_idx: usize) -> Option<Value>
Get the raw Value from a column at the given row index
Sourcepub fn is_undefined(&self, name: &str, row_idx: usize) -> bool
pub fn is_undefined(&self, name: &str, row_idx: usize) -> bool
Check if the value at the given column and row is undefined/null
Sourcepub fn get_row_number(&self, row_idx: usize) -> Option<RowNumber>
pub fn get_row_number(&self, row_idx: usize) -> Option<RowNumber>
Get the row number at the given index
Source§impl Columns
impl Columns
pub fn append_rows( &mut self, shape: &RowShape, rows: impl IntoIterator<Item = EncodedRow>, row_numbers: Vec<RowNumber>, ) -> Result<()>
Source§impl Columns
impl Columns
pub fn group_by_view(&self, keys: &[&str]) -> Result<GroupByView>
Trait Implementations§
Source§impl Default for Columns
impl Default for Columns
Source§fn default() -> Self
fn default() -> Self
Equivalent to Columns::empty. Required by core::util::slab::Slab<T>
which mints fresh slabs via T::default().
Source§impl<'de> Deserialize<'de> for Columns
impl<'de> Deserialize<'de> for Columns
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Columns
impl RefUnwindSafe for Columns
impl Send for Columns
impl Sync for Columns
impl Unpin for Columns
impl UnsafeUnpin for Columns
impl UnwindSafe for Columns
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