Skip to main content

Columns

Struct Columns 

Source
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

Source

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.

Source

pub fn new(columns: Vec<ColumnWithName>) -> Self

Source

pub fn with_system_columns( columns: Vec<ColumnWithName>, row_numbers: Vec<RowNumber>, created_at: Vec<DateTime>, updated_at: Vec<DateTime>, ) -> Self

Source

pub fn single_row<'b>( rows: impl IntoIterator<Item = (&'b str, Value)>, ) -> Columns

Source

pub fn with_row_numbers(self, row_numbers: Vec<RowNumber>) -> Self

Source

pub fn from_catalog_columns(cols: &[CatalogColumn]) -> Self

Source

pub fn apply_headers(&mut self, headers: &ColumnHeaders)

Source§

impl Columns

Source

pub fn number(&self) -> RowNumber

Get the row number (for single-row Columns). Panics if Columns has 0 or multiple rows.

Source

pub fn shape(&self) -> (usize, usize)

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn iter(&self) -> impl Iterator<Item = ColumnRef<'_>> + '_

Source

pub fn first(&self) -> Option<ColumnRef<'_>>

Source

pub fn last(&self) -> Option<ColumnRef<'_>>

Source

pub fn get(&self, index: usize) -> Option<ColumnRef<'_>>

Source

pub fn name_at(&self, index: usize) -> &Fragment

Source

pub fn data_at(&self, index: usize) -> &ColumnBuffer

Source

pub fn data_at_mut(&mut self, index: usize) -> &mut ColumnBuffer

Source

pub fn row(&self, i: usize) -> Vec<Value>

Source

pub fn column(&self, name: &str) -> Option<ColumnRef<'_>>

Source

pub fn row_count(&self) -> usize

Source

pub fn has_rows(&self) -> bool

Source

pub fn is_scalar(&self) -> bool

Source

pub fn get_row(&self, index: usize) -> Vec<Value>

Source§

impl Columns

Source

pub fn from_rows(names: &[&str], result_rows: &[Vec<Value>]) -> Self

Source§

impl Columns

Source

pub fn empty() -> Self

Source§

impl Columns

Source

pub fn extract_by_indices(&self, indices: &[usize]) -> Columns

Extract a subset of rows by indices, returning a new Columns

Source

pub fn extract_row(&self, index: usize) -> Columns

Extract a single row by index, returning a new Columns with 1 row

Source

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).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source

pub fn get_bool(&self, name: &str, row_idx: usize) -> Option<bool>

Get a boolean value from a column at the given row index

Source

pub fn get_f32(&self, name: &str, row_idx: usize) -> Option<f32>

Get an f32 value from a column at the given row index

Source

pub fn get_f64(&self, name: &str, row_idx: usize) -> Option<f64>

Get an f64 value from a column at the given row index

Source

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

Source

pub fn get_i8(&self, name: &str, row_idx: usize) -> Option<i8>

Get an i8 value from a column at the given row index

Source

pub fn get_i16(&self, name: &str, row_idx: usize) -> Option<i16>

Get an i16 value from a column at the given row index

Source

pub fn get_i32(&self, name: &str, row_idx: usize) -> Option<i32>

Get an i32 value from a column at the given row index

Source

pub fn get_i64(&self, name: &str, row_idx: usize) -> Option<i64>

Get an i64 value from a column at the given row index

Source

pub fn get_i128(&self, name: &str, row_idx: usize) -> Option<i128>

Get an i128 value from a column at the given row index

Source

pub fn get_u8(&self, name: &str, row_idx: usize) -> Option<u8>

Get a u8 value from a column at the given row index

Source

pub fn get_u16(&self, name: &str, row_idx: usize) -> Option<u16>

Get a u16 value from a column at the given row index

Source

pub fn get_u32(&self, name: &str, row_idx: usize) -> Option<u32>

Get a u32 value from a column at the given row index

Source

pub fn get_u64(&self, name: &str, row_idx: usize) -> Option<u64>

Get a u64 value from a column at the given row index

Source

pub fn get_u128(&self, name: &str, row_idx: usize) -> Option<u128>

Get a u128 value from a column at the given row index

Source

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

Source

pub fn get_date(&self, name: &str, row_idx: usize) -> Option<Date>

Get a Date value from a column at the given row index

Source

pub fn get_datetime(&self, name: &str, row_idx: usize) -> Option<DateTime>

Get a DateTime value from a column at the given row index

Source

pub fn get_time(&self, name: &str, row_idx: usize) -> Option<Time>

Get a Time value from a column at the given row index

Source

pub fn get_duration(&self, name: &str, row_idx: usize) -> Option<Duration>

Get a Duration value from a column at the given row index

Source

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

Source

pub fn get_uuid4(&self, name: &str, row_idx: usize) -> Option<Uuid4>

Get a Uuid4 value from a column at the given row index

Source

pub fn get_uuid7(&self, name: &str, row_idx: usize) -> Option<Uuid7>

Get a Uuid7 value from a column at the given row index

Source

pub fn get_blob(&self, name: &str, row_idx: usize) -> Option<Blob>

Get a Blob value from a column at the given row index

Source

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

Source

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

Source

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

Source

pub fn get_value(&self, name: &str, row_idx: usize) -> Option<Value>

Get the raw Value from a column at the given row index

Source

pub fn is_undefined(&self, name: &str, row_idx: usize) -> bool

Check if the value at the given column and row is undefined/null

Source

pub fn get_row_number(&self, row_idx: usize) -> Option<RowNumber>

Get the row number at the given index

Source§

impl Columns

Source

pub fn row_ref(&self, index: usize) -> Option<RowRef<'_>>

Source

pub fn row_refs(&self) -> RowRefIter<'_>

Source§

impl Columns

Source

pub fn append_columns(&mut self, other: Columns) -> Result<()>

Source§

impl Columns

Source

pub fn append_rows( &mut self, shape: &RowShape, rows: impl IntoIterator<Item = EncodedRow>, row_numbers: Vec<RowNumber>, ) -> Result<()>

Source§

impl Columns

Source

pub fn filter(&mut self, mask: &BitVec) -> Result<()>

Source§

impl Columns

Source

pub fn take(&mut self, n: usize) -> Result<()>

Source§

impl Columns

Source

pub fn group_by_view(&self, keys: &[&str]) -> Result<GroupByView>

Trait Implementations§

Source§

impl Clone for Columns

Source§

fn clone(&self) -> Columns

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Columns

Source§

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

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

impl Default for Columns

Source§

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

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<Columns> for Frame

Source§

fn from(columns: Columns) -> Self

Converts to this type from the input type.
Source§

impl From<Frame> for Columns

Source§

fn from(frame: Frame) -> Self

Converts to this type from the input type.
Source§

impl Index<usize> for Columns

Source§

type Output = ColumnBuffer

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl IndexMut<usize> for Columns

Source§

fn index_mut(&mut self, index: usize) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl Serialize for Columns

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,