From 1a824a46a2308dc5742c07642cb1102ad89a2600 Mon Sep 17 00:00:00 2001 From: xtcyclist <7731943+xtcyclist@users.noreply.github.com> Date: Tue, 18 Oct 2022 15:24:12 +0800 Subject: [PATCH 01/15] Return an semantic error if no tag is found for a property while validating a match. --- src/graph/validator/MatchValidator.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/graph/validator/MatchValidator.cpp b/src/graph/validator/MatchValidator.cpp index 8fe2f611d45..05853477dce 100644 --- a/src/graph/validator/MatchValidator.cpp +++ b/src/graph/validator/MatchValidator.cpp @@ -192,6 +192,12 @@ Status MatchValidator::buildNodeInfo(const MatchPath *path, auto alias = node->alias(); auto *props = node->props(); auto anonymous = false; + // if there exists some property with no tag, return a semantic error + if (node->labels() == nullptr && props != nullptr) { + return Status::SemanticError("`%s:%s': No tag found for property.", + props->items()[0].first.c_str(), + props->items()[0].second->toString().c_str()); + } if (node->labels() != nullptr) { auto &labels = node->labels()->labels(); for (const auto &label : labels) { From cf82ca110339d0c86faaaa8df25c3e60d38fdf9e Mon Sep 17 00:00:00 2001 From: xtcyclist <7731943+xtcyclist@users.noreply.github.com> Date: Tue, 18 Oct 2022 15:24:12 +0800 Subject: [PATCH 02/15] Return an semantic error if no tag is found for a property while validating a match. --- src/graph/validator/MatchValidator.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/graph/validator/MatchValidator.cpp b/src/graph/validator/MatchValidator.cpp index 8fe2f611d45..05853477dce 100644 --- a/src/graph/validator/MatchValidator.cpp +++ b/src/graph/validator/MatchValidator.cpp @@ -192,6 +192,12 @@ Status MatchValidator::buildNodeInfo(const MatchPath *path, auto alias = node->alias(); auto *props = node->props(); auto anonymous = false; + // if there exists some property with no tag, return a semantic error + if (node->labels() == nullptr && props != nullptr) { + return Status::SemanticError("`%s:%s': No tag found for property.", + props->items()[0].first.c_str(), + props->items()[0].second->toString().c_str()); + } if (node->labels() != nullptr) { auto &labels = node->labels()->labels(); for (const auto &label : labels) { From dccb720a7e37a42cdc762dd5b686e82639a25e7b Mon Sep 17 00:00:00 2001 From: xtcyclist <7731943+xtcyclist@users.noreply.github.com> Date: Tue, 18 Oct 2022 16:51:08 +0800 Subject: [PATCH 03/15] Add a tck case for the fixed bug. --- tests/tck/features/match/PathExpr.feature | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/tck/features/match/PathExpr.feature b/tests/tck/features/match/PathExpr.feature index ffcd80d8d2f..078807c607d 100644 --- a/tests/tck/features/match/PathExpr.feature +++ b/tests/tck/features/match/PathExpr.feature @@ -6,6 +6,23 @@ Feature: Basic match Background: Given a graph with space named "nba" + Scenario: Tagless property + When executing query: + """ + match p = (v{name: "hello"})-->(v1{name: "hello"}) where id(v) == "kk" return p limit 1; + """ + Then a SemanticError should be raised at runtime: `name:"hello"': No tag found for property. + When executing query: + """ + match p = (v:player{name: "hello"})-->(v1{name: "world"}) where id(v) == "kk" return p limit 1; + """ + Then a SemanticError should be raised at runtime: `name:"world"': No tag found for property. + When executing query: + """ + match p = (v{name: "hello"})-->(v1:player{name: "world"}) where id(v) == "kk" return p limit 1; + """ + Then a SemanticError should be raised at runtime: `name:"hello"': No tag found for property. + Scenario: Undefined aliases When executing query: """ From 67488ab9444dbe173459da69e671f77d72060afd Mon Sep 17 00:00:00 2001 From: xtcyclist <7731943+xtcyclist@users.noreply.github.com> Date: Wed, 19 Oct 2022 09:55:43 +0800 Subject: [PATCH 04/15] commented out unused codes. --- src/graph/validator/MatchValidator.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/graph/validator/MatchValidator.cpp b/src/graph/validator/MatchValidator.cpp index 05853477dce..2b47db5f7af 100644 --- a/src/graph/validator/MatchValidator.cpp +++ b/src/graph/validator/MatchValidator.cpp @@ -219,11 +219,18 @@ Status MatchValidator::buildNodeInfo(const MatchPath *path, nodeAliases.emplace(alias, AliasType::kNode); } Expression *filter = nullptr; + /* Note(Xuntao): Commented out the following part. With the current parser, + if no tag is given in match clauses, node->props() is not nullptr but + node-labels() is. This is not supposed to be valid. + */ + /* if (props != nullptr) { auto result = makeNodeSubFilter(const_cast(props), "*"); NG_RETURN_IF_ERROR(result); filter = result.value(); - } else if (node->labels() != nullptr && !node->labels()->labels().empty()) { + } else + */ + if (node->labels() != nullptr && !node->labels()->labels().empty()) { const auto &labels = node->labels()->labels(); for (const auto &label : labels) { auto result = makeNodeSubFilter(label->props(), *label->label()); From b1b05769fef3fc1158f759205d34063b0f5c242b Mon Sep 17 00:00:00 2001 From: xtcyclist <7731943+xtcyclist@users.noreply.github.com> Date: Wed, 19 Oct 2022 14:49:56 +0800 Subject: [PATCH 05/15] add tag in tck cases --- tests/tck/features/match/Base.IntVid.feature | 4 ++-- tests/tck/features/match/Base.feature | 4 ++-- tests/tck/features/match/MatchById.IntVid.feature | 2 +- tests/tck/features/match/MatchById.feature | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/tck/features/match/Base.IntVid.feature b/tests/tck/features/match/Base.IntVid.feature index dc4bff00b7b..3351b461120 100644 --- a/tests/tck/features/match/Base.IntVid.feature +++ b/tests/tck/features/match/Base.IntVid.feature @@ -128,7 +128,7 @@ Feature: Basic match | "serve" | "Cavaliers" | When executing query: """ - MATCH (v1:player{name: "LeBron James"}) -[r:serve]-> (v2 {name: "Cavaliers"}) + MATCH (v1:player{name: "LeBron James"}) -[r:serve]-> (v2:team{name: "Cavaliers"}) RETURN type(r) AS Type, v2.team.name AS Name """ Then the result should be, in any order: @@ -137,7 +137,7 @@ Feature: Basic match | "serve" | "Cavaliers" | When executing query: """ - MATCH (v1:player{name: "LeBron James"}) -[r:serve]-> (v2 {name: "Cavaliers"}) + MATCH (v1:player{name: "LeBron James"}) -[r:serve]-> (v2:team{name: "Cavaliers"}) WHERE r.start_year <= 2005 AND r.end_year >= 2005 RETURN r.start_year AS Start_Year, r.end_year AS Start_Year """ diff --git a/tests/tck/features/match/Base.feature b/tests/tck/features/match/Base.feature index 27348d21ef9..2898a76cd8e 100644 --- a/tests/tck/features/match/Base.feature +++ b/tests/tck/features/match/Base.feature @@ -166,7 +166,7 @@ Feature: Basic match | "serve" | "Cavaliers" | When executing query: """ - MATCH (v1:player{name: "LeBron James"}) -[r:serve]-> (v2 {name: "Cavaliers"}) + MATCH (v1:player{name: "LeBron James"}) -[r:serve]-> (v2:team{name: "Cavaliers"}) RETURN type(r) AS Type, v2.team.name AS Name """ Then the result should be, in any order: @@ -175,7 +175,7 @@ Feature: Basic match | "serve" | "Cavaliers" | When executing query: """ - MATCH (v1:player{name: "LeBron James"}) -[r:serve]-> (v2 {name: "Cavaliers"}) + MATCH (v1:player{name: "LeBron James"}) -[r:serve]-> (v2:team{name: "Cavaliers"}) WHERE r.start_year <= 2005 AND r.end_year >= 2005 RETURN r.start_year AS Start_Year, r.end_year AS Start_Year """ diff --git a/tests/tck/features/match/MatchById.IntVid.feature b/tests/tck/features/match/MatchById.IntVid.feature index 1bf44590933..c649353e59a 100644 --- a/tests/tck/features/match/MatchById.IntVid.feature +++ b/tests/tck/features/match/MatchById.IntVid.feature @@ -133,7 +133,7 @@ Feature: Integer Vid Match By Id | 'serve' | 'Lakers' | When executing query: """ - MATCH (v1) -[r:serve]-> (v2 {name: "Cavaliers"}) + MATCH (v1) -[r:serve]-> (v2:player {name: "Cavaliers"}) WHERE id(v1) == hash("LeBron James") RETURN type(r) AS Type, v2.team.name AS Name """ diff --git a/tests/tck/features/match/MatchById.feature b/tests/tck/features/match/MatchById.feature index ba600a169bf..6e1934920e6 100644 --- a/tests/tck/features/match/MatchById.feature +++ b/tests/tck/features/match/MatchById.feature @@ -133,7 +133,7 @@ Feature: Match By Id | 'serve' | 'Lakers' | When executing query: """ - MATCH (v1) -[r:serve]-> (v2 {name: "Cavaliers"}) + MATCH (v1) -[r:serve]-> (v2:team{name: "Cavaliers"}) WHERE id(v1) == "LeBron James" RETURN type(r) AS Type, v2.team.name AS Name """ From 099584e559a5aaa0f64af061f2a8cab88b859d38 Mon Sep 17 00:00:00 2001 From: xtcyclist <7731943+xtcyclist@users.noreply.github.com> Date: Wed, 19 Oct 2022 15:10:09 +0800 Subject: [PATCH 06/15] fixing tck --- tests/tck/features/match/Base.IntVid.feature | 2 +- tests/tck/features/match/Base.feature | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/tck/features/match/Base.IntVid.feature b/tests/tck/features/match/Base.IntVid.feature index 3351b461120..0abbfc75062 100644 --- a/tests/tck/features/match/Base.IntVid.feature +++ b/tests/tck/features/match/Base.IntVid.feature @@ -516,7 +516,7 @@ Feature: Basic match 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. When executing query: """ - MATCH (v{name: "Tim Duncan"}) return v + MATCH (v:player{name: "Tim Duncan"}) return v """ 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. When executing query: diff --git a/tests/tck/features/match/Base.feature b/tests/tck/features/match/Base.feature index 2898a76cd8e..352f3537016 100644 --- a/tests/tck/features/match/Base.feature +++ b/tests/tck/features/match/Base.feature @@ -626,7 +626,7 @@ Feature: Basic match 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. When executing query: """ - MATCH (v{name: "Tim Duncan"}) return v + MATCH (v:player{name: "Tim Duncan"}) return v """ 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. When executing query: From 8bec593af6a82dbda17af8f2539fddbc40e58315 Mon Sep 17 00:00:00 2001 From: xtcyclist <7731943+xtcyclist@users.noreply.github.com> Date: Wed, 19 Oct 2022 15:54:40 +0800 Subject: [PATCH 07/15] updated tck cases to add missing cases that are supposed to be there. --- tests/tck/features/match/Base.IntVid.feature | 5 ----- tests/tck/features/match/Base.feature | 5 ----- tests/tck/features/match/MatchById.IntVid.feature | 2 +- tests/tck/features/match/Scan.feature | 3 +-- tests/tck/features/match/VariableLengthPattern.feature | 2 +- .../tck/features/match/VariableLengthPattern.intVid.feature | 2 +- tests/tck/features/yield/parameter.feature | 2 +- 7 files changed, 5 insertions(+), 16 deletions(-) diff --git a/tests/tck/features/match/Base.IntVid.feature b/tests/tck/features/match/Base.IntVid.feature index 0abbfc75062..20a43766a8f 100644 --- a/tests/tck/features/match/Base.IntVid.feature +++ b/tests/tck/features/match/Base.IntVid.feature @@ -514,11 +514,6 @@ Feature: Basic match MATCH (v) return v """ 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. - When executing query: - """ - MATCH (v:player{name: "Tim Duncan"}) return v - """ - 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. When executing query: """ MATCH (v:player:bachelor) RETURN v diff --git a/tests/tck/features/match/Base.feature b/tests/tck/features/match/Base.feature index 352f3537016..a74a08d1111 100644 --- a/tests/tck/features/match/Base.feature +++ b/tests/tck/features/match/Base.feature @@ -624,11 +624,6 @@ Feature: Basic match MATCH (v) return v """ 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. - When executing query: - """ - MATCH (v:player{name: "Tim Duncan"}) return v - """ - 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. When executing query: """ MATCH (v:player:bachelor) RETURN v diff --git a/tests/tck/features/match/MatchById.IntVid.feature b/tests/tck/features/match/MatchById.IntVid.feature index c649353e59a..38ff151f642 100644 --- a/tests/tck/features/match/MatchById.IntVid.feature +++ b/tests/tck/features/match/MatchById.IntVid.feature @@ -133,7 +133,7 @@ Feature: Integer Vid Match By Id | 'serve' | 'Lakers' | When executing query: """ - MATCH (v1) -[r:serve]-> (v2:player {name: "Cavaliers"}) + MATCH (v1) -[r:serve]-> (v2:team {name: "Cavaliers"}) WHERE id(v1) == hash("LeBron James") RETURN type(r) AS Type, v2.team.name AS Name """ diff --git a/tests/tck/features/match/Scan.feature b/tests/tck/features/match/Scan.feature index 3937e5ea91c..fc84d2f70f5 100644 --- a/tests/tck/features/match/Scan.feature +++ b/tests/tck/features/match/Scan.feature @@ -87,9 +87,8 @@ Feature: Match seek by scan 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. When executing query: """ - MATCH (v{name: "Mary"}) + MATCH (v:person) RETURN v.student.name AS Name - LIMIT 3 """ 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. diff --git a/tests/tck/features/match/VariableLengthPattern.feature b/tests/tck/features/match/VariableLengthPattern.feature index 8d3b26edf05..c3c19133787 100644 --- a/tests/tck/features/match/VariableLengthPattern.feature +++ b/tests/tck/features/match/VariableLengthPattern.feature @@ -310,7 +310,7 @@ Feature: Variable length Pattern match (m to n) Scenario: multi-steps and filter by node properties When executing query: """ - MATCH (v:player{name: 'Tim Duncan'})-[e1:like*1..2]-(v2{name: 'Tony Parker'})-[e2:serve]-(v3{name: 'Spurs'}) + MATCH (v:player{name: 'Tim Duncan'})-[e1:like*1..2]-(v2:player{name: 'Tony Parker'})-[e2:serve]-(v3:team{name: 'Spurs'}) RETURN e1, e2 """ Then the result should be, in any order, with relax comparison: diff --git a/tests/tck/features/match/VariableLengthPattern.intVid.feature b/tests/tck/features/match/VariableLengthPattern.intVid.feature index 70721c32c77..238b5671671 100644 --- a/tests/tck/features/match/VariableLengthPattern.intVid.feature +++ b/tests/tck/features/match/VariableLengthPattern.intVid.feature @@ -310,7 +310,7 @@ Feature: Integer Vid Variable length Pattern match (m to n) Scenario: Integer Vid multi-steps and filter by node properties When executing query: """ - MATCH (v:player{name: 'Tim Duncan'})-[e1:like*1..2]-(v2{name: 'Tony Parker'})-[e2:serve]-(v3{name: 'Spurs'}) + MATCH (v:player{name: 'Tim Duncan'})-[e1:like*1..2]-(v2:player{name: 'Tony Parker'})-[e2:serve]-(v3:team{name: 'Spurs'}) RETURN e1, e2 """ Then the result should be, in any order, with relax comparison: diff --git a/tests/tck/features/yield/parameter.feature b/tests/tck/features/yield/parameter.feature index 58bd96d71c9..f7688f2d2c5 100644 --- a/tests/tck/features/yield/parameter.feature +++ b/tests/tck/features/yield/parameter.feature @@ -61,7 +61,7 @@ Feature: Parameter | "Tony Parker" | When executing query: """ - MATCH (v:player)-[:like]->(n{name:$p7.a.b.c}) + MATCH (v:player)-[:like]->(n:player{name:$p7.a.b.c}) RETURN n.player.name AS dst LIMIT $p7.a.b.d[0] """ Then the result should be, in any order: From 4233b58c0c6ca7b7456bd63c91594a8025d219f0 Mon Sep 17 00:00:00 2001 From: xtcyclist <7731943+xtcyclist@users.noreply.github.com> Date: Tue, 18 Oct 2022 15:24:12 +0800 Subject: [PATCH 08/15] Return an semantic error if no tag is found for a property while validating a match. --- src/graph/validator/MatchValidator.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/graph/validator/MatchValidator.cpp b/src/graph/validator/MatchValidator.cpp index 0b156720212..3655553c580 100644 --- a/src/graph/validator/MatchValidator.cpp +++ b/src/graph/validator/MatchValidator.cpp @@ -192,6 +192,12 @@ Status MatchValidator::buildNodeInfo(const MatchPath *path, auto alias = node->alias(); auto *props = node->props(); auto anonymous = false; + // if there exists some property with no tag, return a semantic error + if (node->labels() == nullptr && props != nullptr) { + return Status::SemanticError("`%s:%s': No tag found for property.", + props->items()[0].first.c_str(), + props->items()[0].second->toString().c_str()); + } if (node->labels() != nullptr) { auto &labels = node->labels()->labels(); for (const auto &label : labels) { From d7d014519fe805c6b9665622864bd88ebfadf808 Mon Sep 17 00:00:00 2001 From: xtcyclist <7731943+xtcyclist@users.noreply.github.com> Date: Tue, 18 Oct 2022 16:51:08 +0800 Subject: [PATCH 09/15] Add a tck case for the fixed bug. --- tests/tck/features/match/PathExpr.feature | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/tck/features/match/PathExpr.feature b/tests/tck/features/match/PathExpr.feature index ffcd80d8d2f..078807c607d 100644 --- a/tests/tck/features/match/PathExpr.feature +++ b/tests/tck/features/match/PathExpr.feature @@ -6,6 +6,23 @@ Feature: Basic match Background: Given a graph with space named "nba" + Scenario: Tagless property + When executing query: + """ + match p = (v{name: "hello"})-->(v1{name: "hello"}) where id(v) == "kk" return p limit 1; + """ + Then a SemanticError should be raised at runtime: `name:"hello"': No tag found for property. + When executing query: + """ + match p = (v:player{name: "hello"})-->(v1{name: "world"}) where id(v) == "kk" return p limit 1; + """ + Then a SemanticError should be raised at runtime: `name:"world"': No tag found for property. + When executing query: + """ + match p = (v{name: "hello"})-->(v1:player{name: "world"}) where id(v) == "kk" return p limit 1; + """ + Then a SemanticError should be raised at runtime: `name:"hello"': No tag found for property. + Scenario: Undefined aliases When executing query: """ From eb24755c17e480a46cc362b81db1e41c01a95978 Mon Sep 17 00:00:00 2001 From: xtcyclist <7731943+xtcyclist@users.noreply.github.com> Date: Wed, 19 Oct 2022 09:55:43 +0800 Subject: [PATCH 10/15] commented out unused codes. --- src/graph/validator/MatchValidator.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/graph/validator/MatchValidator.cpp b/src/graph/validator/MatchValidator.cpp index 3655553c580..b7f8127b6c8 100644 --- a/src/graph/validator/MatchValidator.cpp +++ b/src/graph/validator/MatchValidator.cpp @@ -219,11 +219,18 @@ Status MatchValidator::buildNodeInfo(const MatchPath *path, nodeAliases.emplace(alias, AliasType::kNode); } Expression *filter = nullptr; + /* Note(Xuntao): Commented out the following part. With the current parser, + if no tag is given in match clauses, node->props() is not nullptr but + node-labels() is. This is not supposed to be valid. + */ + /* if (props != nullptr) { auto result = makeNodeSubFilter(const_cast(props), "*"); NG_RETURN_IF_ERROR(result); filter = result.value(); - } else if (node->labels() != nullptr && !node->labels()->labels().empty()) { + } else + */ + if (node->labels() != nullptr && !node->labels()->labels().empty()) { const auto &labels = node->labels()->labels(); for (const auto &label : labels) { auto result = makeNodeSubFilter(label->props(), *label->label()); From ee22dc02663d56c0f51e57fe938d7fe6b5b8209c Mon Sep 17 00:00:00 2001 From: xtcyclist <7731943+xtcyclist@users.noreply.github.com> Date: Wed, 19 Oct 2022 14:49:56 +0800 Subject: [PATCH 11/15] add tag in tck cases --- tests/tck/features/match/Base.IntVid.feature | 4 ++-- tests/tck/features/match/Base.feature | 4 ++-- tests/tck/features/match/MatchById.IntVid.feature | 2 +- tests/tck/features/match/MatchById.feature | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/tck/features/match/Base.IntVid.feature b/tests/tck/features/match/Base.IntVid.feature index dc4bff00b7b..3351b461120 100644 --- a/tests/tck/features/match/Base.IntVid.feature +++ b/tests/tck/features/match/Base.IntVid.feature @@ -128,7 +128,7 @@ Feature: Basic match | "serve" | "Cavaliers" | When executing query: """ - MATCH (v1:player{name: "LeBron James"}) -[r:serve]-> (v2 {name: "Cavaliers"}) + MATCH (v1:player{name: "LeBron James"}) -[r:serve]-> (v2:team{name: "Cavaliers"}) RETURN type(r) AS Type, v2.team.name AS Name """ Then the result should be, in any order: @@ -137,7 +137,7 @@ Feature: Basic match | "serve" | "Cavaliers" | When executing query: """ - MATCH (v1:player{name: "LeBron James"}) -[r:serve]-> (v2 {name: "Cavaliers"}) + MATCH (v1:player{name: "LeBron James"}) -[r:serve]-> (v2:team{name: "Cavaliers"}) WHERE r.start_year <= 2005 AND r.end_year >= 2005 RETURN r.start_year AS Start_Year, r.end_year AS Start_Year """ diff --git a/tests/tck/features/match/Base.feature b/tests/tck/features/match/Base.feature index 27348d21ef9..2898a76cd8e 100644 --- a/tests/tck/features/match/Base.feature +++ b/tests/tck/features/match/Base.feature @@ -166,7 +166,7 @@ Feature: Basic match | "serve" | "Cavaliers" | When executing query: """ - MATCH (v1:player{name: "LeBron James"}) -[r:serve]-> (v2 {name: "Cavaliers"}) + MATCH (v1:player{name: "LeBron James"}) -[r:serve]-> (v2:team{name: "Cavaliers"}) RETURN type(r) AS Type, v2.team.name AS Name """ Then the result should be, in any order: @@ -175,7 +175,7 @@ Feature: Basic match | "serve" | "Cavaliers" | When executing query: """ - MATCH (v1:player{name: "LeBron James"}) -[r:serve]-> (v2 {name: "Cavaliers"}) + MATCH (v1:player{name: "LeBron James"}) -[r:serve]-> (v2:team{name: "Cavaliers"}) WHERE r.start_year <= 2005 AND r.end_year >= 2005 RETURN r.start_year AS Start_Year, r.end_year AS Start_Year """ diff --git a/tests/tck/features/match/MatchById.IntVid.feature b/tests/tck/features/match/MatchById.IntVid.feature index 1bf44590933..c649353e59a 100644 --- a/tests/tck/features/match/MatchById.IntVid.feature +++ b/tests/tck/features/match/MatchById.IntVid.feature @@ -133,7 +133,7 @@ Feature: Integer Vid Match By Id | 'serve' | 'Lakers' | When executing query: """ - MATCH (v1) -[r:serve]-> (v2 {name: "Cavaliers"}) + MATCH (v1) -[r:serve]-> (v2:player {name: "Cavaliers"}) WHERE id(v1) == hash("LeBron James") RETURN type(r) AS Type, v2.team.name AS Name """ diff --git a/tests/tck/features/match/MatchById.feature b/tests/tck/features/match/MatchById.feature index ba600a169bf..6e1934920e6 100644 --- a/tests/tck/features/match/MatchById.feature +++ b/tests/tck/features/match/MatchById.feature @@ -133,7 +133,7 @@ Feature: Match By Id | 'serve' | 'Lakers' | When executing query: """ - MATCH (v1) -[r:serve]-> (v2 {name: "Cavaliers"}) + MATCH (v1) -[r:serve]-> (v2:team{name: "Cavaliers"}) WHERE id(v1) == "LeBron James" RETURN type(r) AS Type, v2.team.name AS Name """ From f9b59ae12aa23900ba0f77312613c6c27e341400 Mon Sep 17 00:00:00 2001 From: xtcyclist <7731943+xtcyclist@users.noreply.github.com> Date: Wed, 19 Oct 2022 15:10:09 +0800 Subject: [PATCH 12/15] fixing tck --- tests/tck/features/match/Base.IntVid.feature | 2 +- tests/tck/features/match/Base.feature | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/tck/features/match/Base.IntVid.feature b/tests/tck/features/match/Base.IntVid.feature index 3351b461120..0abbfc75062 100644 --- a/tests/tck/features/match/Base.IntVid.feature +++ b/tests/tck/features/match/Base.IntVid.feature @@ -516,7 +516,7 @@ Feature: Basic match 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. When executing query: """ - MATCH (v{name: "Tim Duncan"}) return v + MATCH (v:player{name: "Tim Duncan"}) return v """ 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. When executing query: diff --git a/tests/tck/features/match/Base.feature b/tests/tck/features/match/Base.feature index 2898a76cd8e..352f3537016 100644 --- a/tests/tck/features/match/Base.feature +++ b/tests/tck/features/match/Base.feature @@ -626,7 +626,7 @@ Feature: Basic match 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. When executing query: """ - MATCH (v{name: "Tim Duncan"}) return v + MATCH (v:player{name: "Tim Duncan"}) return v """ 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. When executing query: From 5737b08a14ac5eab6ab4d83af8b61c249617b5a9 Mon Sep 17 00:00:00 2001 From: xtcyclist <7731943+xtcyclist@users.noreply.github.com> Date: Wed, 19 Oct 2022 15:54:40 +0800 Subject: [PATCH 13/15] updated tck cases to add missing cases that are supposed to be there. --- tests/tck/features/match/Base.IntVid.feature | 5 ----- tests/tck/features/match/Base.feature | 5 ----- tests/tck/features/match/MatchById.IntVid.feature | 2 +- tests/tck/features/match/Scan.feature | 3 +-- tests/tck/features/match/VariableLengthPattern.feature | 2 +- .../tck/features/match/VariableLengthPattern.intVid.feature | 2 +- tests/tck/features/yield/parameter.feature | 2 +- 7 files changed, 5 insertions(+), 16 deletions(-) diff --git a/tests/tck/features/match/Base.IntVid.feature b/tests/tck/features/match/Base.IntVid.feature index 0abbfc75062..20a43766a8f 100644 --- a/tests/tck/features/match/Base.IntVid.feature +++ b/tests/tck/features/match/Base.IntVid.feature @@ -514,11 +514,6 @@ Feature: Basic match MATCH (v) return v """ 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. - When executing query: - """ - MATCH (v:player{name: "Tim Duncan"}) return v - """ - 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. When executing query: """ MATCH (v:player:bachelor) RETURN v diff --git a/tests/tck/features/match/Base.feature b/tests/tck/features/match/Base.feature index 352f3537016..a74a08d1111 100644 --- a/tests/tck/features/match/Base.feature +++ b/tests/tck/features/match/Base.feature @@ -624,11 +624,6 @@ Feature: Basic match MATCH (v) return v """ 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. - When executing query: - """ - MATCH (v:player{name: "Tim Duncan"}) return v - """ - 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. When executing query: """ MATCH (v:player:bachelor) RETURN v diff --git a/tests/tck/features/match/MatchById.IntVid.feature b/tests/tck/features/match/MatchById.IntVid.feature index c649353e59a..38ff151f642 100644 --- a/tests/tck/features/match/MatchById.IntVid.feature +++ b/tests/tck/features/match/MatchById.IntVid.feature @@ -133,7 +133,7 @@ Feature: Integer Vid Match By Id | 'serve' | 'Lakers' | When executing query: """ - MATCH (v1) -[r:serve]-> (v2:player {name: "Cavaliers"}) + MATCH (v1) -[r:serve]-> (v2:team {name: "Cavaliers"}) WHERE id(v1) == hash("LeBron James") RETURN type(r) AS Type, v2.team.name AS Name """ diff --git a/tests/tck/features/match/Scan.feature b/tests/tck/features/match/Scan.feature index 3937e5ea91c..fc84d2f70f5 100644 --- a/tests/tck/features/match/Scan.feature +++ b/tests/tck/features/match/Scan.feature @@ -87,9 +87,8 @@ Feature: Match seek by scan 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. When executing query: """ - MATCH (v{name: "Mary"}) + MATCH (v:person) RETURN v.student.name AS Name - LIMIT 3 """ 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. diff --git a/tests/tck/features/match/VariableLengthPattern.feature b/tests/tck/features/match/VariableLengthPattern.feature index 8d3b26edf05..c3c19133787 100644 --- a/tests/tck/features/match/VariableLengthPattern.feature +++ b/tests/tck/features/match/VariableLengthPattern.feature @@ -310,7 +310,7 @@ Feature: Variable length Pattern match (m to n) Scenario: multi-steps and filter by node properties When executing query: """ - MATCH (v:player{name: 'Tim Duncan'})-[e1:like*1..2]-(v2{name: 'Tony Parker'})-[e2:serve]-(v3{name: 'Spurs'}) + MATCH (v:player{name: 'Tim Duncan'})-[e1:like*1..2]-(v2:player{name: 'Tony Parker'})-[e2:serve]-(v3:team{name: 'Spurs'}) RETURN e1, e2 """ Then the result should be, in any order, with relax comparison: diff --git a/tests/tck/features/match/VariableLengthPattern.intVid.feature b/tests/tck/features/match/VariableLengthPattern.intVid.feature index 70721c32c77..238b5671671 100644 --- a/tests/tck/features/match/VariableLengthPattern.intVid.feature +++ b/tests/tck/features/match/VariableLengthPattern.intVid.feature @@ -310,7 +310,7 @@ Feature: Integer Vid Variable length Pattern match (m to n) Scenario: Integer Vid multi-steps and filter by node properties When executing query: """ - MATCH (v:player{name: 'Tim Duncan'})-[e1:like*1..2]-(v2{name: 'Tony Parker'})-[e2:serve]-(v3{name: 'Spurs'}) + MATCH (v:player{name: 'Tim Duncan'})-[e1:like*1..2]-(v2:player{name: 'Tony Parker'})-[e2:serve]-(v3:team{name: 'Spurs'}) RETURN e1, e2 """ Then the result should be, in any order, with relax comparison: diff --git a/tests/tck/features/yield/parameter.feature b/tests/tck/features/yield/parameter.feature index 58bd96d71c9..f7688f2d2c5 100644 --- a/tests/tck/features/yield/parameter.feature +++ b/tests/tck/features/yield/parameter.feature @@ -61,7 +61,7 @@ Feature: Parameter | "Tony Parker" | When executing query: """ - MATCH (v:player)-[:like]->(n{name:$p7.a.b.c}) + MATCH (v:player)-[:like]->(n:player{name:$p7.a.b.c}) RETURN n.player.name AS dst LIMIT $p7.a.b.d[0] """ Then the result should be, in any order: From e7789bac50ed578e082d528abe138c0663384e3c Mon Sep 17 00:00:00 2001 From: xtcyclist <7731943+xtcyclist@users.noreply.github.com> Date: Mon, 24 Oct 2022 11:29:27 +0800 Subject: [PATCH 14/15] update --- src/graph/validator/MatchValidator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/graph/validator/MatchValidator.cpp b/src/graph/validator/MatchValidator.cpp index b7f8127b6c8..ca93ab9fb0d 100644 --- a/src/graph/validator/MatchValidator.cpp +++ b/src/graph/validator/MatchValidator.cpp @@ -193,7 +193,7 @@ Status MatchValidator::buildNodeInfo(const MatchPath *path, auto *props = node->props(); auto anonymous = false; // if there exists some property with no tag, return a semantic error - if (node->labels() == nullptr && props != nullptr) { + if (props != nullptr) { return Status::SemanticError("`%s:%s': No tag found for property.", props->items()[0].first.c_str(), props->items()[0].second->toString().c_str()); From 111b1045214c1fc21a337ebe0f31954628a47d3b Mon Sep 17 00:00:00 2001 From: xtcyclist <7731943+xtcyclist@users.noreply.github.com> Date: Mon, 24 Oct 2022 13:50:33 +0800 Subject: [PATCH 15/15] update tck case. --- tests/tck/features/match/Base.feature | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/tck/features/match/Base.feature b/tests/tck/features/match/Base.feature index a74a08d1111..01876f32ae6 100644 --- a/tests/tck/features/match/Base.feature +++ b/tests/tck/features/match/Base.feature @@ -756,3 +756,10 @@ Feature: Basic match """ Then the result should be, in any order, with relax comparison: | id(v) | + + Scenario: match_with_wrong_syntax + When executing query: + """ + MATCH (v{name: "Tim Duncan"}) return v + """ + Then a SemanticError should be raised at runtime: `name:"Tim Duncan"': No tag found for property.