Repository navigation
DDIR explain: keep the user's key and value whole in demand rows - #929
Merged
Merged
Conversation
Explain's demand rows spliced the user's value into one flat tuple with the iteration chain and query id: `(K ; V fields…, chain…, q)`. That needed each collection's field counts, which explain read from projection syntax, and it broke user terms that read a whole row. An always-true `filter($1 == tuple($1[0]))` gave an insufficient explanation, a flatmap list reading `$0` saw explain's (key, row) pair, a projection given as one term counted as one field whatever its shape, and keys or values that are not products were read by field position. Demand rows are now `(K ; (V, chain…, q))`, with the user's key and value whole. No rule takes them apart, so explain needs no shapes or field counts: the syntax-based counting and every width parameter of the reverse rules are gone. User terms read `$0` as the key and `$1` as the value's first field. A scope's own sites are wrapped as `(V)` before their first lift, so lifts give `(V, chain…)`; root-level host forms and sources enter the explain scope as `(K ; (V))`. Demand sets stay the user's rows, for the forward clone and the exports. `explain` and `explain_with` take no source shapes, and `source_arities` and `export_shape` are removed. A query row is `(key ; (val, q))`. The server's load option is `explain` or `explain=debug`; the arity is no longer needed. The demand-excess report is unchanged from before, row for row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
frankmcsherry
force-pushed
the
explain-shapes
branch
from
October 11, 2026 01:08
9044e80 to
adf1ec2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explain's demand rows spliced the user's value into one flat tuple with the iteration chain and query id,
(K ; V fields…, chain…, q).That required each collection's field counts, which explain read from projection syntax, and it broke in several ways:
filter($1 == tuple($1[0]))gave an insufficient explanation, and a flatmap list reading$0saw explain's (key, row) pair, so the rewritten program failed to install.value($1), and corgi lambdas to come) counted as one field whatever its shape.intsource,value($1 * 2), acollectlist) were read by field position.Change
Demand rows are now
(K ; (V, chain…, q)): the user's key and value whole, then the chain, thenq. No rule takesKorVapart, so explain needs no shapes or field counts.RowModeland the reverse rules are gone.$0as the key and$1as the value's first field (with_rows).(V)before their first lift, so the lifts give(V, chain…). Root-level host forms and sources enter the explain scope as(K ; (V)).Interface
explain(p)/explain_with(p, options)take no source shapes;source_aritiesandexport_shapeare removed.(key ; (val, q)).explainorexplain=debug(wasexplain=<arity>[,debug]); README updated.dump_explaintakes no arity.explain/mod.rsgoes from 1112 to 973 lines.Tests
whole_row_explanations_sufficient_small: a whole-row filter and a flatmap reading$0.scalar_explanations_sufficient_small,corgi_agrees_on_scalar_explanation: scalar source keys and values, a scalar value and a list at the root, scalar keys in an iterative scope.report_demand_excessprints the same demand sizes as master-next, row for row.cargo test -p interactive --lib --tests, explain's ignored sweeps (--ignored), and theddir-servertests pass.🤖 Generated with Claude Code