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

all shortest path lower bound fix #1788

Merged
merged 1 commit into from
Jul 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/binder/bind/bind_graph_pattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,11 @@ std::pair<uint64_t, uint64_t> Binder::bindVariableLengthRelBound(
throw BinderException(
"Lower bound of rel " + relPattern.getVariableName() + " is greater than upperBound.");
}
if ((relPattern.getRelType() == QueryRelType::ALL_SHORTEST ||
relPattern.getRelType() == QueryRelType::SHORTEST) &&
lowerBound != 1) {
throw BinderException("Lower bound of shortest/all_shortest path must be 1.");
}
return std::make_pair(lowerBound, upperBound);
}

Expand Down
2 changes: 1 addition & 1 deletion test/optimizer/optimizer_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ TEST_F(OptimizerTest, RecursiveJoinTest) {
}

TEST_F(OptimizerTest, RecursiveJoinNoTrackPathTest) {
auto op = getRoot("MATCH (a:person)-[e:knows* SHORTEST 2..3]->(b:person) RETURN length(e);");
auto op = getRoot("MATCH (a:person)-[e:knows* SHORTEST 1..3]->(b:person) RETURN length(e);");
while (op->getOperatorType() != planner::LogicalOperatorType::RECURSIVE_EXTEND) {
op = op->getChild(0);
}
Expand Down
5 changes: 5 additions & 0 deletions test/test_files/exceptions/binder/binder_error.test
Original file line number Diff line number Diff line change
Expand Up @@ -449,3 +449,8 @@ Binder exception: Invalid option name: thread.
-STATEMENT CALL threads='abc'
---- error
Binder exception: abc has data type STRING. (INT64) was expected.

-CASE AllShortestPathInvalidLowerBound
-STATEMENT MATCH p = (a)-[* ALL SHORTEST 2..3]-(b) RETURN p
---- error
Binder exception: Lower bound of shortest/all_shortest path must be 1.
Loading