Skip to main content

ColumnArray

Struct ColumnArray 

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

Column for arrays of variable length

Stores a nested column with all array elements concatenated, and an offsets array that marks where each array ends.

Reference Implementation: See clickhouse-cpp/clickhouse/columns/array.cpp

Implementations§

Source§

impl ColumnArray

Source

pub fn new(type_: Type) -> Self

Create a new array column from an array type

Source

pub fn with_nested(nested: ColumnRef) -> Self

Create a new array column with an existing nested column

Source

pub fn with_capacity(type_: Type, capacity: usize) -> Self

Create with reserved capacity

Source

pub fn append_len(&mut self, len: u64)

Append an array (specified by the number of elements in the nested column to consume) The caller must ensure that len elements have been added to the nested column

Source

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

Get the start and end indices for the array at the given index

Source

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

Get the length of the array at the given index

Source

pub fn nested<T: Column + 'static>(&self) -> &T

Get a reference to the nested column as a specific type

§Example
let col: ColumnArray = /* ... */;
let nested: &ColumnUInt32 = col.nested();
Source

pub fn nested_mut<T: Column + 'static>(&mut self) -> &mut T

Get mutable reference to the nested column as a specific type

§Example
let mut col: ColumnArray = /* ... */;
let nested_mut: &mut ColumnUInt32 = col.nested_mut();
Source

pub fn nested_ref(&self) -> ColumnRef

Get the nested column as a ColumnRef (Arc<dyn Column>)

Source

pub fn offsets(&self) -> &[u64]

Get the offsets

Source

pub fn append_array(&mut self, array_data: ColumnRef)

Append an entire array column as a single array element This takes all the data from the provided column and adds it as one array

Source

pub fn at(&self, index: usize) -> ColumnRef

Get the array at the given index as a sliced column

Source

pub fn len(&self) -> usize

Get the number of arrays (alias for size())

Source

pub fn is_empty(&self) -> bool

Check if the array column is empty

Trait Implementations§

Source§

impl Column for ColumnArray

Source§

fn column_type(&self) -> &Type

Get the type of this column
Source§

fn size(&self) -> usize

Get the number of rows in this column
Source§

fn clear(&mut self)

Clear all data from the column
Source§

fn reserve(&mut self, new_cap: usize)

Reserve capacity for at least new_cap elements
Source§

fn append_column(&mut self, other: ColumnRef) -> Result<()>

Append another column’s data to this column
Source§

fn load_from_buffer(&mut self, buffer: &mut &[u8], rows: usize) -> Result<()>

Load column data from byte buffer
Source§

fn load_prefix(&mut self, buffer: &mut &[u8], rows: usize) -> Result<()>

Load column prefix from byte buffer (for types that need prefix data) Default implementation is a no-op. Override for types like LowCardinality. This matches C++ clickhouse-cpp’s LoadPrefix pattern.
Source§

fn save_prefix(&self, buffer: &mut BytesMut) -> Result<()>

Save column prefix to byte buffer (for types that need prefix data) Default implementation is a no-op. Override for types like LowCardinality, Array with special nested types. This matches C++ clickhouse-cpp’s SavePrefix pattern.
Source§

fn save_to_buffer(&self, buffer: &mut BytesMut) -> Result<()>

Save column data to byte buffer
Source§

fn clone_empty(&self) -> ColumnRef

Create an empty clone of this column (same type, no data)
Source§

fn slice(&self, begin: usize, len: usize) -> Result<ColumnRef>

Create a slice of this column
Source§

fn as_any(&self) -> &dyn Any

Downcast to a concrete column type
Source§

fn as_any_mut(&mut self) -> &mut dyn Any

Downcast to a mutable concrete column type

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> 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, 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