mlab-builtins-table-grouping
The groupant beside mlab/src/builtins/table.rs in the Mova repository: what the code computes, what it never does, how to go back from its outputs, its invariants, cost and checks.
Facts
Implementation material. A Mova code model describes this code at one source revision: partial models, finite checks and their stated scope. It is not a reviewed general exposition, and its labels are shown as written, never raised.
Components
| component | label | where |
|---|---|---|
| approximant | partial | approximant |
| ast | partial | ../syntax.json |
| cost | symbolic source derived | invariant |
| descriptant | present | descriptant |
| invariant | partial | invariant |
| tests | partial bounded parent evidence | tests |
Obernants
The typed relations around the forward model: the behaviour complement (what the code never does), the reverse reconstruction (every input compatible with an output) and specialised views.
| id | type | label | where |
|---|---|---|---|
behavior_complement | behavior_complement | partial source derived model | behavior_complement |
reverse_reconstruction | reverse_reconstruction | partial source derived model | reverse_reconstruction |
aggregation_units | aggregation_units | partial source derived model | aggregation_units |
pivot_transport | pivot_transport | partial source derived model | pivot_transport |
branch_relation | branch_relation | partial source derived model | branch_relation |
resource_cost | resource_cost | partial source derived model | resource_cost |
Model text
descriptant
mlab-builtins-table-grouping
agg filters NaNs, count counts original length, mode sorted runs strict greater chooses smallest tie. groupsummary appends GroupCount and method columns; grouptransform scatters group results into original rows. pivot groups row/column keys, count empty0, other empty NaN.
Epoch 2026-10-31: isolated source-bound fragment over bytes [10371,18733); includes no claim beyond this relation. Source hash f1b0959092cfcdd3cbd171a48d252ce4c1e652b1e56ed030c160e7667d8cbb54.
approximant
grouping: forward relation
agg filters NaNs, count counts original length, mode sorted runs strict greater chooses smallest tie. groupsummary appends GroupCount and method columns; grouptransform scatters group results into original rows. pivot groups row/column keys, count empty0, other empty NaN.
Domain: Well-shaped values and finite practical windows; effects delegated to it.fs. Physical filesystem not exercised.
Executable surrogate gap: no measured cheaper implementation with a useful scoped metric is supplied. Categorical/error/effect relations are exact obligations, not percent losses. Future numeric caps only1/2/5/10%.
invariant
grouping: invariant and cost
Sample variance denominator n-1 with singleton0; all-missing variance NaN; count includes missing.
Pivot names derive key text then normalize/dedupe, so column labels lose exact original identifiers.
Scope-specific cost: Group sort O(k*n log n); aggregate sorting methods O(g log g), linear methods O(g); callback cost unknown. Pivot allocates per-row-group cells and column values; deduping generated column names may add O(c³) string comparisons for c colliding names, plus generated/text bytes.
models
behavior_complement
Empty sum0 does not imply empty mean0 (NaN). grouptransform function result length mismatch excludes valid result; fixed zscore singleton divides by0.
reverse_reconstruction
Aggregate values admit many groups including any insertion of NaNs except count/numel/nummissing; summaries do not reconstruct individual rows.
aggregation_units
Sample variance denominator n-1 with singleton0; all-missing variance NaN; count includes missing.
pivot_transport
Pivot names derive key text then normalize/dedupe, so column labels lose exact original identifiers.
branch_relation
agg filters NaNs, count counts original length, mode sorted runs strict greater chooses smallest tie. groupsummary appends GroupCount and method columns; grouptransform scatters group results into original rows. pivot groups row/column keys, count empty0, other empty NaN.
resource_cost
Group sort O(k*n log n); aggregate sorting methods O(g log g), linear methods O(g); callback cost unknown. Pivot allocates per-row-group cells and column values; deduping generated column names may add O(c³) string comparisons for c colliding names, plus generated/text bytes.
tests
Evidence boundary
See ../tests.md for the actual selected source test and mutant. These tests sample the file, not every fragment branch. Empty sum0 does not imply empty mean0 (NaN). grouptransform function result length mismatch excludes valid result; fixed zscore singleton divides by0. Other branches here are source-derived and unexecuted unless the parent test explicitly calls them.
This page in Markdown ā https://md.groupants.elamur.ai/free/en/mova/mlab/src/builtins/table.rs.groupant/grouping.groupant/