M6e: recursive tuple-stream detection (focus/index under sort/predicate)#22
Merged
Conversation
…redicate The tuple-mode scan and path_is_tuple only checked top-level steps, so a focus (@$v) or index (#$v) step nested inside a sub-path — as a ^(sort) or a [predicate] wraps it — was missed, and the path skipped eval_path_tuple entirely (bindings lost, result null). Make path_is_tuple recurse into nested path steps (mirroring path_keeps_array), use it for the dispatch decision, and route a self-contained nested tuple sub-path through eval_path_tuple(...,true) in the seeding so its bindings survive (the gap M6c left in seeding; the main loop already did this). Fixes joins/employee-map-reduce 7,8 (sort-on-focus) + sorting/case020. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ro 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
Root-cause fix (via systematic debugging) for the last sort-on-focus joins failures. The tuple-mode detection was non-recursive: a
^(sort)or[predicate]nests a@$v/#$vstep into a sub-path, so no top-level step carried.tupleand the whole path skippedeval_path_tupleentirely → tuple bindings lost →null.fe18f86), mirroring the already-recursivepath_keeps_array:path_is_tuplenow recurses into nested path steps.path_is_tuple(node)instead of a one-level scan.eval_path_tuple(…, true)so its bindings survive (the gap M6c left in seeding; the main loop already did this).038f860): regen, additions-only.Results
employee-map-reduce/7,8(sort-on-focus) plus a bonussorting/case020(a general correctness fix, not a 2-case patch).%-parent / sorting / transform unaffected).Remaining joins gaps (deferred)
The reorder cases (
$[[1..4]]#$pos[$pos>=2],$^($)#$pos[$pos<3]— filter/sort before#) still need jsonata's ordered-stagesmachinery.Test plan
busted spec/— 491/0busted spec/jsonata_suite_spec.lua— zero-regression guard greenbash scripts/run-suite.sh— 1249/1682, joins 38/43🤖 Generated with Claude Code