From 8993ce21647f00d029fdc6c7cf997f6a0c443cf2 Mon Sep 17 00:00:00 2001 From: xtcyclist <7731943+xtcyclist@users.noreply.github.com> Date: Wed, 18 Jan 2023 00:25:19 +0800 Subject: [PATCH 1/6] report errors on where clauses in optional match queries. --- src/parser/parser.yy | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/parser/parser.yy b/src/parser/parser.yy index 966e81c6f77..5f8d462cd5d 100644 --- a/src/parser/parser.yy +++ b/src/parser/parser.yy @@ -1682,7 +1682,11 @@ match_clause $$ = new MatchClause($2, $3, false/*optional*/); } | KW_OPTIONAL KW_MATCH match_path_list where_clause { - $$ = new MatchClause($3, $4, true); + if ($4 != nullptr) { + throw nebula::GraphParser::syntax_error(@4, "Where clause in optional match is not supported."); + } else { + $$ = new MatchClause($3, nullptr, true); + } } ; From 8d6ae0203422387b3f23ec3cda156623cbd724df Mon Sep 17 00:00:00 2001 From: xtcyclist <7731943+xtcyclist@users.noreply.github.com> Date: Wed, 18 Jan 2023 00:37:50 +0800 Subject: [PATCH 2/6] update tck. --- tests/tck/features/match/MatchById.feature | 2 +- .../match/MultiLineMultiQueryParts.feature | 92 +++++-------------- .../features/match/MultiQueryParts.feature | 50 +++++----- .../optimizer/PrunePropertiesRule.feature | 31 +++---- .../Read.feature | 6 +- .../interactive_workload/ComplexReads.feature | 3 +- 6 files changed, 69 insertions(+), 115 deletions(-) diff --git a/tests/tck/features/match/MatchById.feature b/tests/tck/features/match/MatchById.feature index c679c7d6486..f53e3ed01b4 100644 --- a/tests/tck/features/match/MatchById.feature +++ b/tests/tck/features/match/MatchById.feature @@ -1031,7 +1031,7 @@ Feature: Match By Id """ OPTIONAL MATCH (n) OPTIONAL MATCH (n) WHERE id(n) == 'James Harden' RETURN n """ - Then a ExecutionError should be raised at runtime: Scan vertices or edges need to specify a limit number, or limit number can not push down. + Then a SyntaxError should be raised at runtime: Where clause in optional match is not supported. near `WHERE id(n) == 'James Harden'' When executing query: """ MATCH (v1)-[:like]->(v2:player)-[:serve]->(v3) diff --git a/tests/tck/features/match/MultiLineMultiQueryParts.feature b/tests/tck/features/match/MultiLineMultiQueryParts.feature index 7f1c72a40ca..1f0030c2831 100644 --- a/tests/tck/features/match/MultiLineMultiQueryParts.feature +++ b/tests/tck/features/match/MultiLineMultiQueryParts.feature @@ -197,103 +197,63 @@ Feature: Multi Line Multi Query Parts OPTIONAL MATCH (n)-[]->(l) WHERE id(n)=="Tony Parker" RETURN id(m) AS m, id(n) AS n, id(l) AS l; """ - Then the result should be, in any order: - | m | n | l | - | "Tim Duncan" | "Spurs" | NULL | - | "Tim Duncan" | "LaMarcus Aldridge" | NULL | - | "Tim Duncan" | "Tony Parker" | "Spurs" | - | "Tim Duncan" | "Tony Parker" | "LaMarcus Aldridge" | - | "Tim Duncan" | "Tony Parker" | "LaMarcus Aldridge" | - | "Tim Duncan" | "Tony Parker" | "Kyle Anderson" | - | "Tim Duncan" | "Tony Parker" | "Tim Duncan" | - | "Tim Duncan" | "Tony Parker" | "Tim Duncan" | - | "Tim Duncan" | "Tony Parker" | "Manu Ginobili" | - | "Tim Duncan" | "Tony Parker" | "Manu Ginobili" | - | "Tim Duncan" | "Tony Parker" | "Hornets" | - | "Tim Duncan" | "Tony Parker" | "Spurs" | - | "Tim Duncan" | "Tony Parker" | "LaMarcus Aldridge" | - | "Tim Duncan" | "Tony Parker" | "LaMarcus Aldridge" | - | "Tim Duncan" | "Tony Parker" | "Kyle Anderson" | - | "Tim Duncan" | "Tony Parker" | "Tim Duncan" | - | "Tim Duncan" | "Tony Parker" | "Tim Duncan" | - | "Tim Duncan" | "Tony Parker" | "Manu Ginobili" | - | "Tim Duncan" | "Tony Parker" | "Manu Ginobili" | - | "Tim Duncan" | "Tony Parker" | "Hornets" | - | "Tim Duncan" | "Danny Green" | NULL | - | "Tim Duncan" | "Manu Ginobili" | NULL | - | "Tim Duncan" | "Manu Ginobili" | NULL | + Then a SyntaxError should be raised at runtime: Where clause in optional match is not supported. near `WHERE id(n)=="Tony Parker"' When executing query: """ OPTIONAL match (v:player) WHERE v.player.age > 41 MATCH (v:player) WHERE v.player.age>40 RETURN count(*) AS count """ - Then the result should be, in order: - | count | - | 7 | + Then a SyntaxError should be raised at runtime: Where clause in optional match is not supported. near `WHERE v.player.age > 41' When executing query: """ - OPTIONAL match (v:player) WHERE v.player.age>43 + OPTIONAL match (v:player) WHERE v.player.age > 43 MATCH (n:player) WHERE n.player.age>40 RETURN count(*) AS count """ - Then the result should be, in order: - | count | - | 32 | + Then a SyntaxError should be raised at runtime: Where clause in optional match is not supported. near `WHERE v.player.age > 43' When executing query: """ - OPTIONAL MATCH (v:player) WHERE v.player.age > 40 and v.player.age<46 + OPTIONAL MATCH (v:player) WHERE v.player.age > 40 and v.player.age < 46 MATCH (v:player) WHERE v.player.age>43 RETURN count(*) AS count """ - Then the result should be, in any order: - | count | - | 2 | + Then a SyntaxError should be raised at runtime: Where clause in optional match is not supported. near `WHERE v.player.age > 40 and v.player.age < 46' When executing query: """ - MATCH (v:player) WHERE v.player.age > 40 and v.player.age<46 - OPTIONAL MATCH (v:player) WHERE v.player.age>43 + MATCH (v:player) WHERE v.player.age > 40 and v.player.age < 46 + OPTIONAL MATCH (v:player) WHERE v.player.age > 43 RETURN count(*) AS count """ - Then the result should be, in any order: - | count | - | 6 | + Then a SyntaxError should be raised at runtime: Where clause in optional match is not supported. near `WHERE v.player.age > 43' When executing query: """ OPTIONAL MATCH (v:player) WHERE v.player.age > 40 and v.player.age<46 OPTIONAL MATCH (v:player) WHERE v.player.age>43 RETURN count(*) AS count """ - Then the result should be, in any order: - | count | - | 6 | + Then a SyntaxError should be raised at runtime: Where clause in optional match is not supported. near `WHERE v.player.age > 40 and v.player.age<46' When executing query: """ - OPTIONAL MATCH (v:player) WHERE v.player.age>43 + OPTIONAL MATCH (v:player) WHERE v.player.age > 43 MATCH (v:player) WHERE v.player.age > 40 and v.player.age<46 RETURN count(*) AS count """ - Then the result should be, in any order: - | count | - | 2 | + Then a SyntaxError should be raised at runtime: Where clause in optional match is not supported. near `WHERE v.player.age > 43' When executing query: """ - MATCH (v:player) WHERE v.player.age>43 - OPTIONAL MATCH (v:player) WHERE v.player.age > 40 and v.player.age<46 + MATCH (v:player) WHERE v.player.age > 43 + OPTIONAL MATCH (v:player) WHERE v.player.age > 40 and v.player.age < 46 RETURN count(*) AS count """ - Then the result should be, in any order: - | count | - | 4 | + Then a SyntaxError should be raised at runtime: Where clause in optional match is not supported. near `WHERE v.player.age > 40 and v.player.age < 46' When executing query: """ - OPTIONAL MATCH (v:player) WHERE v.player.age>43 - OPTIONAL MATCH (v:player) WHERE v.player.age > 40 and v.player.age<46 + OPTIONAL MATCH (v:player) WHERE v.player.age > 43 + OPTIONAL MATCH (v:player) WHERE v.player.age > 40 and v.player.age < 46 RETURN count(*) AS count """ - Then the result should be, in any order: - | count | - | 4 | + Then a SyntaxError should be raised at runtime: Where clause in optional match is not supported. near `WHERE v.player.age > 43' # When the input of argument is NULL When executing query: """ @@ -370,22 +330,18 @@ Feature: Multi Line Multi Query Parts | 12 | When executing query: """ - OPTIONAL match (v:player) WHERE v.player.age>43 WITH v + OPTIONAL match (v:player) WHERE v.player.age > 43 WITH v MATCH (v:player) WHERE v.player.age>40 WITH v RETURN count(*) AS count """ - Then the result should be, in order: - | count | - | 4 | + Then a SyntaxError should be raised at runtime: Where clause in optional match is not supported. near `WHERE v.player.age > 43' When executing query: """ - OPTIONAL match (v:player) WHERE v.player.age>43 WITH v + OPTIONAL match (v:player) WHERE v.player.age > 43 WITH v MATCH (n:player) WHERE n.player.age>40 WITH v, n RETURN count(*) AS count """ - Then the result should be, in order: - | count | - | 32 | + Then a SyntaxError should be raised at runtime: Where clause in optional match is not supported. near `WHERE v.player.age > 43' When executing query: """ MATCH (a:player{age:42}) WITH a @@ -411,10 +367,10 @@ Feature: Multi Line Multi Query Parts OPTIONAL MATCH (n)-->(v) WHERE v.player.age < m.player.age RETURN n,v """ - Then a SemanticError should be raised at runtime: The where clause of optional match statement that reference variables defined by other statements is not supported yet. + Then a SyntaxError should be raised at runtime: Where clause in optional match is not supported. near `WHERE v.player.age < m.player.age' When executing query: """ MATCH (m)-[]-(n) WHERE id(m)=="Tim Duncan" OPTIONAL MATCH (n)-->(v) WHERE id(v) < id(m) RETURN count(*) AS count """ - Then a SemanticError should be raised at runtime: The where clause of optional match statement that reference variables defined by other statements is not supported yet. + Then a SyntaxError should be raised at runtime: Where clause in optional match is not supported. near `WHERE id(v) < id(m)' diff --git a/tests/tck/features/match/MultiQueryParts.feature b/tests/tck/features/match/MultiQueryParts.feature index e722235b3a8..bc0be5fb87a 100644 --- a/tests/tck/features/match/MultiQueryParts.feature +++ b/tests/tck/features/match/MultiQueryParts.feature @@ -177,36 +177,40 @@ Feature: Multi Query Parts When profiling query: """ MATCH (v1:player)-[:like*2..2]->(v2)-[e3:like]->(v4) where id(v1) == "Tony Parker" - OPTIONAL MATCH (v3:player)-[:like]->(v1)<-[e5]-(v4) where id(v3) == "Tim Duncan" return * - """ - Then the result should be, in any order, with relax comparison: - | v1 | v2 | e3 | v4 | v3 | e5 | - | ("Tony Parker") | ("Tony Parker") | [:like "Tony Parker"->"LaMarcus Aldridge" @0] | ("LaMarcus Aldridge") | ("Tim Duncan") | [:like "LaMarcus Aldridge"->"Tony Parker" @0] | - | ("Tony Parker") | ("Tim Duncan") | [:like "Tim Duncan"->"Tony Parker" @0 ] | ("Tony Parker") | NULL | NULL | - | ("Tony Parker") | ("Tim Duncan") | [:like "Tim Duncan"->"Tony Parker" @0] | ("Tony Parker") | NULL | NULL | - | ("Tony Parker") | ("Tony Parker") | [:like "Tony Parker"->"Tim Duncan" @0 ] | ("Tim Duncan") | ("Tim Duncan") | [:teammate "Tim Duncan"->"Tony Parker" @0] | - | ("Tony Parker") | ("Manu Ginobili") | [:like "Manu Ginobili"->"Tim Duncan" @0 ] | ("Tim Duncan") | ("Tim Duncan") | [:teammate "Tim Duncan"->"Tony Parker" @0] | - | ("Tony Parker") | ("Tony Parker") | [:like "Tony Parker"->"Manu Ginobili" @0] | ("Manu Ginobili") | ("Tim Duncan") | [:teammate "Manu Ginobili"->"Tony Parker" @0] | - | ("Tony Parker") | ("Tony Parker") | [:like "Tony Parker"->"Manu Ginobili" @0 ] | ("Manu Ginobili") | ("Tim Duncan") | [:teammate "Manu Ginobili"->"Tony Parker" @0] | - | ("Tony Parker") | ("Tim Duncan") | [:like "Tim Duncan"->"Manu Ginobili" @0 ] | ("Manu Ginobili") | ("Tim Duncan") | [:teammate "Manu Ginobili"->"Tony Parker" @0 ] | - | ("Tony Parker") | ("Tim Duncan") | [:like "Tim Duncan"->"Manu Ginobili" @0] | ("Manu Ginobili") | ("Tim Duncan") | [:teammate "Manu Ginobili"->"Tony Parker" @0] | - # The redudant Project after HashLeftJoin is removed now - And the execution plan should be: + OPTIONAL MATCH (v3:player)-[:like]->(v1)<-[e5]-(v4) + with v1, v2, e3, v4, e5, v3 where id(v3) == "Tim Duncan" or id(v3) is NULL + return * + """ + Then the result should be,d in any order, with relax comparison: + | v1 | v2 | e3 | v4 | e5 | v3 | + | ("Tony Parker") | ("Tony Parker") | [:like "Tony Parker"->"LaMarcus Aldridge" @0] | ("LaMarcus Aldridge") | [:like "LaMarcus Aldridge"->"Tony Parker" @0] | ("Tim Duncan") | + | ("Tony Parker") | ("Tim Duncan") | [:like "Tim Duncan"->"Tony Parker" @0 ] | ("Tony Parker") | NULL | NULL | + | ("Tony Parker") | ("Tim Duncan") | [:like "Tim Duncan"->"Tony Parker" @0] | ("Tony Parker") | NULL | NULL | + | ("Tony Parker") | ("Tony Parker") | [:like "Tony Parker"->"Tim Duncan" @0 ] | ("Tim Duncan") | [:teammate "Tim Duncan"->"Tony Parker" @0] | ("Tim Duncan") | + | ("Tony Parker") | ("Manu Ginobili") | [:like "Manu Ginobili"->"Tim Duncan" @0 ] | ("Tim Duncan") | [:teammate "Tim Duncan"->"Tony Parker" @0] | ("Tim Duncan") | + | ("Tony Parker") | ("Tony Parker") | [:like "Tony Parker"->"Manu Ginobili" @0] | ("Manu Ginobili") | [:teammate "Manu Ginobili"->"Tony Parker" @0] | ("Tim Duncan") | + | ("Tony Parker") | ("Tony Parker") | [:like "Tony Parker"->"Manu Ginobili" @0 ] | ("Manu Ginobili") | [:teammate "Manu Ginobili"->"Tony Parker" @0] | ("Tim Duncan") | + | ("Tony Parker") | ("Tim Duncan") | [:like "Tim Duncan"->"Manu Ginobili" @0 ] | ("Manu Ginobili") | [:teammate "Manu Ginobili"->"Tony Parker" @0 ] | ("Tim Duncan") | + | ("Tony Parker") | ("Tim Duncan") | [:like "Tim Duncan"->"Manu Ginobili" @0] | ("Manu Ginobili") | [:teammate "Manu Ginobili"->"Tony Parker" @0] | ("Tim Duncan") | + # The redudant Project after HashInnerJoin is removed now + Then the execution plan should be: | id | name | dependencies | profiling data | operator info | - | 19 | HashLeftJoin | 7,14 | | | - | 7 | Project | 6 | | | + | 22 | Project | 18 | | | + | 18 | Filter | 14 | | | + | 14 | HashLeftJoin | 7,13 | | | + | 7 | project | 6 | | | | 6 | AppendVertices | 5 | | | | 5 | Traverse | 20 | | | | 20 | Traverse | 2 | | | | 2 | Dedup | 1 | | | | 1 | PassThrough | 3 | | | | 3 | Start | | | | - | 14 | Project | 13 | | | - | 13 | Traverse | 21 | | | - | 21 | Traverse | 9 | | | - | 9 | Dedup | 8 | | | - | 8 | PassThrough | 10 | | | - | 10 | Start | | | | + | 13 | Project | 21 | | | + | 21 | AppendVertices | 11 | | | + | 11 | Traverse | 10 | | | + | 10 | AppendVertices | 9 | | | + | 9 | Traverse | 8 | | | + | 8 | Argument | | | | When executing query: """ MATCH (m)-[]-(n) WHERE id(m)=="Tim Duncan" diff --git a/tests/tck/features/optimizer/PrunePropertiesRule.feature b/tests/tck/features/optimizer/PrunePropertiesRule.feature index 5c4473a7be1..2b8193a8ebe 100644 --- a/tests/tck/features/optimizer/PrunePropertiesRule.feature +++ b/tests/tck/features/optimizer/PrunePropertiesRule.feature @@ -539,7 +539,6 @@ Feature: Prune Properties rule WHERE id(v) == 'Tim Duncan' AND b.player.age > 20 WITH v, count(b) AS countB, t OPTIONAL MATCH (v)-[:like]-()<-[:like]-(oldB)-[:serve]->(t) - WHERE oldB.player.age > 10 WITH v, countB, t, count(oldB) AS cb RETURN t.team.name, sum(countB) """ @@ -549,25 +548,23 @@ Feature: Prune Properties rule | "Hornets" | 3 | And the execution plan should be: | id | name | dependencies | operator info | - | 21 | Aggregate | 20 | | - | 20 | Aggregate | 19 | | - | 19 | HashLeftJoin | 10, 25 | | - | 10 | Aggregate | 23 | | - | 23 | Project | 22 | | - | 22 | Filter | 29 | | - | 29 | AppendVertices | 28 | { "props": "[{ \"props\":[\"name\",\"age\",\"_tag\"]},{\"props\":[\"name\",\"speciality\",\"_tag\"] },{ \"props\":[\"name\",\"_tag\"]}]" } | - | 28 | Traverse | 27 | {"vertexProps": "[{\"props\":[\"age\"] }]", "edgeProps": "[{ \"props\": [\"_type\", \"_rank\", \"_dst\"]}]" } | - | 27 | Traverse | 26 | {"vertexProps": "", "edgeProps": "[{ \"props\": [\"_type\", \"_rank\", \"_dst\"]}]" } | - | 26 | Traverse | 2 | {"vertexProps": "[{ \"props\":[\"name\",\"age\",\"_tag\"]},{\"props\":[\"name\",\"speciality\",\"_tag\"] },{ \"props\":[\"name\",\"_tag\"]}]", "edgeProps": "[{ \"props\": [\"_type\", \"_rank\", \"_dst\"]}, { \"props\": [\"_type\", \"_rank\", \"_dst\"]}]" } | + | 19 | Aggregate | 18 | | + | 18 | Aggregate | 27 | | + | 27 | HashLeftJoin | 10,26 | | + | 10 | Aggregate | 21 | | + | 21 | Project | 20 | | + | 20 | Filter | 25 | | + | 25 | AppendVertices | 24 | { "props": "[{ \"props\":[\"name\",\"age\",\"_tag\"]},{\"props\":[\"name\",\"speciality\",\"_tag\"] },{ \"props\":[\"name\",\"_tag\"]}]" } | + | 24 | Traverse | 23 | {"vertexProps": "[{ \"props\":[\"age\"]}]", "edgeProps": "[{ \"props\": [\"_type\", \"_rank\", \"_dst\"]}]" } | + | 23 | Traverse | 22 | {"vertexProps": "", "edgeProps": "[{ \"props\": [\"_type\", \"_rank\", \"_dst\"]}]" } | + | 22 | Traverse | 2 | {"vertexProps": "[{ \"props\":[\"name\",\"age\",\"_tag\"]},{\"props\":[\"name\",\"speciality\",\"_tag\"] },{ \"props\":[\"name\",\"_tag\"]}]", "edgeProps": "[{ \"props\": [\"_type\", \"_rank\", \"_dst\"]}, { \"props\": [\"_type\", \"_rank\", \"_dst\"]}]" } | | 2 | Dedup | 1 | | | 1 | PassThrough | 3 | | | 3 | Start | | | - | 25 | Project | 24 | | - | 24 | Filter | 16 | | - | 16 | AppendVertices | 15 | { "props": "[{ \"props\":[\"name\",\"age\",\"_tag\"]},{\"props\":[\"name\",\"speciality\",\"_tag\"] },{ \"props\":[\"name\",\"_tag\"]}]"} | - | 15 | Traverse | 14 | {"vertexProps": "[{\"props\":[\"age\"] }]", "edgeProps": "[{ \"props\": [\"_type\", \"_rank\", \"_dst\"]}]" } | - | 14 | Traverse | 13 | {"vertexProps": "", "edgeProps": "[{ \"props\": [\"_type\", \"_rank\", \"_dst\"]}]" } | - | 13 | Traverse | 11 | {"vertexProps": "[{ \"props\":[\"name\",\"age\",\"_tag\"]},{\"props\":[\"name\",\"speciality\",\"_tag\"] },{ \"props\":[\"name\",\"_tag\"]}]", "edgeProps": "[{ \"props\": [\"_type\", \"_rank\", \"_dst\"]}, { \"props\": [\"_type\", \"_rank\", \"_dst\"]}]" } | + | 26 | Project | 14 | | + | 14 | Traverse | 13 | {"vertexProps": "", "edgeProps": "[{ \"props\": [\"_src\", \"_type\", \"_rank\", \"_dst\", \"start_year\", \"end_year\"]}]" } | + | 13 | Traverse | 12 | {"vertexProps": "", "edgeProps": "[{ \"props\": [\"_type\", \"_rank\", \"_dst\"]}]" } | + | 12 | Traverse | 11 | {"vertexProps": "[{ \"props\":[\"name\",\"age\",\"_tag\"]},{\"props\":[\"name\",\"speciality\",\"_tag\"] },{ \"props\":[\"name\",\"_tag\"]}]", "edgeProps": "[{ \"props\": [\"_type\", \"_rank\", \"_dst\"]}, { \"props\": [\"_type\", \"_rank\", \"_dst\"]}]" } | | 11 | Argument | | | @distonly diff --git a/tests/tck/ldbc/business_intelligence_workload/Read.feature b/tests/tck/ldbc/business_intelligence_workload/Read.feature index 523aa4d4788..176e00420f9 100644 --- a/tests/tck/ldbc/business_intelligence_workload/Read.feature +++ b/tests/tck/ldbc/business_intelligence_workload/Read.feature @@ -115,8 +115,7 @@ Feature: LDBC Business Intelligence Workload - Read tagName ASC LIMIT 100 """ - Then the result should be, in any order: - | tagName | countMonth1 | countMonth2 | diff | + Then a SyntaxError should be raised at runtime: Where clause in optional match is not supported. near `WHERE datetime('2012-06-01') <= message1.Message.creationDate AND message1.Messa' Scenario: 4. Popular topics in a country When executing query: @@ -530,8 +529,7 @@ Feature: LDBC Business Intelligence Workload - Read personCount DESC, messageCount DESC """ - Then the result should be, in order: - | messageCount | personCount | + Then a SyntaxError should be raised at runtime: Where clause in optional match is not supported. near `WHERE message.Message.content IS NOT NULL AND message.Message.length < 20 AND me' Scenario: 19. Stranger’s interaction # NOTICE: A big rewritten, have to test the correctness diff --git a/tests/tck/ldbc/interactive_workload/ComplexReads.feature b/tests/tck/ldbc/interactive_workload/ComplexReads.feature index dc7321b1be1..a0b470ebc59 100644 --- a/tests/tck/ldbc/interactive_workload/ComplexReads.feature +++ b/tests/tck/ldbc/interactive_workload/ComplexReads.feature @@ -137,8 +137,7 @@ Feature: LDBC Interactive Workload - Complex Reads sum(postsOnTag) AS postCount ORDER BY postCount DESC, tagName ASC """ - Then the result should be, in any order: - | tagName | postCount | + Then a SyntaxError should be raised at runtime: Where clause in optional match is not supported. near `WHERE oldPost.Post.creationDate < $startDate' Scenario: 5. New groups # {"personId":"6597069766734","minDate":"1288612800000"} From e48d605875fa12c246a4215ac13e6c080af45ada Mon Sep 17 00:00:00 2001 From: xtcyclist <7731943+xtcyclist@users.noreply.github.com> Date: Wed, 18 Jan 2023 12:39:13 +0800 Subject: [PATCH 3/6] Fix typo. --- tests/tck/features/match/MultiQueryParts.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/tck/features/match/MultiQueryParts.feature b/tests/tck/features/match/MultiQueryParts.feature index bc0be5fb87a..186418e400c 100644 --- a/tests/tck/features/match/MultiQueryParts.feature +++ b/tests/tck/features/match/MultiQueryParts.feature @@ -181,7 +181,7 @@ Feature: Multi Query Parts with v1, v2, e3, v4, e5, v3 where id(v3) == "Tim Duncan" or id(v3) is NULL return * """ - Then the result should be,d in any order, with relax comparison: + Then the result should be, in any order, with relax comparison: | v1 | v2 | e3 | v4 | e5 | v3 | | ("Tony Parker") | ("Tony Parker") | [:like "Tony Parker"->"LaMarcus Aldridge" @0] | ("LaMarcus Aldridge") | [:like "LaMarcus Aldridge"->"Tony Parker" @0] | ("Tim Duncan") | | ("Tony Parker") | ("Tim Duncan") | [:like "Tim Duncan"->"Tony Parker" @0 ] | ("Tony Parker") | NULL | NULL | From 1a8bcb1f240bcab292d8efb3da65b0bac929335e Mon Sep 17 00:00:00 2001 From: xtcyclist <7731943+xtcyclist@users.noreply.github.com> Date: Wed, 18 Jan 2023 12:44:47 +0800 Subject: [PATCH 4/6] update tck. --- tests/tck/features/match/MultiQueryParts.feature | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/tck/features/match/MultiQueryParts.feature b/tests/tck/features/match/MultiQueryParts.feature index 186418e400c..4388244ba48 100644 --- a/tests/tck/features/match/MultiQueryParts.feature +++ b/tests/tck/features/match/MultiQueryParts.feature @@ -192,8 +192,8 @@ Feature: Multi Query Parts | ("Tony Parker") | ("Tony Parker") | [:like "Tony Parker"->"Manu Ginobili" @0 ] | ("Manu Ginobili") | [:teammate "Manu Ginobili"->"Tony Parker" @0] | ("Tim Duncan") | | ("Tony Parker") | ("Tim Duncan") | [:like "Tim Duncan"->"Manu Ginobili" @0 ] | ("Manu Ginobili") | [:teammate "Manu Ginobili"->"Tony Parker" @0 ] | ("Tim Duncan") | | ("Tony Parker") | ("Tim Duncan") | [:like "Tim Duncan"->"Manu Ginobili" @0] | ("Manu Ginobili") | [:teammate "Manu Ginobili"->"Tony Parker" @0] | ("Tim Duncan") | - # The redudant Project after HashInnerJoin is removed now - Then the execution plan should be: + # The redudant Project after HashLeftJoin is removed now + And the execution plan should be: | id | name | dependencies | profiling data | operator info | | 22 | Project | 18 | | | | 18 | Filter | 14 | | | From 38ca22bc00d1fc5dc5f183fbcbed9ab167a0a492 Mon Sep 17 00:00:00 2001 From: xtcyclist <7731943+xtcyclist@users.noreply.github.com> Date: Wed, 18 Jan 2023 14:44:46 +0800 Subject: [PATCH 5/6] add a delete. --- src/parser/parser.yy | 1 + 1 file changed, 1 insertion(+) diff --git a/src/parser/parser.yy b/src/parser/parser.yy index 5f8d462cd5d..3f470093936 100644 --- a/src/parser/parser.yy +++ b/src/parser/parser.yy @@ -1683,6 +1683,7 @@ match_clause } | KW_OPTIONAL KW_MATCH match_path_list where_clause { if ($4 != nullptr) { + delete $3; throw nebula::GraphParser::syntax_error(@4, "Where clause in optional match is not supported."); } else { $$ = new MatchClause($3, nullptr, true); From 52263242b7967a87ae241630be134697ecfd5980 Mon Sep 17 00:00:00 2001 From: xtcyclist <7731943+xtcyclist@users.noreply.github.com> Date: Wed, 18 Jan 2023 15:20:45 +0800 Subject: [PATCH 6/6] fix. --- src/parser/parser.yy | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/parser/parser.yy b/src/parser/parser.yy index 3f470093936..a969625f581 100644 --- a/src/parser/parser.yy +++ b/src/parser/parser.yy @@ -1683,7 +1683,10 @@ match_clause } | KW_OPTIONAL KW_MATCH match_path_list where_clause { if ($4 != nullptr) { - delete $3; + SCOPE_EXIT { + delete $3; + delete $4; + }; throw nebula::GraphParser::syntax_error(@4, "Where clause in optional match is not supported."); } else { $$ = new MatchClause($3, nullptr, true);