pub trait Column: Send + Sync {
Show 13 methods
// Required methods
fn column_type(&self) -> &Type;
fn size(&self) -> usize;
fn clear(&mut self);
fn reserve(&mut self, new_cap: usize);
fn append_column(&mut self, other: ColumnRef) -> Result<()>;
fn load_from_buffer(
&mut self,
buffer: &mut &[u8],
rows: usize,
) -> Result<()>;
fn save_to_buffer(&self, buffer: &mut BytesMut) -> Result<()>;
fn clone_empty(&self) -> ColumnRef;
fn slice(&self, begin: usize, len: usize) -> Result<ColumnRef>;
fn as_any(&self) -> &dyn Any;
fn as_any_mut(&mut self) -> &mut dyn Any;
// Provided methods
fn load_prefix(&mut self, _buffer: &mut &[u8], _rows: usize) -> Result<()> { ... }
fn save_prefix(&self, _buffer: &mut BytesMut) -> Result<()> { ... }
}Expand description
Base trait for all column types Note: We use byte buffers instead of generic readers/writers to make the trait dyn-compatible
Required Methods§
Sourcefn column_type(&self) -> &Type
fn column_type(&self) -> &Type
Get the type of this column
Sourcefn append_column(&mut self, other: ColumnRef) -> Result<()>
fn append_column(&mut self, other: ColumnRef) -> Result<()>
Append another column’s data to this column
Sourcefn load_from_buffer(&mut self, buffer: &mut &[u8], rows: usize) -> Result<()>
fn load_from_buffer(&mut self, buffer: &mut &[u8], rows: usize) -> Result<()>
Load column data from byte buffer
Sourcefn save_to_buffer(&self, buffer: &mut BytesMut) -> Result<()>
fn save_to_buffer(&self, buffer: &mut BytesMut) -> Result<()>
Save column data to byte buffer
Sourcefn clone_empty(&self) -> ColumnRef
fn clone_empty(&self) -> ColumnRef
Create an empty clone of this column (same type, no data)
Sourcefn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Downcast to a mutable concrete column type
Provided Methods§
Sourcefn load_prefix(&mut self, _buffer: &mut &[u8], _rows: usize) -> Result<()>
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.
Sourcefn save_prefix(&self, _buffer: &mut BytesMut) -> Result<()>
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.