You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Revert "Fix issue 1955 - List comprehension in WHERE clause (apache#2094)"
This reverts commit 0f0d9be.
* Revert "Fix error using list comprehension with WITH * (apache#1838)"
This reverts commit 5e08a2f.
* Revert "Fix shift/reduce conflict in grammar (apache#1719)"
This reverts commit fab3119.
* Revert "Implement list comprehension (apache#1610)"
This reverts commit 3b2b394.
* Reimplement list comprehension
- Reimplement list comprehension to use ARRAY sublinks.
- Some test results were not correct. All the test results that are
modified are correct and are verified with neo4j.
- Also resolves the issue of using list comprehension in MERGE clause (1611)
and issue 1850
* Add expression tree walkers for cypher nodes
- Added cypher_raw_expr_tree_walker and cypher_expr_tree_walker, based
on Postgres's raw_expression_tree_walker and expression_tree_walker.
These follow the same walker API as Postgres and add support for
Cypher-specific nodes.
- Also added the agtype[] to agtype func and typecast to 1.5.0-y.y.y.sql
- Simplifies logic for cypher_subquery handling in where clause.
- Fixes a crash when list comprehension in the WHERE clause references a
variable from the preceding MATCH clause.
SELECT * FROM cypher('list_comprehension', $$ CREATE (u {list:[i IN range(12,24,2)]}) RETURN u $$) AS (result agtype);
@@ -371,26 +376,26 @@ SELECT * FROM cypher('list_comprehension', $$ MATCH(u) WITH u WHERE u.list = [u
371
376
SELECT * FROM cypher('list_comprehension', $$ MATCH(u) WITH u WHERE u.list = [u IN [0, 2, 4, 6, 8, 10, 12]] OR size(u.list) = 0 RETURN u $$) AS (u agtype);
SELECT * FROM cypher('list_comprehension', $$ MATCH(u) WITH u WHERE u.list = [u IN [0, 2, 4, 6, 8, 10, 12]] OR size(u.list)::bool RETURN u $$) AS (u agtype);
SELECT * FROM cypher('list_comprehension', $$ MATCH(u) WITH u WHERE u.list = [u IN [0, 2, 4, 6, 8, 10, 12]] OR NOT size(u.list)::bool RETURN u $$) AS (u agtype);
SELECT * FROM cypher('list_comprehension', $$ CREATE (u {list: [0, 2, 4, 6, 8, 10, 12]}) $$) AS (result agtype);
691
+
result
692
+
--------
693
+
(0 rows)
694
+
695
+
SELECT * FROM cypher('list_comprehension', $$ WITH [1, 2, 3] AS u UNWIND collect(u) AS v RETURN v $$) AS (result agtype);
696
+
ERROR: Invalid use of aggregation in this context
697
+
LINE 1: ...ist_comprehension', $$ WITH [1, 2, 3] AS u UNWIND collect(u)...
698
+
^
699
+
SELECT * FROM cypher('list_comprehension', $$ MATCH (u {list: [0, 2, 4, 6, 8, 10, 12]}) WITH u, collect(u.list) AS v SET u += {b: [u IN range(0, 5)]} SET u.c = [u IN v[0]] RETURN u $$) AS (result agtype);
SELECT*FROM cypher('list_comprehension', $$ MATCH(u {list: [0, 2, 4, 6, 8, 10, 12]}) SETu.c= collect(u.list) RETURN u $$) AS (u agtype);
119
119
120
-
-- Known issue
121
-
SELECT*FROM cypher('list_comprehension', $$ MERGE (u {list:[i IN [1,2,3]]}) RETURN u $$) AS (result agtype);
122
-
123
120
-- List comprehension variable scoping
124
121
SELECT*FROM cypher('list_comprehension', $$ WITH 1AS m, [m IN [1, 2, 3]] AS n RETURN [m IN [1, 2, 3]] $$) AS (result agtype);
125
122
SELECT*FROM cypher('list_comprehension', $$ WITH 1AS m RETURN [m IN [1, 2, 3]], m $$) AS (result agtype, result2 agtype);
@@ -164,5 +161,18 @@ SELECT * FROM cypher('list_comprehension', $$ MATCH (u) WHERE size([e in u.list
164
161
SELECT*FROM cypher('list_comprehension', $$ MATCH (u ={list:[i INu.list | i+1]}) RETURN u $$) AS (result agtype);
165
162
SELECT*FROM cypher('list_comprehension', $$ MATCH (u ={list:[i INu.listWHERE i>0]}) RETURN u$$) AS (result agtype);
166
163
164
+
-- List comprehension in MERGE
165
+
SELECT*FROM cypher('list_comprehension', $$ MERGE (u {list:[i IN [1,2,3]]}) RETURN u $$) AS (result agtype);
166
+
SELECT*FROM cypher('list_comprehension', $$ MERGE (u ={list:[i IN [1,2,3] WHERE i>1]}) RETURN u $$) AS (result agtype);
167
+
SELECT*FROM cypher('list_comprehension', $$ MERGE (u ={list:[i IN [1,2,3] WHERE i>1 | i^2]}) RETURN u $$) AS (result agtype);
168
+
169
+
-- Issue 1850
170
+
SELECT*FROM cypher('list_comprehension', $$ CREATE (u {list: [0, 2, 4, 6, 8, 10, 12]}) $$) AS (result agtype);
171
+
SELECT*FROM cypher('list_comprehension', $$ WITH [1, 2, 3] AS u UNWIND collect(u) AS v RETURN v $$) AS (result agtype);
172
+
SELECT*FROM cypher('list_comprehension', $$ MATCH (u {list: [0, 2, 4, 6, 8, 10, 12]}) WITH u, collect(u.list) AS v SET u += {b: [u IN range(0, 5)]} SETu.c= [u IN v[0]] RETURN u $$) AS (result agtype);
173
+
SELECT*FROM cypher('list_comprehension', $$ MATCH (u {list: [0, 2, 4, 6, 8, 10, 12]}) SETu.c= collect(u.list) RETURN u $$) AS (u agtype);
174
+
SELECT*FROM cypher('list_comprehension', $$ MATCH (u {list: [0, 2, 4, 6, 8, 10, 12]}) WHEREu.list= [u IN [1, u]] RETURN u $$) AS (u agtype);
175
+
SELECT*FROM cypher('list_comprehension', $$ MATCH (u {list: [0, 2, 4, 6, 8, 10, 12]}) WHEREu.listIN [u IN [1, u.list]] RETURN u $$) AS (u agtype);
0 commit comments