Commit 4409a00
authored
Feat/4141 gql compliance (#4477)
* test: [#4141] add ISO GQL three-valued (trinary) logic regression matrix
Locks in the existing UNKNOWN/NULL three-valued logic behavior with a
13-case end-to-end regression test covering AND/OR/NOT/XOR null
propagation, comparisons against null, IN with null elements, WHERE
non-match coercion vs RETURN null preservation, and IS NULL concrete
booleans. Confirms ArcadeDB represents UNKNOWN as null-in-boolean-context
per ISO/IEC 39075, so no separate UNKNOWN value type is required.
Related to #4141
* feat: [#4141] reject deprecated Cypher syntax (PERIODIC COMMIT, {param}) with GQL hints
ISO/IEC 39075 (GQL) / Cypher 25 cleanup. Adds a token-stream pre-scan in
Cypher25AntlrParser that rejects removed legacy syntax with a clear,
actionable message instead of a cryptic ANTLR error:
- 'PERIODIC COMMIT' -> use 'CALL { ... } IN TRANSACTIONS [OF n ROWS]'
- legacy '{param}' -> use '$param'
The scan runs on the default token channel so matches inside string
literals/comments are never flagged, distinguishes a legacy '{name}' from
a map projection ('var {name}') and brace-block expressions
(EXISTS/COUNT/COLLECT/CALL { ... }), and excludes numeric '{n}'/'{n,m}'
quantified-path-pattern quantifiers. CypherStatementCache no longer
double-wraps CommandParsingException so the hint surfaces at top level.
Related to #4141
* test: [#4141] verify GQL grouping-key enforcement; surface validation errors
Adds regression coverage for ISO GQL explicit-grouping rules: explicit
single/multiple grouping keys work, an aggregation mixed with a grouping
key is allowed, and an aggregation mixed with a non-grouping reference is
rejected as 'AmbiguousAggregationExpression' (the enforcement already
lived in CypherSemanticValidator; this proves it). Also covers rejection
of aggregation in WHERE.
Cypher25AntlrParser now rethrows CommandParsingException as-is instead of
burying it under a generic 'Failed to parse Cypher query' wrapper, so
semantic-validation and explicit parse messages surface at top level.
Related to #4141
* refactor: [#4141] address PR review - hot-path pre-filter, idempotent tests
Code review follow-ups for the GQL deprecated-syntax check:
- Add an allocation-free pre-filter to checkDeprecatedSyntax so queries
without '{' or 'PERIODIC' skip the second lex pass entirely (keeps GC
pressure off the parse hot path).
- Move checkDeprecatedSyntax inside the parse try so any unexpected
exception also gets the wrapping context; CommandParsingException is
still re-thrown as-is so hints surface at top level (single control path).
- Document the intentional BRACE_BLOCK_KEYWORDS false-negative and the
PARAM_NAME numeric-exclusion rationale.
- Make the three Issue4141 test setUp methods idempotent (drop a leftover
db from an interrupted run) to avoid flaky re-runs on a dirty workspace.
- Add brace-block false-positive tests (EXISTS { }, COUNT { }) and a note
on the sorting helper in the trinary-logic test.
Related to #4141
* refactor: [#4141] single-lex deprecated-syntax scan; close map-projection false positive
Second review round on the deprecated-syntax check:
- Reuse the main parse's token stream instead of re-lexing, and walk it with
a 3-token sliding window (no intermediate ArrayList) - removes the
double-lex and the extra list allocation on the parse hot path.
- Replace the name-token guard with a value-operator allowlist: a legacy
'{name}' is only flagged when the '{' follows an operator/punctuation
(=, comparison, arithmetic, ',', '(', '['), where a map projection is
impossible. This closes the false positive on 'type{name}' where the
projected-on variable is a keyword token (NAME/TYPE are legal variable
names); the cost is only a harmless false negative after a keyword.
- Trim what-comments per CLAUDE.md, keeping the non-obvious WHYs.
- Align test import ordering with the project convention; add tests for the
keyword-named-variable projection and for 'PERIODIC COMMIT' inside a
string literal.
Related to #41411 parent a9734ca commit 4409a00
5 files changed
Lines changed: 591 additions & 4 deletions
File tree
- engine/src
- main/java/com/arcadedb/query/opencypher
- parser
- query
- test/java/com/arcadedb/query/opencypher
Lines changed: 77 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
| |||
45 | 48 | | |
46 | 49 | | |
47 | 50 | | |
48 | | - | |
49 | 51 | | |
50 | | - | |
51 | | - | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
55 | 59 | | |
56 | 60 | | |
57 | 61 | | |
| |||
90 | 94 | | |
91 | 95 | | |
92 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
93 | 101 | | |
94 | 102 | | |
95 | 103 | | |
96 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
97 | 170 | | |
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
82 | 85 | | |
83 | 86 | | |
84 | 87 | | |
| |||
Lines changed: 169 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
0 commit comments