Table

Struct Table 

Source
pub struct Table<P = MemPager>
where P: Pager<Blob = EntryHandle> + Send + Sync,
{ /* private fields */ }
Expand description

Handle for data operations on a table.

Implementations§

Source§

impl<P> Table<P>
where P: Pager<Blob = EntryHandle> + Send + Sync,

Source

pub fn create_from_columns( display_name: &str, canonical_name: &str, columns: &[PlanColumnSpec], metadata: Arc<MetadataManager<P>>, catalog: Arc<TableCatalog>, store: Arc<ColumnStore<P>>, ) -> LlkvResult<CreateTableResult<P>>

Create a new table from column specifications.

Coordinates metadata persistence, catalog registration, and storage initialization.

Source

pub fn create_from_schema( display_name: &str, canonical_name: &str, schema: &Schema, metadata: Arc<MetadataManager<P>>, catalog: Arc<TableCatalog>, store: Arc<ColumnStore<P>>, ) -> LlkvResult<CreateTableResult<P>>

Create a new table from an Arrow schema (for CREATE TABLE AS SELECT).

Source

pub fn register_sort_index(&self, field_id: FieldId) -> LlkvResult<()>

Register a persisted sort index for the specified user column.

Source

pub fn unregister_sort_index(&self, field_id: FieldId) -> LlkvResult<()>

Remove a persisted sort index for the specified user column if it exists.

Source

pub fn list_registered_indexes( &self, field_id: FieldId, ) -> LlkvResult<Vec<IndexKind>>

List the persisted index kinds registered for the given user column.

Source

pub fn append(&self, batch: &RecordBatch) -> LlkvResult<()>

Append a RecordBatch to the table.

The batch must include:

  • A row_id column (type UInt64) with unique row identifiers
  • field_id metadata for each user column, mapping to this table’s field IDs
§MVCC Columns

If the batch includes created_by or deleted_by columns, they are automatically assigned the correct LogicalFieldId for this table’s MVCC metadata.

§Field ID Mapping

Each column’s field_id metadata is converted to a LogicalFieldId by combining it with this table’s ID. This ensures columns from different tables don’t collide in the underlying storage.

§Errors

Returns an error if:

  • The batch is missing the row_id column
  • Any user column is missing field_id metadata
  • Field IDs are invalid or malformed
  • The underlying storage operation fails
Source

pub fn scan_stream<'a, I, T, F>( &self, projections: I, filter_expr: &Expr<'a, FieldId>, options: ScanStreamOptions<P>, on_batch: F, ) -> LlkvResult<()>
where I: IntoIterator<Item = T>, T: Into<ScanProjection>, F: FnMut(RecordBatch),

Stream one or more projected columns as a sequence of RecordBatches.

  • Avoids concat and large materializations.
  • Uses the same filter machinery as the old scan to produce row_ids.
  • Splits row_ids into fixed-size windows and gathers rows per window to form a small RecordBatch that is sent to on_batch.
Source

pub fn scan_stream_with_exprs<'a, F>( &self, projections: &[ScanProjection], filter_expr: &Expr<'a, FieldId>, options: ScanStreamOptions<P>, on_batch: F, ) -> LlkvResult<()>
where F: FnMut(RecordBatch),

Stream projections using fully resolved expression inputs.

Callers that already parsed expressions into ScanProjection values can use this entry point to skip the iterator conversion performed by Self::scan_stream. The execution semantics and callbacks are identical.

Source

pub fn filter_row_ids<'a>( &self, filter_expr: &Expr<'a, FieldId>, ) -> LlkvResult<Vec<RowId>>

Source

pub fn catalog(&self) -> SysCatalog<'_, P>

Source

pub fn get_table_meta(&self) -> Option<TableMeta>

Source

pub fn get_cols_meta(&self, col_ids: &[FieldId]) -> Vec<Option<ColMeta>>

Source

pub fn schema(&self) -> LlkvResult<Arc<Schema>>

Build and return an Arrow Schema that describes this table.

The returned schema includes the row_id field first, followed by user fields. Each user field has its field_id stored in the field metadata (under the “field_id” key) and the name is taken from the catalog when available or falls back to col_<id>.

Source

pub fn schema_recordbatch(&self) -> LlkvResult<RecordBatch>

Return the table schema formatted as an Arrow RecordBatch suitable for pretty printing. The batch has three columns: name (Utf8), field_id (UInt32) and data_type (Utf8).

Source

pub fn stream_columns( &self, logical_fields: impl Into<Arc<[LogicalFieldId]>>, row_ids: Vec<RowId>, policy: GatherNullPolicy, ) -> LlkvResult<ColumnStream<'_, P>>

Create a streaming view over the provided row IDs for the specified logical fields.

Source

pub fn store(&self) -> &ColumnStore<P>

Source

pub fn table_id(&self) -> TableId

Source

pub fn total_rows_for_col(&self, col_id: FieldId) -> Result<u64>

Return the total number of rows for a given user column id in this table.

This delegates to the ColumnStore descriptor for the logical field that corresponds to (table_id, col_id) and returns the persisted total_row_count.

Source

pub fn total_rows(&self) -> Result<u64>

Return the total number of rows for this table.

Prefer reading the dedicated row-id shadow column if present; otherwise fall back to inspecting any persisted user column descriptor.

Auto Trait Implementations§

§

impl<P = MemPager> !Freeze for Table<P>

§

impl<P> RefUnwindSafe for Table<P>
where P: RefUnwindSafe,

§

impl<P> Send for Table<P>

§

impl<P> Sync for Table<P>

§

impl<P> Unpin for Table<P>

§

impl<P> UnwindSafe for Table<P>
where P: RefUnwindSafe,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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
Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,