diff --git a/src/graph/GoExecutor.cpp b/src/graph/GoExecutor.cpp index abb6ec02adb..d73c191e887 100644 --- a/src/graph/GoExecutor.cpp +++ b/src/graph/GoExecutor.cpp @@ -589,11 +589,12 @@ void GoExecutor::stepOut() { void GoExecutor::onStepOutResponse(RpcResponse &&rpcResp) { joinResp(std::move(rpcResp)); + // back trace each step + CHECK_GT(records_.size(), 0); + auto dsts = getDstIdsFromRespWithBackTrack(records_.back()); if (isFinalStep()) { GO_EXIT(); } else { - CHECK_GT(records_.size(), 0); - auto dsts = getDstIdsFromResps(records_.end() - 1, records_.end()); starts_ = std::move(dsts); if (starts_.empty()) { GO_EXIT(); @@ -650,9 +651,6 @@ std::vector GoExecutor::getDstIdsFromResps(std::vector::i for (const auto &edata : vdata.edge_data) { for (const auto& edge : edata.get_edges()) { auto dst = edge.get_dst(); - if (!isFinalStep() && backTracker_ != nullptr) { - backTracker_->add(vdata.get_vertex_id(), dst); - } set.emplace(dst); } } @@ -662,6 +660,47 @@ std::vector GoExecutor::getDstIdsFromResps(std::vector::i return std::vector(set.begin(), set.end()); } +std::vector GoExecutor::getDstIdsFromRespWithBackTrack(const RpcResponse &rpcResp) const { + // back trace in current step + // To avoid overlap in current step edges + // For example + // Dst , Src + // 6 , 1 + // 7 , 6 + // Will mistake lead to 7->6 if insert edge(dst, src) one by one + // So read all roots of current step first , then insert them + std::multimap backTrace; + std::unordered_set set; + for (const auto &resp : rpcResp.responses()) { + auto *vertices = resp.get_vertices(); + if (vertices == nullptr) { + continue; + } + + for (const auto &vdata : *vertices) { + for (const auto &edata : vdata.edge_data) { + for (const auto& edge : edata.get_edges()) { + auto dst = edge.get_dst(); + if (!isFinalStep() && backTracker_ != nullptr) { + auto range = backTracker_->get(vdata.get_vertex_id()); + if (range.first == range.second) { // not found root + backTrace.emplace(dst, vdata.get_vertex_id()); + } + for (auto trace = range.first; trace != range.second; ++trace) { + backTrace.emplace(dst, trace->second); + } + } + set.emplace(dst); + } + } + } + } + if (!isFinalStep() && backTracker_ != nullptr) { + backTracker_->inject(backTrace); + } + return std::vector(set.begin(), set.end()); +} + void GoExecutor::finishExecution() { // MayBe we can do better. std::vector> yc; @@ -1071,15 +1110,15 @@ bool GoExecutor::processFinalResult(Callback cb) const { VLOG(1) << "Total vdata.edge_data size " << vdata.edge_data.size(); auto tagData = vdata.get_tag_data(); auto srcId = vdata.get_vertex_id(); - const auto rootId = getRoot(srcId, recordIn); - auto inputRows = index_->rowsOfVid(rootId); + const auto roots = getRoots(srcId, recordIn); + auto inputRows = index_->rowsOfVids(roots); // Here if join the input we extend the input rows coresponding to current vertex; // Or just loop once as previous that not join anything, // in fact result what in responses. bool notJoinOnce = false; - for (auto inputRow = inputRows.first; - !joinInput || inputRow != inputRows.second; - joinInput ? ++inputRow : inputRow) { + for (auto inputRow = inputRows.begin(); + !joinInput || inputRow != inputRows.end(); + joinInput ? ++inputRow : inputRow) { if (!joinInput) { if (notJoinOnce) { break; @@ -1176,11 +1215,11 @@ bool GoExecutor::processFinalResult(Callback cb) const { return ret.value(); }; getters.getVariableProp = [inputRow, this] (const std::string &prop) { - return index_->getColumnWithRow(inputRow->second, prop); + return index_->getColumnWithRow(*inputRow, prop); }; getters.getInputProp = [inputRow, this] (const std::string &prop) { - return index_->getColumnWithRow(inputRow->second, prop); + return index_->getColumnWithRow(*inputRow, prop); }; std::unique_ptr reader; @@ -1269,8 +1308,8 @@ bool GoExecutor::processFinalResult(Callback cb) const { } } // for edges } // for edata - } // for `vdata' - } // extend input rows + } // for input rows + } // for vdata } // for `resp' } return true; diff --git a/src/graph/GoExecutor.h b/src/graph/GoExecutor.h index 9154891579b..283c9423aa6 100644 --- a/src/graph/GoExecutor.h +++ b/src/graph/GoExecutor.h @@ -86,16 +86,6 @@ class GoExecutor final : public TraverseExecutor { return false; } - VertexID getRoot(VertexID srcId, std::size_t record) const { - CHECK_GT(record, 0); - VertexID rootId = srcId; - if (record == 1) { - return rootId; - } - rootId = DCHECK_NOTNULL(backTracker_)->get(srcId); - return rootId; - } - /** * To obtain the source ids from various places, * such as the literal id list, inputs from the pipeline or results of variable. @@ -141,6 +131,8 @@ class GoExecutor final : public TraverseExecutor { std::vector getDstIdsFromResps(std::vector::iterator begin, std::vector::iterator end) const; + std::vector getDstIdsFromRespWithBackTrack(const RpcResponse &rpcResp) const; + /** * get the edgeName when over all edges */ @@ -196,23 +188,20 @@ class GoExecutor final : public TraverseExecutor { class VertexBackTracker final { public: - void add(VertexID src, VertexID dst) { - VertexID value = src; - auto iter = mapping_.find(src); - if (iter != mapping_.end()) { - value = iter->second; + void inject(const std::multimap &backTrace) { + // TODO(shylock) c++17 merge directly + for (const auto iter : backTrace) { + mapping_.emplace(iter.first, iter.second); } - mapping_[dst] = value; } - VertexID get(VertexID id) { - auto iter = mapping_.find(id); - DCHECK(iter != mapping_.end()); - return iter->second; + auto get(VertexID id) const { + auto range = mapping_.equal_range(id); + return range; } private: - std::unordered_map mapping_; + std::multimap mapping_; }; enum FromType { @@ -224,6 +213,21 @@ class GoExecutor final : public TraverseExecutor { // Join the RPC response to previous data void joinResp(RpcResponse &&resp); + std::vector getRoots(VertexID srcId, std::size_t record) const { + CHECK_GT(record, 0); + std::vector ids; + if (record == 1) { + ids.emplace_back(srcId); + return ids; + } + const auto range = DCHECK_NOTNULL(backTracker_)->get(srcId); + for (auto i = range.first; i != range.second; ++i) { + ids.emplace_back(i->second); + } + return ids; + } + + private: GoSentence *sentence_{nullptr}; FromType fromType_{kInstantExpr}; diff --git a/src/graph/InterimResult.h b/src/graph/InterimResult.h index 8f2933c98a5..d59234c18f3 100644 --- a/src/graph/InterimResult.h +++ b/src/graph/InterimResult.h @@ -92,6 +92,17 @@ class InterimResult final { return vidToRowIndex_.equal_range(id); } + std::vector rowsOfVids(const std::vector &ids) { + std::vector rows; + for (const auto vid : ids) { + const auto range = rowsOfVid(vid); + for (auto i = range.first; i != range.second; ++i) { + rows.emplace_back(i->second); + } + } + return rows; + } + private: friend class InterimResult; using Row = std::vector; diff --git a/src/graph/test/GoTest.cpp b/src/graph/test/GoTest.cpp index 9f4114c060d..db1745aedb8 100644 --- a/src/graph/test/GoTest.cpp +++ b/src/graph/test/GoTest.cpp @@ -2925,13 +2925,21 @@ TEST_P(GoTest, issue2087_go_cover_input) { {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid()}, {players_["Tim Duncan"].vid(), players_["Tim Duncan"].vid()}, + {players_["Tim Duncan"].vid(), players_["Tim Duncan"].vid()}, + {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid()}, {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid()}, {players_["Tim Duncan"].vid(), players_["LaMarcus Aldridge"].vid()}, + {players_["Tim Duncan"].vid(), players_["LaMarcus Aldridge"].vid()}, + {players_["Tim Duncan"].vid(), players_["Tim Duncan"].vid()}, + {players_["Tim Duncan"].vid(), players_["Tim Duncan"].vid()}, {players_["Tim Duncan"].vid(), players_["Tim Duncan"].vid()}, {players_["Tim Duncan"].vid(), players_["Tim Duncan"].vid()}, {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid()}, + {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid()}, + {players_["Tim Duncan"].vid(), players_["LaMarcus Aldridge"].vid()}, {players_["Tim Duncan"].vid(), players_["LaMarcus Aldridge"].vid()}, {players_["Tim Duncan"].vid(), players_["Tim Duncan"].vid()}, + {players_["Tim Duncan"].vid(), players_["Tim Duncan"].vid()}, }; ASSERT_TRUE(verifyResult(resp, expected)); } @@ -2947,39 +2955,31 @@ TEST_P(GoTest, issue2087_go_cover_input) { ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector> expected = { - {players_["Tim Duncan"].vid(), players_["Tony Parker"].vid(), - players_["Tony Parker"].vid(), 95}, - {players_["Tim Duncan"].vid(), players_["Tony Parker"].vid(), - players_["Manu Ginobili"].vid(), 95}, - {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid(), - players_["Tony Parker"].vid(), 95}, - {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid(), - players_["Manu Ginobili"].vid(), 95}, - {players_["Tim Duncan"].vid(), players_["Tony Parker"].vid(), - players_["Tony Parker"].vid(), 95}, - {players_["Tim Duncan"].vid(), players_["Tony Parker"].vid(), - players_["Manu Ginobili"].vid(), 95}, - {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid(), - players_["Tony Parker"].vid(), 95}, - {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid(), - players_["Manu Ginobili"].vid(), 95}, - - {players_["Tim Duncan"].vid(), players_["Tony Parker"].vid(), - players_["Tim Duncan"].vid(), 95}, - {players_["Tim Duncan"].vid(), players_["Tony Parker"].vid(), - players_["Manu Ginobili"].vid(), 95}, - {players_["Tim Duncan"].vid(), players_["Tony Parker"].vid(), - players_["LaMarcus Aldridge"].vid(), 90}, - {players_["Tim Duncan"].vid(), players_["Tony Parker"].vid(), - players_["Tim Duncan"].vid(), 90}, - {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid(), - players_["Tim Duncan"].vid(), 95}, - {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid(), - players_["Manu Ginobili"].vid(), 95}, - {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid(), - players_["LaMarcus Aldridge"].vid(), 90}, - {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid(), - players_["Tim Duncan"].vid(), 90}, + {players_["Tim Duncan"].vid(), players_["Tony Parker"].vid(), players_["Tony Parker"].vid(), 95}, // NOLINT + {players_["Tim Duncan"].vid(), players_["Tony Parker"].vid(), players_["Manu Ginobili"].vid(), 95}, // NOLINT + {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid(), players_["Tony Parker"].vid(), 95}, // NOLINT + {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid(), players_["Manu Ginobili"].vid(), 95}, // NOLINT + {players_["Tim Duncan"].vid(), players_["Tony Parker"].vid(), players_["Tony Parker"].vid(), 95}, // NOLINT + {players_["Tim Duncan"].vid(), players_["Tony Parker"].vid(), players_["Manu Ginobili"].vid(), 95}, // NOLINT + {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid(), players_["Tony Parker"].vid(), 95}, // NOLINT + {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid(), players_["Manu Ginobili"].vid(), 95}, // NOLINT + + {players_["Tim Duncan"].vid(), players_["Tony Parker"].vid(), players_["Tim Duncan"].vid(), 95}, // NOLINT + {players_["Tim Duncan"].vid(), players_["Tony Parker"].vid(), players_["Tim Duncan"].vid(), 95}, // NOLINT + {players_["Tim Duncan"].vid(), players_["Tony Parker"].vid(), players_["Manu Ginobili"].vid(), 95}, // NOLINT + {players_["Tim Duncan"].vid(), players_["Tony Parker"].vid(), players_["Manu Ginobili"].vid(), 95}, // NOLINT + {players_["Tim Duncan"].vid(), players_["Tony Parker"].vid(), players_["LaMarcus Aldridge"].vid(), 90}, // NOLINT + {players_["Tim Duncan"].vid(), players_["Tony Parker"].vid(), players_["LaMarcus Aldridge"].vid(), 90}, // NOLINT + {players_["Tim Duncan"].vid(), players_["Tony Parker"].vid(), players_["Tim Duncan"].vid(), 90}, // NOLINT + {players_["Tim Duncan"].vid(), players_["Tony Parker"].vid(), players_["Tim Duncan"].vid(), 90}, // NOLINT + {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid(), players_["Tim Duncan"].vid(), 95}, // NOLINT + {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid(), players_["Tim Duncan"].vid(), 95}, // NOLINT + {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid(), players_["Manu Ginobili"].vid(), 95}, // NOLINT + {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid(), players_["Manu Ginobili"].vid(), 95}, // NOLINT + {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid(), players_["LaMarcus Aldridge"].vid(), 90}, // NOLINT + {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid(), players_["LaMarcus Aldridge"].vid(), 90}, // NOLINT + {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid(), players_["Tim Duncan"].vid(), 90}, // NOLINT + {players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid(), players_["Tim Duncan"].vid(), 90}, // NOLINT }; ASSERT_TRUE(verifyResult(resp, expected)); } @@ -2995,14 +2995,10 @@ TEST_P(GoTest, issue2087_go_cover_input) { ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector> expected = { - {players_["Danny Green"].vid(), players_["Tim Duncan"].vid(), - players_["Tony Parker"].vid()}, - {players_["Danny Green"].vid(), players_["Tim Duncan"].vid(), - players_["Manu Ginobili"].vid()}, - {players_["Danny Green"].vid(), players_["Tim Duncan"].vid(), - players_["LaMarcus Aldridge"].vid()}, - {players_["Danny Green"].vid(), players_["Tim Duncan"].vid(), - players_["Danny Green"].vid()}, + {players_["Danny Green"].vid(), players_["Tim Duncan"].vid(), players_["Tony Parker"].vid()}, // NOLINT + {players_["Danny Green"].vid(), players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid()}, // NOLINT + {players_["Danny Green"].vid(), players_["Tim Duncan"].vid(), players_["LaMarcus Aldridge"].vid()}, // NOLINT + {players_["Danny Green"].vid(), players_["Tim Duncan"].vid(), players_["Danny Green"].vid()}, // NOLINT }; ASSERT_TRUE(verifyResult(resp, expected)); } @@ -3016,19 +3012,97 @@ TEST_P(GoTest, issue2087_go_cover_input) { ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); std::vector> expected = { - {players_["Danny Green"].vid(), players_["Tim Duncan"].vid(), - players_["Tony Parker"].vid()}, - {players_["Danny Green"].vid(), players_["Tim Duncan"].vid(), - players_["Manu Ginobili"].vid()}, - {players_["Danny Green"].vid(), players_["Tim Duncan"].vid(), - players_["LaMarcus Aldridge"].vid()}, - {players_["Danny Green"].vid(), players_["Tim Duncan"].vid(), - players_["Danny Green"].vid()}, + {players_["Danny Green"].vid(), players_["Tim Duncan"].vid(), players_["Tony Parker"].vid()}, // NOLINT + {players_["Danny Green"].vid(), players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid()}, // NOLINT + {players_["Danny Green"].vid(), players_["Tim Duncan"].vid(), players_["LaMarcus Aldridge"].vid()}, // NOLINT + {players_["Danny Green"].vid(), players_["Tim Duncan"].vid(), players_["Danny Green"].vid()}, // NOLINT }; ASSERT_TRUE(verifyResult(resp, expected)); } } +TEST_P(GoTest, issueBackTrackOverlap) { + // require there are edges in one steps like below: + // dst, src + // 7 , 1 + // 1 , 7 + // In total , one src is anthoer one's dst + { + std::vector> expected = { + {players_["Tony Parker"].vid(), players_["Tim Duncan"].vid(), players_["Tim Duncan"].vid(), players_["Tony Parker"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["Manu Ginobili"].vid(), players_["Tim Duncan"].vid(), players_["Tony Parker"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Tim Duncan"].vid(), players_["Tony Parker"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["Tim Duncan"].vid(), players_["Tim Duncan"].vid(), players_["Tony Parker"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["Manu Ginobili"].vid(), players_["Tim Duncan"].vid(), players_["Tony Parker"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Tim Duncan"].vid(), players_["Tony Parker"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["Tim Duncan"].vid(), players_["Tim Duncan"].vid(), players_["Tony Parker"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["Manu Ginobili"].vid(), players_["Tim Duncan"].vid(), players_["Tony Parker"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Tim Duncan"].vid(), players_["Tony Parker"].vid()}, // NOLINT + + {players_["Tony Parker"].vid(), players_["Tim Duncan"].vid(), players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["Manu Ginobili"].vid(), players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["Tim Duncan"].vid(), players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["Manu Ginobili"].vid(), players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["Tim Duncan"].vid(), players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["Manu Ginobili"].vid(), players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid()}, // NOLINT + + {players_["Tony Parker"].vid(), players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid(), players_["Tim Duncan"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["Manu Ginobili"].vid(), players_["Manu Ginobili"].vid(), players_["Tim Duncan"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Manu Ginobili"].vid(), players_["Tim Duncan"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid(), players_["Tim Duncan"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["Manu Ginobili"].vid(), players_["Manu Ginobili"].vid(), players_["Tim Duncan"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Manu Ginobili"].vid(), players_["Tim Duncan"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["Tim Duncan"].vid(), players_["Manu Ginobili"].vid(), players_["Tim Duncan"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["Manu Ginobili"].vid(), players_["Manu Ginobili"].vid(), players_["Tim Duncan"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Manu Ginobili"].vid(), players_["Tim Duncan"].vid()}, // NOLINT + + {players_["Tony Parker"].vid(), players_["Tim Duncan"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Tony Parker"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["Manu Ginobili"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Tony Parker"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["LaMarcus Aldridge"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Tony Parker"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["Tim Duncan"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Tony Parker"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["Manu Ginobili"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Tony Parker"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["LaMarcus Aldridge"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Tony Parker"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["Tim Duncan"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Tony Parker"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["Manu Ginobili"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Tony Parker"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["LaMarcus Aldridge"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Tony Parker"].vid()}, // NOLINT + + {players_["Tony Parker"].vid(), players_["Tim Duncan"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Tim Duncan"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["Manu Ginobili"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Tim Duncan"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["LaMarcus Aldridge"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Tim Duncan"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["Tim Duncan"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Tim Duncan"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["Manu Ginobili"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Tim Duncan"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["LaMarcus Aldridge"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Tim Duncan"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["Tim Duncan"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Tim Duncan"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["Manu Ginobili"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Tim Duncan"].vid()}, // NOLINT + {players_["Tony Parker"].vid(), players_["LaMarcus Aldridge"].vid(), players_["LaMarcus Aldridge"].vid(), players_["Tim Duncan"].vid()}, // NOLINT + }; + { + cpp2::ExecutionResponse resp; + auto *fmt = "GO FROM %ld OVER like YIELD like._src as src, like._dst as dst " + "| GO 2 STEPS FROM $-.src OVER like YIELD $-.src, $-.dst, like._src, like._dst"; + auto query = folly::stringPrintf(fmt, players_["Tony Parker"].vid()); + auto code = client_->execute(query, resp); + ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); + + ASSERT_TRUE(verifyResult(resp, expected)); + } + { + cpp2::ExecutionResponse resp; + auto *fmt = "$a = GO FROM %ld OVER like YIELD like._src as src, like._dst as dst; " + "GO 2 STEPS FROM $a.src OVER like YIELD $a.src, $a.dst, like._src, like._dst"; + auto query = folly::stringPrintf(fmt, players_["Tony Parker"].vid()); + auto code = client_->execute(query, resp); + ASSERT_EQ(cpp2::ErrorCode::SUCCEEDED, code); + + ASSERT_TRUE(verifyResult(resp, expected)); + } + } +} + INSTANTIATE_TEST_CASE_P(IfPushdownFilter, GoTest, ::testing::Bool()); + } // namespace graph } // namespace nebula