Skip to main content

ColumnArrayT

Struct ColumnArrayT 

Source
pub struct ColumnArrayT<T>
where T: Column + 'static,
{ /* private fields */ }
Expand description

Typed wrapper for ColumnArray that provides type-safe access to nested column

This is analogous to ColumnArrayT<T> in clickhouse-cpp, providing compile-time type safety for array operations.

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

Implementations§

Source§

impl<T> ColumnArrayT<T>
where T: Column + 'static,

Source

pub fn with_nested(nested: Arc<T>) -> Self

Create a new typed array column from a typed nested column

Source

pub fn new(type_: Type) -> Result<Self>

Create a new typed array column from an array type

Returns an error if the nested column type doesn’t match T

Source

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

Create with reserved capacity

Source

pub fn nested_typed(&self) -> &T

Get typed reference to the nested column

This is safe because we verify the type at construction

Source

pub fn nested_typed_mut(&mut self) -> Result<&mut T>

Get typed mutable reference to the nested column

Returns an error if the column has multiple Arc references

Source

pub fn append_array<F>(&mut self, build_fn: F) -> Result<()>
where F: FnOnce(&mut T),

Append an array by building it with a closure

The closure receives a mutable reference to the nested column and can append elements. The array length is calculated automatically.

§Example
let mut arr =
ColumnArrayT::<ColumnUInt64>::new(Type::array(Type::uint64()))?;
arr.append_array(|nested| {
    nested.append(1);
    nested.append(2);
    nested.append(3);
})?;
Source

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

Append an entire column as a single array element

Source

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

Append an array specified by length

The caller must ensure that len elements have been added to the nested column

Source

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

Get the array at the given index as a sliced 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 offsets(&self) -> &[u64]

Get the offsets

Source

pub fn len(&self) -> usize

Get the number of arrays

Source

pub fn is_empty(&self) -> bool

Check if the array column is empty

Source

pub fn inner(&self) -> &ColumnArray

Get reference to inner ColumnArray

Source

pub fn inner_mut(&mut self) -> &mut ColumnArray

Get mutable reference to inner ColumnArray

Source

pub fn into_inner(self) -> ColumnArray

Convert into inner ColumnArray

Trait Implementations§

Source§

impl<T> Column for ColumnArrayT<T>
where T: Column + 'static,

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§

§

impl<T> Freeze for ColumnArrayT<T>

§

impl<T> !RefUnwindSafe for ColumnArrayT<T>

§

impl<T> Send for ColumnArrayT<T>

§

impl<T> Sync for ColumnArrayT<T>

§

impl<T> Unpin for ColumnArrayT<T>

§

impl<T> !UnwindSafe for ColumnArrayT<T>

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