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
Filtersemantics asfilter_rows, without cloning anyRow.indicesis the (possibly sorted) permutation; it is retained in place, dropping indices whose row does not match. - filter_
rows - Filter rows by the
Filterexpression, as a case-insensitive substring match over every cell’s text. ANone/empty expression keeps all rows. This is the cheap, predictable form of theFiltercontract; 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
SortSpecsemantics assort_rows, but without cloning anyRow. This is the allocation-conscious form used by the informer-backedMemPlane: the caller holds&[Row]and sortsindicesinto it, so a 50k-row query sorts 50kusizes instead of deep-cloning 50kRows (M1.8). - sort_
rows - Sort rows by the given
SortSpec, resolvingcolumnagainst thecolumn_idsschema (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.