Skip to content

Commit

Permalink
Let the m to n steps return the data even if can't reach n steps.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shylock-Hg committed May 27, 2020
1 parent 9859793 commit 4f0c557
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/graph/GoExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,8 +587,13 @@ void GoExecutor::onStepOutResponse(RpcResponse &&rpcResp) {
auto dsts = getDstIdsFromResps(records_.end() - 1, records_.end());
starts_ = std::move(dsts);
if (starts_.empty()) {
onEmptyInputs();
return;
if (curStep_ < recordFrom_) {
onEmptyInputs();
return;
} else {
maybeFinishExecution();
return;
}
}
curStep_++;
stepOut();
Expand Down
30 changes: 29 additions & 1 deletion src/graph/test/GoTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2416,6 +2416,18 @@ TEST_P(GoTest, WithIntermediateData) {
auto code = client_->execute(query, resp);
ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code);

std::vector<std::tuple<int64_t>> expected = {
teams_["Spurs"].vid()
};
ASSERT_TRUE(verifyResult(resp, expected));
}
{
cpp2::ExecutionResponse resp;
auto *fmt = "GO 2 TO 3 STEPS FROM %ld OVER serve";
auto query = folly::stringPrintf(fmt, players_["Tim Duncan"].vid());
auto code = client_->execute(query, resp);
ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code);

std::vector<std::tuple<int64_t>> expected = {
};
ASSERT_TRUE(verifyResult(resp, expected));
Expand Down Expand Up @@ -2454,8 +2466,24 @@ TEST_P(GoTest, WithIntermediateData) {
auto code = client_->execute(query, resp);
ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code);

// Empty response
std::vector<std::tuple<int64_t>> expected = {
players_["Tim Duncan"].vid(),
players_["Tony Parker"].vid(),
players_["Manu Ginobili"].vid(),
players_["LaMarcus Aldridge"].vid(),
players_["Rudy Gay"].vid(),
players_["Marco Belinelli"].vid(),
players_["Danny Green"].vid(),
players_["Kyle Anderson"].vid(),
players_["Aron Baynes"].vid(),
players_["Boris Diaw"].vid(),
players_["Tiago Splitter"].vid(),
players_["Cory Joseph"].vid(),
players_["David West"].vid(),
players_["Jonathon Simmons"].vid(),
players_["Dejounte Murray"].vid(),
players_["Tracy McGrady"].vid(),
players_["Paul Gasol"].vid(),
};
ASSERT_TRUE(verifyResult(resp, expected));
}
Expand Down

0 comments on commit 4f0c557

Please sign in to comment.