chore(engine): a relation's table is read through one module, as the join and the grouping a walk names - #1660
Merged
FBumann merged 5 commits intoSep 16, 2026
Conversation
…ends, the grouping and the edge a walk names The role-to-column translation of a Walk was spelled in four places, the walk join in two, and a partition's group key in three. relations.py now holds it once: Ends (the dims a node's walks consume, join on and produce), mapping and walk_join (the one join a group or a pullback makes), Grouping (the walked dimension ranked inside its groups), and keyed (a relation read at its key by a where). reindex builds its axis once per operator and holds the acyclic edge as a type of its own, in place of five functions that each rebuilt the ranked table. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DT1r52zPp9BdnrzFdp1xoY
Documentation build overview
11 files changed ·
|
Merging this PR will not alter performance
Comparing Footnotes
|
…alks Ends duplicated what a node already says as over, into and joined, and keyed named one caller's body; both go. What stays new is the join a group or a pullback trades its dimensions through, and the grouping a partition ranks inside. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DT1r52zPp9BdnrzFdp1xoY
… an axis An axis is what separability asks about upstream; this is the dimension table ranked, axis-wide or within each group, with the two keyed sides of the remap. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DT1r52zPp9BdnrzFdp1xoY
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DT1r52zPp9BdnrzFdp1xoY
…e's word One dimension's own order, or each group's own, as an operator counts along it: the positions, and the two keyed sides of the remap. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DT1r52zPp9BdnrzFdp1xoY
FBumann
added this pull request to stack #1661
September 16, 2026 07:13
FBumann
added a commit
that referenced
this pull request
Sep 16, 2026
…lk joins on (#1663) > **Prompt:** "488 merged and released. Bump mathspec version!" > [!NOTE] > The following content was generated by AI. The pin follows math-spec 0.0.0-alpha.92, the release carrying energy-models/mathspec#488: `GroupSum.joined` and `At.joined`. The two copies of that answer here — `relations.joined_dims` on the relational lane and `builder._joined_dims` on the eager one — are deleted, and both lanes read it off the node. The follow-up #1659 and #1660 named. <details><summary>What moved</summary> - `pyproject.toml` and `uv.lock`: the pin, `v0.0.0-alpha.89` to `v0.0.0-alpha.92`. - `relations.py`: `landed` and `walk_join` take the node rather than its walks, and read `node.joined`; `joined_dims` is gone. - `compiler.py`: `_remap_fragment` takes the node; `_empty_groups` and `_pulled_back_presences` read `g.joined` and `a.joined`. - `linopy/builder.py`: the grouped sum passes `node.joined`; `_joined_dims` is gone. Five files, +26 −40. </details> <details><summary>Verified</summary> `ruff check` · `ruff format --check` · `pyrefly check` · `pytest -q -n 4` on 309422e, with alpha.92 installed: 3772 passed, the same 10 failures as `main` (`gurobi`, `xpress` not installed here). Run in a `uv` venv with the `linopy` extra rather than pixi. **Not run:** `docs-build` and `test-floors`, no pixi environment here. The parity job checks out the corpus at the pinned tag, so it runs against alpha.92 in CI. </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01DT1r52zPp9BdnrzFdp1xoY --- _Generated by [Claude Code](https://claude.ai/code/session_01DT1r52zPp9BdnrzFdp1xoY)_ Co-authored-by: Claude <noreply@anthropic.com>
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.
Note
The following content was generated by AI.
Stacked on #1659. No consumer can tell the difference: the same queries, read through one module and two types instead of a dozen loose functions, in the language's own words — a walk's
consumed,joinedandproduceddimensions, and the order a shift counts along.What the review found. After #1659, the relational lane spelled the same three facts several times over:
Walk's roles became columns in four places —compiler._walked,compiler.partitioned,predicates.join_relationandreindex._group_columns;_remap_fragmentand_pulled_back_presences.pulledboth keyed on consumed, joined and carried-produced dims and landed the rest under their names;reindex._edgerebuilt the ranked table a second time per shift;reindex._Walkhad come to hold aprogram.Walkas a field, under the same name.What moved
relational/engines/polars/relations.py(new) holds the role-to-column translation once:mappingandwalk_join— the table a group or a pullback joins against, and the one join that trades the consumed dims for the produced ones (keyed on consumed, joined, and a produced dim the operand already carries) in a single select, which is what a self-map needs._remap_fragmentis two lines and the pullback's presence step one.Grouping— the walked dimension ranked inside its groups, withkey,keys,placed()andcolumn_of(); replacescompiler.partitioned,reindex._groupedandreindex._group_columns.joined_dims— the one property a node lacks until feat(program): a grouped sum and a pullback say which dimensions their walks join on energy-models/mathspec#488 releases; the pin bump deletes it.consumed_dims,produced_dimsandlandingare gone from the compiler.GROUP_RANK,GROUP_SIZE,group_columnandlandinglive here, out offragments.pyandcompiler.py.reindex.py:_Walkis_Order— one dimension's own order, or each group's own, as an operator counts along it: the positions and the two keyed sides of the remap — built once per operator and holding itsGrouping; the acyclic edge is_Edge, one type withkeys,coordinates(),filled()andvacated_of(), in place of_edge,_filled_edge,_vacated,edge_keysandoffset_dims, and the named offset's table is read once. The prose says dimension where it said axis.predicates.pyreads a grouped position throughGrouping; the relation read keeps its body.compiler.pykeeps the expression walk only.Verified
ruff check·ruff format --check·pyrefly check·pytest -q -n 4on the head: 3772 passed, the same 10 failures as the base (gurobi,xpressnot installed here). No new guard, so no mutation table.Departed from one default: the pass is not fewer lines. Six files, +417 −332 against the base, and the surplus is the docstrings on the two types; what it ends with is fewer concepts and one home per fact.
🤖 Generated with Claude Code
https://claude.ai/code/session_01DT1r52zPp9BdnrzFdp1xoY