M6d: tuple-stream group-by — the reduce half of joins#21
Merged
Conversation
…n {…}
eval_group_step gains a tuple_mode: the key sees a per-tuple frame and the
grouped data holds tuples; the value evaluates against a reduced/merged tuple
(its @ is the group context, its bindings the appended members). The group
branch in eval_path_tuple passes tuples through instead of collapsing to
@-values. Non-tuple group-by is unchanged.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…o regressions Co-Authored-By: Claude Opus 4.8 <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.
Summary
Ports JSONata v2.2.1's
reduceTupleStreamso the{…}group-by operator propagates tuple-stream bindings ($e/$c/$ifrom@$v/#$v) into its key/value expressions — the "reduce" half of map-reduce joins (M6c delivered the "map" half).c3e3c84): two helpers —tuple_append(jsonatafn.append) andreduce_tuple_stream(merge a group's tuples, appending each binding so$cbecomes every contact in the group; a 1-member group keeps the scalar).eval_group_stepgains atuple_mode: the key is evaluated with a per-tuple frame; the value is evaluated against the merged tuple's@(group context) under a frame binding the merged members (so both$join($c.Phone.number)and barePhone.numbervalue shapes work). Theeval_path_tuplegroup branch passes tuples through instead of collapsing to@-values. The non-tuple group-by path is byte-identical.1930760): official-suite regen, zero regressions.Results
joinsgroup 27 → 36/43 (employee-map-reduce1–6,9,10 + the index group-by case).group-by/transform/sortingbyte-identical —eval_group_step's non-tuple path is unchanged).^($)sort, index group-by, D1009/T1003. On the empty-tuple-stream edge we return{}while jsonata-js throws an uncaughtTypeError(upstream bug) — we keep the graceful result.Deferred (the remaining joins gaps)
Employee@$e^($e.Surname)…): a separate sort-tuple-stream bug (we returnnull, no crash).#(ordered-stages).Test plan
busted spec/— 488/0busted spec/jsonata_suite_spec.lua— zero-regression guard greenbash scripts/run-suite.sh— 1246/1682, joins 36/43🤖 Generated with Claude Code