Skip to main content

Row

Struct Row 

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

A database row containing column values

Row provides methods for accessing and manipulating column values while maintaining type safety and consistency with the schema.

§Performance

  • Shared storage: O(1) clone (just Arc increment)
  • Owned storage: O(n) clone (copies values)
  • String values use SmartString with internal Arc for efficient sharing

Implementations§

Source§

impl Row

Source

pub fn new() -> Self

Create a new empty row

Source

pub fn with_capacity(capacity: usize) -> Self

Create a row with pre-allocated capacity

Source

pub fn from_values(values: Vec<Value>) -> Self

Create a row from a vector of values

Source

pub fn from_compact_vec(values: CompactVec<Value>) -> Self

Create a row from CompactVec

Source

pub fn from_arc(values: CompactArc<[Value]>) -> Self

Create a row from an Arc slice - O(1), no copying

Source

pub fn from_combined(left: &Row, right: &Row) -> Self

Create a row by combining two rows (for JOINs) Result uses Owned storage (optimal for intermediate results)

Source

pub fn combine_into(&mut self, left: &Row, right: &Row)

Combine two rows into this row buffer (for JOINs) - reuses allocation

Source

pub fn combine_into_clone_move(&mut self, left: &Row, right: Row)

Combine rows: clone left, move right (for JOINs) - reuses allocation

Source

pub fn combine_into_owned(&mut self, left: Row, right: Row)

Combine rows: move both (for JOINs) - reuses allocation

Source

pub fn from_combined_clone_move(left: &Row, right: Row) -> Self

Combine rows: clone left, move right (for JOINs)

Source

pub fn from_combined_owned(left: Row, right: Row) -> Self

Combine two owned rows (for JOINs) - moves values without cloning

Source

pub fn null_row(schema: &Schema) -> Self

Create a row with null values for a given schema

Source

pub fn len(&self) -> usize

Get the number of values in the row

Source

pub fn is_empty(&self) -> bool

Check if the row is empty

Source

pub fn get(&self, index: usize) -> Option<&Value>

Get a value by index

Source

pub fn get_mut(&mut self, index: usize) -> Option<&mut Value>

Get a mutable value by index (triggers copy-on-write if shared)

Source

pub fn set(&mut self, index: usize, value: Value) -> Result<()>

Set a value at the given index (triggers copy-on-write if shared)

Source

pub fn push(&mut self, value: Value)

Push a value to the end of the row

Source

pub fn pop(&mut self) -> Option<Value>

Pop a value from the end of the row

Source

pub fn truncate(&mut self, len: usize)

Truncate the row to a specific length

Source

pub fn clear(&mut self)

Clear the row values while keeping allocated capacity

Source

pub fn take_and_clear(&mut self) -> Row

Take the values from this row, returning them in a new Row. The original row is cleared but keeps its allocated capacity.

Source

pub fn reserve(&mut self, additional: usize)

Reserve capacity for at least additional more values

Source

pub fn extend_from_slice(&mut self, other: &[Value])

Extend the row with values from a slice

Source

pub fn extend_into_compact_vec(self, target: &mut CompactVec<Value>)

Extend a CompactVec with this row’s values, consuming self.

OPTIMIZATION: This avoids the intermediate Vec allocation that would occur with target.extend(row) which goes through Row::into_iter().

  • Owned storage: directly extends from CompactVec (moves values)
  • Shared storage: clones values from Arc slice
Source

pub fn iter(&self) -> RowIter<'_>

Get an iterator over the values

Source

pub fn iter_mut(&mut self) -> RowIterMut<'_>

Get a mutable iterator over the values (triggers copy-on-write if shared)

Source

pub fn into_values(self) -> Vec<Value>

Get the underlying vector of values, consuming the row

Source

pub fn take_first_value(self) -> Option<Value>

Extract the first value, consuming the row

Source

pub fn is_shared(&self) -> bool

Check if storage is shared (Arc-wrapped)

Source

pub fn is_owned(&self) -> bool

Check if storage is owned

Source

pub fn into_arc(self) -> CompactArc<[Value]>

Convert Row to CompactArc<Value>, consuming self

  • Shared: returns the CompactArc directly (O(1))
  • Owned: creates new Arc (O(n))
Source

pub fn into_shared(self) -> Self

Convert to Shared storage for O(1) clone.

Use this when the row will be cloned multiple times (e.g., hash join build side). After conversion, row.clone() is just an Arc increment.

Source

pub fn as_arc(&self) -> Option<&CompactArc<[Value]>>

Get CompactArc<Value> reference if shared, None if owned

Source

pub fn as_slice(&self) -> &[Value]

Get slice of values

Source

pub fn select_columns(&self, indices: &[usize]) -> Result<Row>

Extract specific columns by their indices

Source

pub fn take_columns(self, indices: &[usize]) -> Row

Take specific columns by their indices, consuming the row Detects prefix projections (0, 1, 2, …, n-1) and truncates in-place.

Source

pub fn validate(&self, schema: &Schema) -> Result<()>

Validate the row against a schema

Source

pub fn clone_subset(&self, indices: &[usize]) -> Row

Clone the row, selecting only the specified column indices

Source

pub fn concat(&self, other: &Row) -> Row

Concatenate two rows

Source

pub fn repeat(value: Value, count: usize) -> Row

Create a row by repeating a value

Source

pub fn is_inline(&self) -> bool

Alias for is_owned (backwards compatibility)

Source

pub fn clear_inline(&mut self)

Clear and use as inline storage (backwards compatibility)

Source

pub fn push_inline(&mut self, value: Value)

Push to inline storage (backwards compatibility)

Source

pub fn reserve_inline(&mut self, capacity: usize)

Reserve inline capacity (backwards compatibility)

Source

pub fn refill_inline<I: Iterator<Item = Value>>(&mut self, values: I)

Refill with values (backwards compatibility)

Trait Implementations§

Source§

impl Clone for Row

Source§

fn clone(&self) -> Row

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 Row

Source§

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

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

impl Default for Row

Source§

fn default() -> Row

Returns the “default value” for a type. Read more
Source§

impl Display for Row

Source§

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

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

impl From<CompactArc<[Value]>> for Row

Source§

fn from(values: CompactArc<[Value]>) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<Value>> for Row

Source§

fn from(values: Vec<Value>) -> Self

Converts to this type from the input type.
Source§

impl FromIterator<Value> for Row

Source§

fn from_iter<I: IntoIterator<Item = Value>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl Index<usize> for Row

Source§

type Output = Value

The returned type after indexing.
Source§

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

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

impl<'a> IntoIterator for &'a Row

Source§

type Item = &'a Value

The type of the elements being iterated over.
Source§

type IntoIter = RowIter<'a>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl IntoIterator for Row

Source§

type Item = Value

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<Value>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl PartialEq for Row

Source§

fn eq(&self, other: &Row) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Row

Auto Trait Implementations§

§

impl Freeze for Row

§

impl RefUnwindSafe for Row

§

impl Send for Row

§

impl Sync for Row

§

impl Unpin for Row

§

impl UnsafeUnpin for Row

§

impl UnwindSafe for Row

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> CompactArcDrop for T

Source§

unsafe fn drop_and_dealloc(ptr: *mut u8)

Drop the contained data and deallocate the header+data allocation. 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> 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> Same for T

Source§

type Output = T

Should always be Self
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V