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,
impl<T> ColumnArrayT<T>where
T: Column + 'static,
Sourcepub fn with_nested(nested: Arc<T>) -> Self
pub fn with_nested(nested: Arc<T>) -> Self
Create a new typed array column from a typed nested column
Sourcepub fn new(type_: Type) -> Result<Self>
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
Sourcepub fn with_capacity(type_: Type, capacity: usize) -> Result<Self>
pub fn with_capacity(type_: Type, capacity: usize) -> Result<Self>
Create with reserved capacity
Sourcepub fn nested_typed(&self) -> &T
pub fn nested_typed(&self) -> &T
Get typed reference to the nested column
This is safe because we verify the type at construction
Sourcepub fn nested_typed_mut(&mut self) -> Result<&mut T>
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
Sourcepub fn append_array<F>(&mut self, build_fn: F) -> Result<()>
pub fn append_array<F>(&mut self, build_fn: F) -> Result<()>
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);
})?;Sourcepub fn append_array_column(&mut self, array_data: ColumnRef)
pub fn append_array_column(&mut self, array_data: ColumnRef)
Append an entire column as a single array element
Sourcepub fn append_len(&mut self, len: u64)
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
Sourcepub fn at(&self, index: usize) -> ColumnRef
pub fn at(&self, index: usize) -> ColumnRef
Get the array at the given index as a sliced column
Sourcepub fn get_array_range(&self, index: usize) -> Option<(usize, usize)>
pub fn get_array_range(&self, index: usize) -> Option<(usize, usize)>
Get the start and end indices for the array at the given index
Sourcepub fn get_array_len(&self, index: usize) -> Option<usize>
pub fn get_array_len(&self, index: usize) -> Option<usize>
Get the length of the array at the given index
Sourcepub fn inner(&self) -> &ColumnArray
pub fn inner(&self) -> &ColumnArray
Get reference to inner ColumnArray
Sourcepub fn inner_mut(&mut self) -> &mut ColumnArray
pub fn inner_mut(&mut self) -> &mut ColumnArray
Get mutable reference to inner ColumnArray
Sourcepub fn into_inner(self) -> ColumnArray
pub fn into_inner(self) -> ColumnArray
Convert into inner ColumnArray