You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A partition regroups when its relation gains a value column, because within= defaults to all of them #538
The following content was generated by AI, from a session that found this while writing the relation rules down (#537).
What happens
within= is optional on shift, sum_back and position. Omitted, it means every value column of the relation. So adding a value column to a relation silently changes the grouping of every partition call that left within= out:
cal: { key: hour, values: day } # shift(p, along=hour, offset=1, edge=0, by=cal) groups by ('day',)cal: { key: hour, values: [day, week] } # the same call now groups by ('day', 'week')
Both were run on f4c4ec0 and the grouping read off the lowered program's partition.produced.
Why it matters
It breaks the first of the rules agreed for relations, which #537 writes into dimensions.md:
Adding a value column is safe. A relation that gains one changes no existing call. A call names both of its ends, and a value column it does not name is not read.
That guarantee is exactly what #532 bought for sum and at, by making over= and into= mandatory whenever by= is present. The reason it gave is the same one that applies here:
A call names both of its ends, so that a relation may gain a value column without changing what this call means.
The partition operators kept the implicit default, so they are the one place the rule does not hold. A model that adds a week column to its calendar to serve a new within=week call changes the meaning of every existing shift through that calendar, with nothing failing to load.
The fix, as far as this issue proposes one
Make within= required when by= is present, which is the with_relation mechanism sum and at already use in operators.py. by= itself stays optional: a partition-free shift is unaffected.
This breaks files that rely on the default. On the alpha stream that is a rename with no deprecation, per AGENTS.md, and the closed call shape's own error names the rewrite.
Worth deciding alongside it: whether within= naming all the value columns should stay spelled out, or whether a partition should name its group columns the way sum names into=.
Not in scope
position(d, by=l) takes the same within= through its into argument and has the same default, so it moves with whatever is decided here.
Activity
docs(language): what each end of a call may name, and how far the rul…
feat(language): a partition names the value columns it groups by, so …
docs(language): relations get a page of their own, and the operators …