Skip to content

Commit

Permalink
Disable the bidirection edges (#3507)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shylock-Hg authored Dec 27, 2021
1 parent e995235 commit fd8d8a8
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/graph/optimizer/rule/GetEdgesTransformRule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ StatusOr<OptRule::TransformResult> GetEdgesTransformRule::transform(
OptGroupNode::create(ctx, newAppendVertices, appendVerticesGroupNode->group());

auto *newScanEdges = traverseToScanEdges(traverse);
if (newScanEdges == nullptr) {
return TransformResult::noTransform();
}
auto newScanEdgesGroup = OptGroup::create(ctx);
auto newScanEdgesGroupNode = newScanEdgesGroup->makeGroupNode(newScanEdges);

Expand Down Expand Up @@ -102,6 +105,18 @@ std::string GetEdgesTransformRule::toString() const {
/*static*/ graph::ScanEdges *GetEdgesTransformRule::traverseToScanEdges(
const graph::Traverse *traverse) {
const auto *edgeProps = traverse->edgeProps();
if (edgeProps == nullptr) {
return nullptr;
}
for (std::size_t i = 0; i < edgeProps->size(); i++) {
auto type = (*edgeProps)[i].get_type();
for (std::size_t j = i + 1; j < edgeProps->size(); j++) {
if (type == -((*edgeProps)[j].get_type())) {
// Don't support to retrieve edges of the inbound/outbound together
return nullptr;
}
}
}
auto scanEdges = ScanEdges::make(
traverse->qctx(),
nullptr,
Expand Down
14 changes: 14 additions & 0 deletions tests/tck/features/match/Scan.feature
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,17 @@ Feature: Match seek by scan
LIMIT 3
"""
Then a ExecutionError should be raised at runtime: Scan vertices must specify limit number.
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.
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.

0 comments on commit fd8d8a8

Please sign in to comment.