Skip to main content

Module table

Module table 

Source
Expand description

Table-query semantics — the renderer-agnostic sort/filter that every DataPlane implementation shares (ADR-0005).

This is where “sorting and filtering” live, not in a frontend and not duplicated in kaptein-core. A DataPlane maps its rows to Vec<Row> + a column-id schema, then hands the Query (sort + filter + window) to these functions. The result is a bounded Page, never a full materialization.

Functions§

cell_text
The display text of a cell, used for substring filtering and as the fallback sort key.
cmp_cells
Total order across heterogeneous cells. Numbers compare numerically, timestamps chronologically, everything else lexically by display text.
filter_indices
Filter a permutation of row indices by the same Filter semantics as filter_rows, without cloning any Row. indices is the (possibly sorted) permutation; it is retained in place, dropping indices whose row does not match.
filter_rows
Filter rows by the Filter expression, as a case-insensitive substring match over every cell’s text. A None/empty expression keeps all rows. This is the cheap, predictable form of the Filter contract; the full expression language lands with the lens engine (Phase 2) — but the shape is already a serializable string.
sort_indices
Sort a permutation of row indices by the same SortSpec semantics as sort_rows, but without cloning any Row. This is the allocation-conscious form used by the informer-backed MemPlane: the caller holds &[Row] and sorts indices into it, so a 50k-row query sorts 50k usizes instead of deep-cloning 50k Rows (M1.8).
sort_rows
Sort rows by the given SortSpec, resolving column against the column_ids schema (column id → cell index). An unknown column leaves order unchanged (stable). The sort is stable, so equal keys keep their identity order — deterministic across frontends and in headless/CI.