parser: existential subquery brace form EXISTS { pattern } (+2 TCK) - #86
Merged
Conversation
`MATCH (n) WHERE exists { (n)-->() } RETURN n` (ExistentialSubquery1 [1]/[3])
raised a parse error — only the parenthesized `EXISTS(pattern)` form was
accepted, not the openCypher existential-subquery brace form `EXISTS { ... }`.
Added `EXISTS '{' pattern_list '}'` to the expr grammar, reusing the existing
`make_exists_pattern_expr` / `EXISTS_TYPE_PATTERN` transform. That emitter
already handles correlated outer variables (the outer-bound `n` resolves via
transform_var_get_alias and is referenced without being added to the subquery
FROM), producing `EXISTS (SELECT 1 FROM ... WHERE ...)`.
No bison conflicts (still `%expect 15` / `%expect-rr 3`).
Scoped to the no-inner-WHERE form. The brace form with an inner WHERE
([2]/[4]) and the full-query / aggregation / nested forms
(ExistentialSubquery2/3) need inner-variable registration in the subquery
scope and are deferred.
Fixes ExistentialSubquery1 [1] and [3]. Zero TCK regressions. 3708 -> 3710.
Unit 944/944, functional clean.
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.
`MATCH (n) WHERE exists { (n)-->() } RETURN n` (ExistentialSubquery1 [1]/[3]) raised a parse error — only the parenthesized `EXISTS(pattern)` form was accepted, not the openCypher existential-subquery brace form `EXISTS { ... }`.
Fix
Added `EXISTS '{' pattern_list '}'` to the expr grammar, reusing the existing `make_exists_pattern_expr` / `EXISTS_TYPE_PATTERN` transform. That emitter already handles correlated outer variables — the outer-bound `n` resolves via `transform_var_get_alias` and is referenced without being added to the subquery FROM, producing `EXISTS (SELECT 1 FROM ... WHERE ...)`.
No bison conflicts (still `%expect 15` / `%expect-rr 3`).
Scope
No-inner-WHERE form only. The brace form with an inner WHERE ([2]/[4]) and the full-query / aggregation / nested forms (ExistentialSubquery2/3) need inner-variable registration in the subquery scope — deferred to a follow-up.
Verification
Fixes ExistentialSubquery1 [1] and [3]. Zero TCK regressions (fail steady at 132). 3708 → 3710. Unit 944/944, functional clean.