Skip to content

Commit 24eb885

Browse files
committed
fix error
1 parent 162b6c1 commit 24eb885

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

src/graph/executor/algo/BFSShortestPathExecutor.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,12 @@ folly::Future<Status> BFSShortestPathExecutor::conjunctPath() {
135135
std::vector<folly::Future<DataSet>> futures;
136136
for (auto& vid : meetVids) {
137137
batchVids.push_back(vid);
138-
if (i == totalSize - 1 || batchVids.size() == batchSize) {
138+
if (++i == totalSize || batchVids.size() == batchSize) {
139139
auto future = folly::via(runner(), [this, vids = std::move(batchVids), oddStep]() {
140140
return doConjunct(vids, oddStep);
141141
});
142142
futures.emplace_back(std::move(future));
143143
}
144-
i++;
145144
}
146145

147146
return folly::collect(futures).via(runner()).thenValue([this](auto&& resps) {

src/graph/executor/algo/MultiShortestPathExecutor.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ folly::Future<Status> MultiShortestPathExecutor::execute() {
4949
historyRightPaths_[iter.first].insert(std::make_move_iterator(iter.second.begin()),
5050
std::make_move_iterator(iter.second.end()));
5151
}
52+
leftPaths_.clear();
53+
rightPaths_.clear();
5254

5355
step_++;
5456
DataSet ds;
@@ -66,13 +68,16 @@ void MultiShortestPathExecutor::init() {
6668
auto& vid = rIter->getColumn(0);
6769
if (rightVids.emplace(vid).second) {
6870
std::vector<Path> tmp({Path(Vertex(vid, {}), {})});
71+
historyRightPaths_[vid].emplace(vid, tmp);
6972
preRightPaths_[vid].emplace(vid, std::move(tmp));
7073
}
7174
}
7275

7376
std::set<Value> leftVids;
7477
for (; lIter->valid(); lIter->next()) {
7578
auto& vid = lIter->getColumn(0);
79+
std::vector<Path> tmp({Path(Vertex(vid, {}), {})});
80+
historyLeftPaths_[vid].emplace(vid, std::move(tmp));
7681
leftVids.emplace(vid);
7782
}
7883
for (const auto& leftVid : leftVids) {
@@ -130,8 +135,6 @@ Status MultiShortestPathExecutor::buildPath(bool reverse) {
130135
std::vector<Path> tmp({std::move(path)});
131136
currentPaths[dst].emplace(src, std::move(tmp));
132137
}
133-
std::vector<Path> start({Path(Vertex(src, {}), {})});
134-
currentPaths[src].emplace(src, std::move(start));
135138
}
136139
} else {
137140
auto& historyPaths = reverse ? historyRightPaths_ : historyLeftPaths_;

src/graph/executor/algo/ProduceAllPathsExecutor.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ folly::Future<Status> ProduceAllPathsExecutor::conjunctPath() {
132132

133133
auto startIter = leftPaths_.begin();
134134
for (auto leftIter = leftPaths_.begin(); leftIter != leftPaths_.end(); ++leftIter) {
135-
if (i++ == batchSize) {
135+
if (++i == batchSize) {
136136
auto endIter = leftIter;
137137
endIter++;
138138
auto oddStepFuture = folly::via(

src/graph/executor/test/FindPathTest.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ TEST_F(FindPathTest, multiSourceShortestPath) {
710710
{
711711
DataSet expectLeftVid;
712712
expectLeftVid.colNames = {nebula::kVid};
713-
for (const auto& vid : {"a", "b", "c", "f", "g"}) {
713+
for (const auto& vid : {"b", "f", "g"}) {
714714
Row row;
715715
row.values.emplace_back(vid);
716716
expectLeftVid.rows.emplace_back(std::move(row));

0 commit comments

Comments
 (0)