Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JEP-19 Evaluation of Pipe Expressions #292

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

springcomp
Copy link

Sub Expression

The specification for sub-expression outlines how it should behave in pseudocode:

left-evaluation = search(left-expression, original-json-document)
result = search(right-expression, left-evaluation)

However, this is incorrect, as many compliance tests expect the result to be null when the left-hand-side evaluates to  null.
So, the real pseudocode shoud in fact be:

left-evaluation = search(left-expression, original-json-document)
if left-evaluation is `null` then result = `null`
else result = search(right-expression, left-evaluation)

Pipe Expression

However, it seems intuitive for pipe-expression to behave as is specified by the pseudocode above.

left-evaluation = search(left-expression, original-json-document)
result = search(right-expression, left-evaluation)

Which means that the evaluation should still happens if the left-hand-side is null.

Summary

This PR introduces a new compliance test that outlines the following expression: search ( `null` | [@], {} ) -> [ null ] in the hope to standardize the exact behaviour of pipe expressions.

@springcomp springcomp changed the title pipe-expression learns to handle null values on its left-hand-side. JEP-19 Evaluation of Pipe Expressions Nov 1, 2022
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.

None yet

1 participant