Problem
Any GROUP in the context-independent form (with BY) that uses TOP / OFFSET fails at startup with a param count mismatch:
someInt = DATA INTEGER ();
firstPaymentPeriod(PaymentCondition c) = GROUP LAST PaymentPeriod p ORDER DESC p TOP someInt() OFFSET someInt() BY paymentCondition(p);
PaymentCondition:51:135 3 parameter(s) expected, 2 provided
Even the documented example fails the same way (GROUP_operator.md):
last3HostGoalsScored(team) = GROUP SUM hostGoals(Game game) ORDER DESC date(game), game TOP 3 BY hostTeam(game);
This is not a v6 -> master regression: the whole chain (addOGProp, the selectTop join block in addScriptedCDIGProp) is identical on both branches, so v6 fails identically. Only the dependent form (without BY) works.
Cause
addOGProp appends the TOP / OFFSET window interfaces as extra interfaces of the group property, so its interface count is |BY keys| + |window params| (plus the used outer params). But the join in ScriptingLogicsModule.addScriptedCDIGProp that binds the window interfaces to the TOP / OFFSET expressions builds its mapping from the result interfaces and the TOP / OFFSET expressions only — the group (BY) keys are omitted, hence expected = resultInterfaces + BY + window vs provided = resultInterfaces + window.
Fix
Build the join mapping with an entry per group interface, mirroring the getAllGroupProps interleave: the result interfaces are bound to their params as before, and the group (BY) keys stay free params at their positions, so the joined property keeps the group interfaces (and the signature order). The params of the TOP / OFFSET expressions are included in the result interfaces computation, so an expression referencing an outer param gets a consistent implicit interface. In the dependent form (without BY) the mapping is built exactly as before.
Problem
Any
GROUPin the context-independent form (withBY) that usesTOP/OFFSETfails at startup with a param count mismatch:Even the documented example fails the same way (
GROUP_operator.md):This is not a v6 -> master regression: the whole chain (
addOGProp, the selectTop join block inaddScriptedCDIGProp) is identical on both branches, so v6 fails identically. Only the dependent form (withoutBY) works.Cause
addOGPropappends theTOP/OFFSETwindow interfaces as extra interfaces of the group property, so its interface count is|BY keys| + |window params|(plus the used outer params). But the join inScriptingLogicsModule.addScriptedCDIGPropthat binds the window interfaces to theTOP/OFFSETexpressions builds its mapping from the result interfaces and theTOP/OFFSETexpressions only — the group (BY) keys are omitted, henceexpected = resultInterfaces + BY + windowvsprovided = resultInterfaces + window.Fix
Build the join mapping with an entry per group interface, mirroring the
getAllGroupPropsinterleave: the result interfaces are bound to their params as before, and the group (BY) keys stay free params at their positions, so the joined property keeps the group interfaces (and the signature order). The params of theTOP/OFFSETexpressions are included in the result interfaces computation, so an expression referencing an outer param gets a consistent implicit interface. In the dependent form (withoutBY) the mapping is built exactly as before.