Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make scan limit error more friendly. #3549

Merged
4 changes: 3 additions & 1 deletion src/graph/executor/query/ScanEdgesExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ folly::Future<Status> ScanEdgesExecutor::scanEdges() {
StorageClient *client = qctx()->getStorageClient();
auto *se = asNode<ScanEdges>(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 not push down.");
}

time::Duration scanEdgesTime;
Expand Down
4 changes: 3 additions & 1 deletion src/graph/executor/query/ScanVerticesExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ folly::Future<Status> ScanVerticesExecutor::scanVertices() {

auto *sv = asNode<ScanVertices>(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 not push down.");
}
StorageClient *storageClient = qctx()->getStorageClient();

Expand Down
14 changes: 7 additions & 7 deletions tests/tck/features/match/Base.IntVid.feature
Original file line number Diff line number Diff line change
Expand Up @@ -487,36 +487,36 @@ 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 *
"""
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 *
"""
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.
14 changes: 7 additions & 7 deletions tests/tck/features/match/Base.feature
Original file line number Diff line number Diff line change
Expand Up @@ -596,36 +596,36 @@ 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These error messages are really not friendly and are implementation-specific.

When executing query:
"""
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 *
"""
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.
12 changes: 6 additions & 6 deletions tests/tck/features/match/Scan.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -147,25 +147,25 @@ 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]->()
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.
When executing query:
"""
MATCH ()-[e:is_teacher]-()
RETURN type(e) AS Type, e.start_year AS StartYear, e.end_year AS EndYear
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.
When executing query:
"""
MATCH ()-[e]-()
RETURN type(e) AS Type, e.start_year AS StartYear, e.end_year AS EndYear
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.
8 changes: 4 additions & 4 deletions tests/tck/features/match/SeekByEdge.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
10 changes: 5 additions & 5 deletions tests/tck/features/match/SeekById.feature
Original file line number Diff line number Diff line change
Expand Up @@ -222,30 +222,30 @@ 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)
WHERE id(v) IN ['James Harden', 'Jonathon Simmons', 'Klay Thompson', 'Dejounte Murray']
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)
WHERE id(v) == 'James Harden'
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)
Expand All @@ -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:
Expand Down
10 changes: 5 additions & 5 deletions tests/tck/features/match/SeekById.intVid.feature
Original file line number Diff line number Diff line change
Expand Up @@ -222,30 +222,30 @@ 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)
WHERE id(v) IN [hash('James Harden'), hash('Jonathon Simmons'), hash('Klay Thompson'), hash('Dejounte Murray')]
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)
WHERE id(v) == hash('James Harden')
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)
Expand All @@ -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:
Expand Down