From 6977c19cffe33e90feb703bd6bb27a33122adc7d Mon Sep 17 00:00:00 2001 From: Shylock Hg <33566796+Shylock-Hg@users.noreply.github.com> Date: Thu, 23 Dec 2021 15:52:10 +0800 Subject: [PATCH 1/3] Make scan limit error more friendly. --- src/graph/executor/query/ScanEdgesExecutor.cpp | 3 ++- src/graph/executor/query/ScanVerticesExecutor.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/graph/executor/query/ScanEdgesExecutor.cpp b/src/graph/executor/query/ScanEdgesExecutor.cpp index fd70ad6e86b..817bdc9b806 100644 --- a/src/graph/executor/query/ScanEdgesExecutor.cpp +++ b/src/graph/executor/query/ScanEdgesExecutor.cpp @@ -24,7 +24,8 @@ folly::Future ScanEdgesExecutor::scanEdges() { StorageClient *client = qctx()->getStorageClient(); auto *se = asNode(node()); if (se->limit() < 0) { - return Status::Error("Scan edges must specify limit number."); + return Status::Error( + "Scan vertices or edges need to specify a limit number, or limit number can't push down."); } time::Duration scanEdgesTime; diff --git a/src/graph/executor/query/ScanVerticesExecutor.cpp b/src/graph/executor/query/ScanVerticesExecutor.cpp index 2ff896002b2..85d56527df1 100644 --- a/src/graph/executor/query/ScanVerticesExecutor.cpp +++ b/src/graph/executor/query/ScanVerticesExecutor.cpp @@ -23,7 +23,8 @@ folly::Future ScanVerticesExecutor::scanVertices() { auto *sv = asNode(node()); if (sv->limit() < 0) { - return Status::Error("Scan vertices must specify limit number."); + return Status::Error( + "Scan vertices or edges need to specify a limit number, or limit number can't push down."); } StorageClient *storageClient = qctx()->getStorageClient(); From 769d6838fbc914818c8fd7169a1b0b54343a816d Mon Sep 17 00:00:00 2001 From: Shylock Hg <33566796+Shylock-Hg@users.noreply.github.com> Date: Thu, 23 Dec 2021 15:57:37 +0800 Subject: [PATCH 2/3] Fix test case. --- src/graph/executor/query/ScanEdgesExecutor.cpp | 3 ++- src/graph/executor/query/ScanVerticesExecutor.cpp | 3 ++- tests/tck/features/match/Base.IntVid.feature | 12 ++++++------ tests/tck/features/match/Base.feature | 12 ++++++------ tests/tck/features/match/Scan.feature | 6 +++--- tests/tck/features/match/SeekByEdge.feature | 8 ++++---- tests/tck/features/match/SeekById.feature | 10 +++++----- tests/tck/features/match/SeekById.intVid.feature | 10 +++++----- 8 files changed, 33 insertions(+), 31 deletions(-) diff --git a/src/graph/executor/query/ScanEdgesExecutor.cpp b/src/graph/executor/query/ScanEdgesExecutor.cpp index 817bdc9b806..5e2c502a4ad 100644 --- a/src/graph/executor/query/ScanEdgesExecutor.cpp +++ b/src/graph/executor/query/ScanEdgesExecutor.cpp @@ -25,7 +25,8 @@ folly::Future ScanEdgesExecutor::scanEdges() { auto *se = asNode(node()); if (se->limit() < 0) { return Status::Error( - "Scan vertices or edges need to specify a limit number, or limit number can't push down."); + "Scan vertices or edges need to specify a limit number, " + "or limit number can not push down."); } time::Duration scanEdgesTime; diff --git a/src/graph/executor/query/ScanVerticesExecutor.cpp b/src/graph/executor/query/ScanVerticesExecutor.cpp index 85d56527df1..7fdfc6fd791 100644 --- a/src/graph/executor/query/ScanVerticesExecutor.cpp +++ b/src/graph/executor/query/ScanVerticesExecutor.cpp @@ -24,7 +24,8 @@ folly::Future ScanVerticesExecutor::scanVertices() { auto *sv = asNode(node()); if (sv->limit() < 0) { return Status::Error( - "Scan vertices or edges need to specify a limit number, or limit number can't push down."); + "Scan vertices or edges need to specify a limit number," + " or limit number can not push down."); } StorageClient *storageClient = qctx()->getStorageClient(); diff --git a/tests/tck/features/match/Base.IntVid.feature b/tests/tck/features/match/Base.IntVid.feature index 36d9c69d83e..4c29c2a3b38 100644 --- a/tests/tck/features/match/Base.IntVid.feature +++ b/tests/tck/features/match/Base.IntVid.feature @@ -487,22 +487,22 @@ Feature: Basic match """ MATCH (v) return v """ - Then a ExecutionError should be raised at runtime: Scan vertices must specify limit number. + 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 """ - Then a ExecutionError should be raised at runtime: Scan vertices must specify limit number. + 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 """ - Then a ExecutionError should be raised at runtime: Scan vertices must specify limit number. + 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{age:23}:bachelor) RETURN v """ - Then a ExecutionError should be raised at runtime: Scan vertices must specify limit number. + 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) return * @@ -512,11 +512,11 @@ Feature: Basic match """ MATCH () --> (v) --> () return * """ - Then a ExecutionError should be raised at runtime: Scan vertices must specify limit number. + 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. # The 0 step means node scan in fact, but p and t has no label or properties for index seek # So it's not workable now When executing query: """ MATCH (p)-[:serve*0..3]->(t) RETURN p """ - Then a ExecutionError should be raised at runtime: Scan vertices must specify limit number. + 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/Base.feature b/tests/tck/features/match/Base.feature index 2177de5273e..808a5db1092 100644 --- a/tests/tck/features/match/Base.feature +++ b/tests/tck/features/match/Base.feature @@ -596,22 +596,22 @@ Feature: Basic match """ MATCH (v) return v """ - Then a ExecutionError should be raised at runtime: Scan vertices must specify limit number. + 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 """ - Then a ExecutionError should be raised at runtime: Scan vertices must specify limit number. + 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 """ - Then a ExecutionError should be raised at runtime: Scan vertices must specify limit number. + 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{age:23}:bachelor) RETURN v """ - Then a ExecutionError should be raised at runtime: Scan vertices must specify limit number. + 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) return * @@ -621,11 +621,11 @@ Feature: Basic match """ MATCH () --> (v) --> () return * """ - Then a ExecutionError should be raised at runtime: Scan vertices must specify limit number. + 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. # The 0 step means node scan in fact, but p and t has no label or properties for index seek # So it's not workable now When executing query: """ MATCH (p)-[:serve*0..3]->(t) RETURN p """ - Then a ExecutionError should be raised at runtime: Scan vertices must specify limit number. + 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/Scan.feature b/tests/tck/features/match/Scan.feature index faf8e5cded3..9096d2cfcd4 100644 --- a/tests/tck/features/match/Scan.feature +++ b/tests/tck/features/match/Scan.feature @@ -84,14 +84,14 @@ Feature: Match seek by scan MATCH (v) RETURN v.name AS Name """ - Then a ExecutionError should be raised at runtime: Scan vertices must specify limit number. + 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"}) RETURN v.name AS Name LIMIT 3 """ - Then a ExecutionError should be raised at runtime: Scan vertices must specify limit number. + 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. Scenario: query edge by scan When executing query: @@ -154,4 +154,4 @@ Feature: Match seek by scan RETURN v.name, type(e) AS Type LIMIT 3 """ - Then a ExecutionError should be raised at runtime: Scan vertices must specify limit number. + 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/SeekByEdge.feature b/tests/tck/features/match/SeekByEdge.feature index 51c1983eb0b..4e91b88ec65 100644 --- a/tests/tck/features/match/SeekByEdge.feature +++ b/tests/tck/features/match/SeekByEdge.feature @@ -1469,7 +1469,7 @@ Feature: Match seek by edge MATCH (p1)-[:teammate]->(p2) RETURN p1.name, id(p2) """ - Then a ExecutionError should be raised at runtime: Scan vertices must specify limit number. + 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. Scenario Outline: seek by edge in a single edge type space Given an empty graph @@ -1490,16 +1490,16 @@ Feature: Match seek by edge MATCH (p1)-[]->(p2) RETURN p1.name, id(p2) """ - Then a ExecutionError should be raised at runtime: Scan vertices must specify limit number. + 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 (p1)-[b]->(p2) RETURN p1.name, id(p2) """ - Then a ExecutionError should be raised at runtime: Scan vertices must specify limit number. + 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 (p1)-[:edge_1]->(p2) RETURN p1.name, id(p2) """ - Then a ExecutionError should be raised at runtime: Scan vertices must specify limit number. + 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/SeekById.feature b/tests/tck/features/match/SeekById.feature index c3dd7f5ba72..ebc583aa433 100644 --- a/tests/tck/features/match/SeekById.feature +++ b/tests/tck/features/match/SeekById.feature @@ -222,14 +222,14 @@ Feature: Match seek by id WHERE NOT id(v) == 'Paul Gasol' RETURN v.name AS Name, v.age AS Age """ - Then a ExecutionError should be raised at runtime: Scan vertices must specify limit number. + 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) WHERE NOT id(v) IN ['James Harden', 'Jonathon Simmons', 'Klay Thompson', 'Dejounte Murray'] RETURN v.name AS Name """ - Then a ExecutionError should be raised at runtime: Scan vertices must specify limit number. + 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) @@ -237,7 +237,7 @@ Feature: Match seek by id OR v.age == 23 RETURN v.name AS Name """ - Then a ExecutionError should be raised at runtime: Scan vertices must specify limit number. + 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) @@ -245,7 +245,7 @@ Feature: Match seek by id OR v.age == 23 RETURN v.name AS Name """ - Then a ExecutionError should be raised at runtime: Scan vertices must specify limit number. + 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) @@ -266,7 +266,7 @@ Feature: Match seek by id WHERE id(v) IN ['James Harden', v.name] RETURN v.name AS Name """ - Then a ExecutionError should be raised at runtime: Scan vertices must specify limit number. + 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. Scenario: Start from end When executing query: diff --git a/tests/tck/features/match/SeekById.intVid.feature b/tests/tck/features/match/SeekById.intVid.feature index fb5fa4db1c2..e0ee24255b9 100644 --- a/tests/tck/features/match/SeekById.intVid.feature +++ b/tests/tck/features/match/SeekById.intVid.feature @@ -222,14 +222,14 @@ Feature: Match seek by id WHERE NOT id(v) == hash('Paul Gasol') RETURN v.name AS Name, v.age AS Age """ - Then a ExecutionError should be raised at runtime: Scan vertices must specify limit number. + 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) WHERE NOT id(v) IN [hash('James Harden'), hash('Jonathon Simmons'), hash('Klay Thompson'), hash('Dejounte Murray')] RETURN v.name AS Name """ - Then a ExecutionError should be raised at runtime: Scan vertices must specify limit number. + 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) @@ -237,7 +237,7 @@ Feature: Match seek by id OR v.age == 23 RETURN v.name AS Name """ - Then a ExecutionError should be raised at runtime: Scan vertices must specify limit number. + 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) @@ -245,7 +245,7 @@ Feature: Match seek by id OR v.age == 23 RETURN v.name AS Name """ - Then a ExecutionError should be raised at runtime: Scan vertices must specify limit number. + 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) @@ -259,7 +259,7 @@ Feature: Match seek by id WHERE id(v) IN [hash('James Harden'), v.name] RETURN v.name AS Name """ - Then a ExecutionError should be raised at runtime: Scan vertices must specify limit number. + 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. Scenario: with arithmetic When executing query: From 28716e7ff5c7ad349e08ebf392613eea61e63457 Mon Sep 17 00:00:00 2001 From: Shylock Hg <33566796+Shylock-Hg@users.noreply.github.com> Date: Thu, 23 Dec 2021 16:23:08 +0800 Subject: [PATCH 3/3] Fix cases. --- tests/tck/features/match/Base.IntVid.feature | 2 +- tests/tck/features/match/Base.feature | 2 +- tests/tck/features/match/Scan.feature | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/tck/features/match/Base.IntVid.feature b/tests/tck/features/match/Base.IntVid.feature index 4c29c2a3b38..0808dc173bc 100644 --- a/tests/tck/features/match/Base.IntVid.feature +++ b/tests/tck/features/match/Base.IntVid.feature @@ -507,7 +507,7 @@ Feature: Basic match """ MATCH () -[]-> (v) return * """ - Then a ExecutionError should be raised at runtime: Scan edges must specify limit number. + 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) --> () return * diff --git a/tests/tck/features/match/Base.feature b/tests/tck/features/match/Base.feature index 808a5db1092..def650c2de9 100644 --- a/tests/tck/features/match/Base.feature +++ b/tests/tck/features/match/Base.feature @@ -616,7 +616,7 @@ Feature: Basic match """ MATCH () -[]-> (v) return * """ - Then a ExecutionError should be raised at runtime: Scan edges must specify limit number. + 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) --> () return * diff --git a/tests/tck/features/match/Scan.feature b/tests/tck/features/match/Scan.feature index 9096d2cfcd4..1898b8fd99d 100644 --- a/tests/tck/features/match/Scan.feature +++ b/tests/tck/features/match/Scan.feature @@ -147,7 +147,7 @@ Feature: Match seek by scan MATCH ()-[e]->() RETURN type(e) AS Type """ - Then a ExecutionError should be raised at runtime: Scan edges must specify limit number. + 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)-[e]->()