Skip to content

Fix ? and ?? operators with array predicate on LHS#108

Merged
uw4 merged 1 commit intomainfrom
backport-operator-fixes
May 5, 2026
Merged

Fix ? and ?? operators with array predicate on LHS#108
uw4 merged 1 commit intomainfrom
backport-operator-fixes

Conversation

@uw4
Copy link
Copy Markdown
Contributor

@uw4 uw4 commented May 4, 2026

Upstream changes ported: jsonata-js/jsonata#774 jsonata-js/jsonata#780

Requires deep clone of (parts of) the AST, thus had to make it serializable to be able to mimic the JS solution with JSON.parse+stringify

Fixes the new operator unit tests from upstream jsonata

Upstream changes ported:
jsonata-js/jsonata#774
jsonata-js/jsonata#780

Requires deep clone of (parts of) the AST, thus had to make it serializable to be able to mimic the JS solution with JSON.parse+stringify

Fixes the new operator unit tests from upstream jsonata
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

Test Results

1 748 tests  ±0   1 745 ✅ ±0   5s ⏱️ -1s
  120 suites ±0       3 💤 ±0 
  120 files   ±0       0 ❌ ±0 

Results for commit c6e6822. ± Comparison against base commit fbb6878.

@uw4 uw4 self-assigned this May 4, 2026
@uw4 uw4 requested a review from aeberhart May 4, 2026 17:10
@uw4
Copy link
Copy Markdown
Contributor Author

uw4 commented May 5, 2026

Notes after review:

  • The fixes require to deep clone (part of) the AST. Goal was to not introduce an additional lib dependency (if possible)

  • JSON output requires a third party lib

  • XML requires 3rd party lib, or using the BeanSerializer which would require to beanify all objects (lots of boilerplate)

  • Serialization is natural choice

Serialization for deep clone:

  • Required only marking the class(es) with the Serializable interface, then we could use existing Parser.clone
  • Adding Serializable interface to classes is bytecode compatible and source compatible.
  • Objects are considered internal, and should not be persisted, thus no versioning with serialVersionUID
  • Performance is OK
    Size in bytes per clone ~20KB, speed is >3000 clone ops per second (on dev notebook, measured with the new test cases)
    This shouldn't be measurable for most use cases, given that clones are only triggered whenever an operator is parsed

@uw4 uw4 merged commit 08664b6 into main May 5, 2026
2 checks passed
@uw4 uw4 modified the milestone: 0.9.10 May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant