Skip to content

Commit

Permalink
delete push limit to shortestpath rule
Browse files Browse the repository at this point in the history
  • Loading branch information
nevermore3 committed Jul 26, 2023
1 parent 5929ab3 commit d1716f6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 185 deletions.
14 changes: 8 additions & 6 deletions src/graph/executor/algo/BFSShortestPathExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ folly::Future<Status> BFSShortestPathExecutor::execute() {
// MemoryTrackerVerified
SCOPED_TIMER(&execTime_);
pathNode_ = asNode<BFSShortestPath>(node());
if (pathNode_->limit() != -1) {
limit_ = pathNode_->limit();
}
terminateEarlyVar_ = pathNode_->terminateEarlyVar();

if (step_ == 1) {
Expand Down Expand Up @@ -194,24 +197,23 @@ folly::Future<Status> BFSShortestPathExecutor::conjunctPath() {
});
}

DataSet BFSShortestPathExecutor::doConjunct(const std::vector<Value>& meetVids,
bool oddStep) const {
DataSet BFSShortestPathExecutor::doConjunct(const std::vector<Value>& meetVids, bool oddStep) {
DataSet ds;
auto leftPaths = createPath(meetVids, false, oddStep);
auto rightPaths = createPath(meetVids, true, oddStep);
for (auto& leftPath : leftPaths) {
auto range = rightPaths.equal_range(leftPath.first);
for (auto& rightPath = range.first; rightPath != range.second; ++rightPath) {
cnt_.fetch_add(1, std::memory_order_relaxed);
if (cnt_.load(std::memory_order_relaxed) > limit_) {
return ds;
}
Path result = leftPath.second;
result.reverse();
result.append(rightPath->second);
Row row;
row.emplace_back(std::move(result));
ds.rows.emplace_back(std::move(row));
cnt_.fetch_add(1, std::memory_order_relaxed);
if (cnt_.load(std::memory_order_relaxed) > limit_) {
return ds;
}
}
}
return ds;
Expand Down
2 changes: 1 addition & 1 deletion src/graph/executor/algo/BFSShortestPathExecutor.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class BFSShortestPathExecutor final : public Executor {

folly::Future<Status> conjunctPath();

DataSet doConjunct(const std::vector<Value>& meetVids, bool oddStep) const;
DataSet doConjunct(const std::vector<Value>& meetVids, bool oddStep);

std::unordered_multimap<Value, Path> createPath(std::vector<Value> meetVids,
bool reverse,
Expand Down
8 changes: 4 additions & 4 deletions src/graph/executor/algo/MultiShortestPathExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,17 +239,17 @@ DataSet MultiShortestPathExecutor::doConjunct(
[this](const std::vector<Path>& leftPaths, const std::vector<Path>& rightPaths, DataSet& ds) {
for (const auto& leftPath : leftPaths) {
for (const auto& rightPath : rightPaths) {
cnt_.fetch_add(1, std::memory_order_relaxed);
if (cnt_.load(std::memory_order_relaxed) > limit_) {
break;
}
auto forwardPath = leftPath;
auto backwardPath = rightPath;
backwardPath.reverse();
forwardPath.append(std::move(backwardPath));
Row row;
row.values.emplace_back(std::move(forwardPath));
ds.rows.emplace_back(std::move(row));
cnt_.fetch_add(1, std::memory_order_relaxed);
if (cnt_.load(std::memory_order_relaxed) > limit_) {
break;
}
}
}
};
Expand Down
102 changes: 0 additions & 102 deletions src/graph/optimizer/rule/PushLimitDownShortestPathRule.cpp

This file was deleted.

72 changes: 0 additions & 72 deletions src/graph/optimizer/rule/PushLimitDownShortestPathRule.h

This file was deleted.

0 comments on commit d1716f6

Please sign in to comment.