pub struct ColumnarMemtable { /* private fields */ }Expand description
In-memory columnar buffer that accumulates INSERTs.
Each column is stored as a typed vector. The memtable flushes to a compressed segment when the row count reaches the threshold.
Implementations§
Source§impl ColumnarMemtable
impl ColumnarMemtable
Sourcepub fn new(schema: &ColumnarSchema) -> Self
pub fn new(schema: &ColumnarSchema) -> Self
Create a new empty memtable for the given schema.
Sourcepub fn with_threshold(schema: &ColumnarSchema, flush_threshold: usize) -> Self
pub fn with_threshold(schema: &ColumnarSchema, flush_threshold: usize) -> Self
Create with a custom flush threshold.
Sourcepub fn append_row(&mut self, values: &[Value]) -> Result<(), ColumnarError>
pub fn append_row(&mut self, values: &[Value]) -> Result<(), ColumnarError>
Append a row of values. Validates types and nullability.
Sourcepub fn should_flush(&self) -> bool
pub fn should_flush(&self) -> bool
Whether the memtable has reached its flush threshold.
Sourcepub fn schema(&self) -> &ColumnarSchema
pub fn schema(&self) -> &ColumnarSchema
Access the schema.
Sourcepub fn columns(&self) -> &[ColumnData]
pub fn columns(&self) -> &[ColumnData]
Access the raw column data (for the segment writer).
Sourcepub fn try_dict_encode_columns(&mut self, max_cardinality: u32)
pub fn try_dict_encode_columns(&mut self, max_cardinality: u32)
Convert low-cardinality String columns to DictEncoded in-place.
Sourcepub fn iter_rows(&self) -> MemtableRowIter<'_> ⓘ
pub fn iter_rows(&self) -> MemtableRowIter<'_> ⓘ
Iterate rows as Vec<Value>. For scan/read operations.
Sourcepub fn get_row(&self, row_idx: usize) -> Option<Vec<Value>>
pub fn get_row(&self, row_idx: usize) -> Option<Vec<Value>>
Get a single row by index as Vec<Value>.
Sourcepub fn drain(&mut self) -> (ColumnarSchema, Vec<ColumnData>, usize)
pub fn drain(&mut self) -> (ColumnarSchema, Vec<ColumnData>, usize)
Drain the memtable: return all column data and reset to empty.
Sourcepub fn drain_optimized(&mut self) -> (ColumnarSchema, Vec<ColumnData>, usize)
pub fn drain_optimized(&mut self) -> (ColumnarSchema, Vec<ColumnData>, usize)
Drain with automatic dictionary encoding for low-cardinality String columns.
Sourcepub fn ingest_row_refs(
&mut self,
values: &[IngestValue<'_>],
) -> Result<(), ColumnarError>
pub fn ingest_row_refs( &mut self, values: &[IngestValue<'_>], ) -> Result<(), ColumnarError>
Zero-copy row ingest for timeseries and high-throughput paths.
Accepts borrowed values via IngestValue<'_>, avoiding string cloning
for tag columns that are already interned in the DictEncoded dictionary.
Sourcepub fn add_column(
&mut self,
name: String,
column_type: ColumnType,
nullable: bool,
)
pub fn add_column( &mut self, name: String, column_type: ColumnType, nullable: bool, )
Add a new column to the schema, backfilling existing rows with nulls/defaults.
Auto Trait Implementations§
impl Freeze for ColumnarMemtable
impl RefUnwindSafe for ColumnarMemtable
impl Send for ColumnarMemtable
impl Sync for ColumnarMemtable
impl Unpin for ColumnarMemtable
impl UnsafeUnpin for ColumnarMemtable
impl UnwindSafe for ColumnarMemtable
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.