diff --git a/src/graph/executor/Executor.cpp b/src/graph/executor/Executor.cpp index 6eca3fbaae0..8c0afcb6861 100644 --- a/src/graph/executor/Executor.cpp +++ b/src/graph/executor/Executor.cpp @@ -530,14 +530,14 @@ Executor *Executor::makeExecutor(QueryContext *qctx, const PlanNode *node) { case PlanNode::Kind::kAppendVertices: { return pool->makeAndAdd(node, qctx); } - case PlanNode::Kind::kBiLeftJoin: { - return pool->makeAndAdd(node, qctx); + case PlanNode::Kind::kHashLeftJoin: { + return pool->makeAndAdd(node, qctx); } - case PlanNode::Kind::kBiInnerJoin: { - return pool->makeAndAdd(node, qctx); + case PlanNode::Kind::kHashInnerJoin: { + return pool->makeAndAdd(node, qctx); } - case PlanNode::Kind::kBiCartesianProduct: { - return pool->makeAndAdd(node, qctx); + case PlanNode::Kind::kCrossJoin: { + return pool->makeAndAdd(node, qctx); } case PlanNode::Kind::kRollUpApply: { return pool->makeAndAdd(node, qctx); diff --git a/src/graph/executor/algo/CartesianProductExecutor.cpp b/src/graph/executor/algo/CartesianProductExecutor.cpp index 125653dc6b0..147b60e5af1 100644 --- a/src/graph/executor/algo/CartesianProductExecutor.cpp +++ b/src/graph/executor/algo/CartesianProductExecutor.cpp @@ -50,20 +50,20 @@ void CartesianProductExecutor::doCartesianProduct(const DataSet& lds, } } -BiCartesianProductExecutor::BiCartesianProductExecutor(const PlanNode* node, QueryContext* qctx) +CrossJoinExecutor::CrossJoinExecutor(const PlanNode* node, QueryContext* qctx) : CartesianProductExecutor(node, qctx) { - name_ = "BiCartesianProductExecutor"; + name_ = "CrossJoinExecutor"; } -folly::Future BiCartesianProductExecutor::execute() { +folly::Future CrossJoinExecutor::execute() { SCOPED_TIMER(&execTime_); - auto* BiCP = asNode(node()); - const auto& lds = ectx_->getResult(BiCP->leftInputVar()).value().getDataSet(); - const auto& rds = ectx_->getResult(BiCP->rightInputVar()).value().getDataSet(); + auto* cj = asNode(node()); + const auto& lds = ectx_->getResult(cj->leftInputVar()).value().getDataSet(); + const auto& rds = ectx_->getResult(cj->rightInputVar()).value().getDataSet(); DataSet result; doCartesianProduct(lds, rds, result); - result.colNames = BiCP->colNames(); + result.colNames = cj->colNames(); return finish(ResultBuilder().value(Value(std::move(result))).build()); } } // namespace graph diff --git a/src/graph/executor/algo/CartesianProductExecutor.h b/src/graph/executor/algo/CartesianProductExecutor.h index 6042642d214..46a8a07c280 100644 --- a/src/graph/executor/algo/CartesianProductExecutor.h +++ b/src/graph/executor/algo/CartesianProductExecutor.h @@ -23,9 +23,9 @@ class CartesianProductExecutor : public Executor { std::vector> colNames_; }; -class BiCartesianProductExecutor : public CartesianProductExecutor { +class CrossJoinExecutor : public CartesianProductExecutor { public: - BiCartesianProductExecutor(const PlanNode* node, QueryContext* qctx); + CrossJoinExecutor(const PlanNode* node, QueryContext* qctx); folly::Future execute() override; }; diff --git a/src/graph/executor/query/InnerJoinExecutor.cpp b/src/graph/executor/query/InnerJoinExecutor.cpp index 0379b0f558a..0919b939c23 100644 --- a/src/graph/executor/query/InnerJoinExecutor.cpp +++ b/src/graph/executor/query/InnerJoinExecutor.cpp @@ -245,29 +245,29 @@ void InnerJoinExecutor::buildNewRow(const std::unordered_mapkind() == PlanNode::Kind::kBiInnerJoin) { - return node_->asNode()->leftInputVar(); + if (node_->kind() == PlanNode::Kind::kHashInnerJoin) { + return node_->asNode()->leftInputVar(); } else { return node_->asNode()->leftVar().first; } } const std::string& InnerJoinExecutor::rightVar() const { - if (node_->kind() == PlanNode::Kind::kBiInnerJoin) { - return node_->asNode()->rightInputVar(); + if (node_->kind() == PlanNode::Kind::kHashInnerJoin) { + return node_->asNode()->rightInputVar(); } else { return node_->asNode()->rightVar().first; } } -BiInnerJoinExecutor::BiInnerJoinExecutor(const PlanNode* node, QueryContext* qctx) +HashInnerJoinExecutor::HashInnerJoinExecutor(const PlanNode* node, QueryContext* qctx) : InnerJoinExecutor(node, qctx) { - name_ = "BiInnerJoinExecutor"; + name_ = "HashInnerJoinExecutor"; } -folly::Future BiInnerJoinExecutor::execute() { +folly::Future HashInnerJoinExecutor::execute() { SCOPED_TIMER(&execTime_); - auto* joinNode = asNode(node()); + auto* joinNode = asNode(node()); NG_RETURN_IF_ERROR(checkBiInputDataSets()); return join(joinNode->hashKeys(), joinNode->probeKeys(), joinNode->colNames()); } diff --git a/src/graph/executor/query/InnerJoinExecutor.h b/src/graph/executor/query/InnerJoinExecutor.h index 4cdbf95d9db..786bbe540e6 100644 --- a/src/graph/executor/query/InnerJoinExecutor.h +++ b/src/graph/executor/query/InnerJoinExecutor.h @@ -60,9 +60,9 @@ class InnerJoinExecutor : public JoinExecutor { // No diffrence with inner join in processing data, but the dependencies would be executed in // paralell. -class BiInnerJoinExecutor final : public InnerJoinExecutor { +class HashInnerJoinExecutor final : public InnerJoinExecutor { public: - BiInnerJoinExecutor(const PlanNode* node, QueryContext* qctx); + HashInnerJoinExecutor(const PlanNode* node, QueryContext* qctx); folly::Future execute() override; }; diff --git a/src/graph/executor/query/JoinExecutor.cpp b/src/graph/executor/query/JoinExecutor.cpp index 897cacf848c..2f917b8a55f 100644 --- a/src/graph/executor/query/JoinExecutor.cpp +++ b/src/graph/executor/query/JoinExecutor.cpp @@ -33,7 +33,7 @@ Status JoinExecutor::checkInputDataSets() { } Status JoinExecutor::checkBiInputDataSets() { - auto* join = asNode(node()); + auto* join = asNode(node()); lhsIter_ = ectx_->getResult(join->leftInputVar()).iter(); DCHECK(!!lhsIter_); if (lhsIter_->isGetNeighborsIter() || lhsIter_->isDefaultIter()) { diff --git a/src/graph/executor/query/LeftJoinExecutor.cpp b/src/graph/executor/query/LeftJoinExecutor.cpp index 855290bab7d..b21aaa34969 100644 --- a/src/graph/executor/query/LeftJoinExecutor.cpp +++ b/src/graph/executor/query/LeftJoinExecutor.cpp @@ -221,14 +221,14 @@ void LeftJoinExecutor::buildNewRow(const std::unordered_map BiLeftJoinExecutor::execute() { +folly::Future HashLeftJoinExecutor::execute() { SCOPED_TIMER(&execTime_); - auto* joinNode = asNode(node()); + auto* joinNode = asNode(node()); auto& rhsResult = ectx_->getResult(joinNode->rightInputVar()); rightColSize_ = rhsResult.valuePtr()->getDataSet().colNames.size(); NG_RETURN_IF_ERROR(checkBiInputDataSets()); diff --git a/src/graph/executor/query/LeftJoinExecutor.h b/src/graph/executor/query/LeftJoinExecutor.h index 4c39b6d58db..37c14ce99e7 100644 --- a/src/graph/executor/query/LeftJoinExecutor.h +++ b/src/graph/executor/query/LeftJoinExecutor.h @@ -56,9 +56,9 @@ class LeftJoinExecutor : public JoinExecutor { // No diffrence with left join in processing data, but the dependencies would be executed in // paralell. -class BiLeftJoinExecutor final : public LeftJoinExecutor { +class HashLeftJoinExecutor final : public LeftJoinExecutor { public: - BiLeftJoinExecutor(const PlanNode* node, QueryContext* qctx); + HashLeftJoinExecutor(const PlanNode* node, QueryContext* qctx); folly::Future execute() override; }; diff --git a/src/graph/executor/test/JoinTest.cpp b/src/graph/executor/test/JoinTest.cpp index 98fecc66c00..99ad3893869 100644 --- a/src/graph/executor/test/JoinTest.cpp +++ b/src/graph/executor/test/JoinTest.cpp @@ -209,7 +209,7 @@ TEST_F(JoinTest, InnerJoin) { testInnerJoin("var2", "var1", expected, __LINE__); } -TEST_F(JoinTest, BiInnerJoin) { +TEST_F(JoinTest, HashInnerJoin) { DataSet expected; expected.colNames = {"v1", "e1", "v2", "v3", "e2"}; Row row1; @@ -243,9 +243,10 @@ TEST_F(JoinTest, BiInnerJoin) { rhs->setOutputVar("var5"); rhs->setColNames({"v2", "e2", "v3"}); - auto* join = BiInnerJoin::make(qctx_.get(), lhs, rhs, std::move(hashKeys), std::move(probeKeys)); + auto* join = + HashInnerJoin::make(qctx_.get(), lhs, rhs, std::move(hashKeys), std::move(probeKeys)); - auto joinExe = std::make_unique(join, qctx_.get()); + auto joinExe = std::make_unique(join, qctx_.get()); auto future = joinExe->execute(); auto status = std::move(future).get(); EXPECT_TRUE(status.ok()); @@ -380,7 +381,7 @@ TEST_F(JoinTest, LeftJoin) { testLeftJoin("var1", "var2", expected, __LINE__); } -TEST_F(JoinTest, BiLeftJoin) { +TEST_F(JoinTest, HashLeftJoin) { DataSet expected; expected.colNames = {"v2", "e2", "v3", "v1", "e1"}; Row row1; @@ -422,9 +423,9 @@ TEST_F(JoinTest, BiLeftJoin) { rhs->setOutputVar("var4"); rhs->setColNames({"v1", "e1", "v2", "v3"}); - auto* join = BiLeftJoin::make(qctx_.get(), lhs, rhs, std::move(hashKeys), std::move(probeKeys)); + auto* join = HashLeftJoin::make(qctx_.get(), lhs, rhs, std::move(hashKeys), std::move(probeKeys)); - auto joinExe = std::make_unique(join, qctx_.get()); + auto joinExe = std::make_unique(join, qctx_.get()); auto future = joinExe->execute(); auto status = std::move(future).get(); EXPECT_TRUE(status.ok()); diff --git a/src/graph/optimizer/rule/RemoveNoopProjectRule.cpp b/src/graph/optimizer/rule/RemoveNoopProjectRule.cpp index 91baafe1502..ce3b88b2b81 100644 --- a/src/graph/optimizer/rule/RemoveNoopProjectRule.cpp +++ b/src/graph/optimizer/rule/RemoveNoopProjectRule.cpp @@ -57,9 +57,9 @@ namespace opt { PlanNode::Kind::kDataCollect, PlanNode::Kind::kLeftJoin, PlanNode::Kind::kInnerJoin, - PlanNode::Kind::kBiLeftJoin, - PlanNode::Kind::kBiInnerJoin, - PlanNode::Kind::kBiCartesianProduct, + PlanNode::Kind::kHashLeftJoin, + PlanNode::Kind::kHashInnerJoin, + PlanNode::Kind::kCrossJoin, PlanNode::Kind::kRollUpApply, PlanNode::Kind::kArgument}; diff --git a/src/graph/planner/match/MatchPlanner.cpp b/src/graph/planner/match/MatchPlanner.cpp index 82c1f5c55bc..095ea0802d7 100644 --- a/src/graph/planner/match/MatchPlanner.cpp +++ b/src/graph/planner/match/MatchPlanner.cpp @@ -133,7 +133,7 @@ Status MatchPlanner::connectMatchPlan(SubPlan& queryPlan, MatchClauseContext* ma queryPlan = SegmentsConnector::innerJoin(matchCtx->qctx, queryPlan, matchPlan, interAliases); } } else { - queryPlan.root = BiCartesianProduct::make(matchCtx->qctx, queryPlan.root, matchPlan.root); + queryPlan.root = CrossJoin::make(matchCtx->qctx, queryPlan.root, matchPlan.root); } return Status::OK(); diff --git a/src/graph/planner/match/SegmentsConnector.cpp b/src/graph/planner/match/SegmentsConnector.cpp index 4cc7658f4d9..c62c26d5e7a 100644 --- a/src/graph/planner/match/SegmentsConnector.cpp +++ b/src/graph/planner/match/SegmentsConnector.cpp @@ -16,7 +16,7 @@ SubPlan SegmentsConnector::innerJoin(QueryContext* qctx, const SubPlan& right, const std::unordered_set& intersectedAliases) { SubPlan newPlan = left; - auto innerJoin = BiInnerJoin::make(qctx, left.root, right.root); + auto innerJoin = HashInnerJoin::make(qctx, left.root, right.root); std::vector hashKeys; std::vector probeKeys; auto pool = qctx->objPool(); @@ -39,7 +39,7 @@ SubPlan SegmentsConnector::leftJoin(QueryContext* qctx, const SubPlan& right, const std::unordered_set& intersectedAliases) { SubPlan newPlan = left; - auto leftJoin = BiLeftJoin::make(qctx, left.root, right.root); + auto leftJoin = HashLeftJoin::make(qctx, left.root, right.root); std::vector hashKeys; std::vector probeKeys; auto pool = qctx->objPool(); @@ -61,7 +61,7 @@ SubPlan SegmentsConnector::cartesianProduct(QueryContext* qctx, const SubPlan& left, const SubPlan& right) { SubPlan newPlan = left; - newPlan.root = BiCartesianProduct::make(qctx, left.root, right.root); + newPlan.root = CrossJoin::make(qctx, left.root, right.root); return newPlan; } diff --git a/src/graph/planner/match/ShortestPathPlanner.cpp b/src/graph/planner/match/ShortestPathPlanner.cpp index 394ee46b553..41bfe4a9db5 100644 --- a/src/graph/planner/match/ShortestPathPlanner.cpp +++ b/src/graph/planner/match/ShortestPathPlanner.cpp @@ -34,7 +34,7 @@ ShortestPathPlanner::ShortestPathPlanner(CypherClauseContextBase* ctx, const Pat // +------------+---------------+ // | // +--------+---------+ -// |BiCartesianProduct| +// | CrossJoin | // +--------+---------+ // | // +--------+---------+ @@ -95,7 +95,7 @@ StatusOr ShortestPathPlanner::transform(WhereClauseContext* bindWhereCl auto& leftPlan = plans.front(); auto& rightPlan = plans.back(); - auto cp = BiCartesianProduct::make(qctx, leftPlan.root, rightPlan.root); + auto cp = CrossJoin::make(qctx, leftPlan.root, rightPlan.root); auto shortestPath = ShortestPath::make(qctx, cp, spaceId, singleShortest); auto vertexProp = SchemaUtil::getAllVertexProp(qctx, spaceId, true); diff --git a/src/graph/planner/plan/Algo.cpp b/src/graph/planner/plan/Algo.cpp index e3c4e09fa3e..8416bddd65d 100644 --- a/src/graph/planner/plan/Algo.cpp +++ b/src/graph/planner/plan/Algo.cpp @@ -104,34 +104,33 @@ std::vector CartesianProduct::inputVars() const { return varNames; } -std::unique_ptr BiCartesianProduct::explain() const { +std::unique_ptr CrossJoin::explain() const { return BinaryInputNode::explain(); } -PlanNode* BiCartesianProduct::clone() const { +PlanNode* CrossJoin::clone() const { auto* node = make(qctx_); node->cloneMembers(*this); return node; } -void BiCartesianProduct::cloneMembers(const BiCartesianProduct& r) { +void CrossJoin::cloneMembers(const CrossJoin& r) { BinaryInputNode::cloneMembers(r); } -BiCartesianProduct::BiCartesianProduct(QueryContext* qctx, PlanNode* left, PlanNode* right) - : BinaryInputNode(qctx, Kind::kBiCartesianProduct, left, right) { +CrossJoin::CrossJoin(QueryContext* qctx, PlanNode* left, PlanNode* right) + : BinaryInputNode(qctx, Kind::kCrossJoin, left, right) { auto lColNames = left->colNames(); auto rColNames = right->colNames(); lColNames.insert(lColNames.end(), rColNames.begin(), rColNames.end()); setColNames(lColNames); } -void BiCartesianProduct::accept(PlanNodeVisitor* visitor) { +void CrossJoin::accept(PlanNodeVisitor* visitor) { visitor->visit(this); } -BiCartesianProduct::BiCartesianProduct(QueryContext* qctx) - : BinaryInputNode(qctx, Kind::kBiCartesianProduct) {} +CrossJoin::CrossJoin(QueryContext* qctx) : BinaryInputNode(qctx, Kind::kCrossJoin) {} std::unique_ptr Subgraph::explain() const { auto desc = SingleDependencyNode::explain(); diff --git a/src/graph/planner/plan/Algo.h b/src/graph/planner/plan/Algo.h index c6b6dac74fa..ff50714817e 100644 --- a/src/graph/planner/plan/Algo.h +++ b/src/graph/planner/plan/Algo.h @@ -367,10 +367,10 @@ class Subgraph final : public SingleInputNode { std::unique_ptr> edgeProps_; }; -class BiCartesianProduct final : public BinaryInputNode { +class CrossJoin final : public BinaryInputNode { public: - static BiCartesianProduct* make(QueryContext* qctx, PlanNode* left, PlanNode* right) { - return qctx->objPool()->makeAndAdd(qctx, left, right); + static CrossJoin* make(QueryContext* qctx, PlanNode* left, PlanNode* right) { + return qctx->objPool()->makeAndAdd(qctx, left, right); } std::unique_ptr explain() const override; @@ -383,15 +383,15 @@ class BiCartesianProduct final : public BinaryInputNode { friend ObjectPool; // used for clone only - static BiCartesianProduct* make(QueryContext* qctx) { - return qctx->objPool()->makeAndAdd(qctx); + static CrossJoin* make(QueryContext* qctx) { + return qctx->objPool()->makeAndAdd(qctx); } - void cloneMembers(const BiCartesianProduct& r); + void cloneMembers(const CrossJoin& r); - BiCartesianProduct(QueryContext* qctx, PlanNode* left, PlanNode* right); + CrossJoin(QueryContext* qctx, PlanNode* left, PlanNode* right); // use for clone - explicit BiCartesianProduct(QueryContext* qctx); + explicit CrossJoin(QueryContext* qctx); }; } // namespace graph } // namespace nebula diff --git a/src/graph/planner/plan/PlanNode.cpp b/src/graph/planner/plan/PlanNode.cpp index dc58ba1e7f5..4d386865d1d 100644 --- a/src/graph/planner/plan/PlanNode.cpp +++ b/src/graph/planner/plan/PlanNode.cpp @@ -288,12 +288,12 @@ const char* PlanNode::toString(PlanNode::Kind kind) { return "Traverse"; case Kind::kAppendVertices: return "AppendVertices"; - case Kind::kBiLeftJoin: - return "BiLeftJoin"; - case Kind::kBiInnerJoin: - return "BiInnerJoin"; - case Kind::kBiCartesianProduct: - return "BiCartesianProduct"; + case Kind::kHashLeftJoin: + return "HashLeftJoin"; + case Kind::kHashInnerJoin: + return "HashInnerJoin"; + case Kind::kCrossJoin: + return "CrossJoin"; case Kind::kShortestPath: return "ShortestPath"; case Kind::kArgument: diff --git a/src/graph/planner/plan/PlanNode.h b/src/graph/planner/plan/PlanNode.h index 621593970cf..f714038520d 100644 --- a/src/graph/planner/plan/PlanNode.h +++ b/src/graph/planner/plan/PlanNode.h @@ -65,9 +65,9 @@ class PlanNode { kDataCollect, kLeftJoin, kInnerJoin, - kBiLeftJoin, - kBiInnerJoin, - kBiCartesianProduct, + kHashLeftJoin, + kHashInnerJoin, + kCrossJoin, kRollUpApply, kArgument, diff --git a/src/graph/planner/plan/PlanNodeVisitor.h b/src/graph/planner/plan/PlanNodeVisitor.h index 91a29391239..36043fd6149 100644 --- a/src/graph/planner/plan/PlanNodeVisitor.h +++ b/src/graph/planner/plan/PlanNodeVisitor.h @@ -24,10 +24,10 @@ class PlanNodeVisitor { virtual void visit(Traverse *node) = 0; virtual void visit(ScanEdges *node) = 0; virtual void visit(AppendVertices *node) = 0; - virtual void visit(BiJoin *node) = 0; + virtual void visit(HashJoin *node) = 0; virtual void visit(Union *node) = 0; virtual void visit(Unwind *node) = 0; - virtual void visit(BiCartesianProduct *node) = 0; + virtual void visit(CrossJoin *node) = 0; }; } // namespace graph diff --git a/src/graph/planner/plan/Query.cpp b/src/graph/planner/plan/Query.cpp index db3e8e56e56..6145559f02a 100644 --- a/src/graph/planner/plan/Query.cpp +++ b/src/graph/planner/plan/Query.cpp @@ -830,18 +830,18 @@ void AppendVertices::accept(PlanNodeVisitor* visitor) { visitor->visit(this); } -std::unique_ptr BiJoin::explain() const { +std::unique_ptr HashJoin::explain() const { auto desc = BinaryInputNode::explain(); addDescription("hashKeys", folly::toJson(util::toJson(hashKeys_)), desc.get()); addDescription("probeKeys", folly::toJson(util::toJson(probeKeys_)), desc.get()); return desc; } -void BiJoin::accept(PlanNodeVisitor* visitor) { +void HashJoin::accept(PlanNodeVisitor* visitor) { visitor->visit(this); } -void BiJoin::cloneMembers(const BiJoin& j) { +void HashJoin::cloneMembers(const HashJoin& j) { BinaryInputNode::cloneMembers(j); std::vector hKeys; @@ -857,12 +857,12 @@ void BiJoin::cloneMembers(const BiJoin& j) { probeKeys_ = std::move(pKeys); } -BiJoin::BiJoin(QueryContext* qctx, - Kind kind, - PlanNode* left, - PlanNode* right, - std::vector hashKeys, - std::vector probeKeys) +HashJoin::HashJoin(QueryContext* qctx, + Kind kind, + PlanNode* left, + PlanNode* right, + std::vector hashKeys, + std::vector probeKeys) : BinaryInputNode(qctx, kind, left, right), hashKeys_(std::move(hashKeys)), probeKeys_(std::move(probeKeys)) { @@ -876,40 +876,40 @@ BiJoin::BiJoin(QueryContext* qctx, setColNames(lColNames); } -std::unique_ptr BiLeftJoin::explain() const { - auto desc = BiJoin::explain(); +std::unique_ptr HashLeftJoin::explain() const { + auto desc = HashJoin::explain(); addDescription("kind", "LeftJoin", desc.get()); return desc; } -PlanNode* BiLeftJoin::clone() const { +PlanNode* HashLeftJoin::clone() const { auto* lnode = left() ? left()->clone() : nullptr; auto* rnode = right() ? right()->clone() : nullptr; - auto* newLeftJoin = BiLeftJoin::make(qctx_, lnode, rnode); + auto* newLeftJoin = HashLeftJoin::make(qctx_, lnode, rnode); newLeftJoin->cloneMembers(*this); return newLeftJoin; } -void BiLeftJoin::cloneMembers(const BiLeftJoin& l) { - BiJoin::cloneMembers(l); +void HashLeftJoin::cloneMembers(const HashLeftJoin& l) { + HashJoin::cloneMembers(l); } -std::unique_ptr BiInnerJoin::explain() const { - auto desc = BiJoin::explain(); +std::unique_ptr HashInnerJoin::explain() const { + auto desc = HashJoin::explain(); addDescription("kind", "InnerJoin", desc.get()); return desc; } -PlanNode* BiInnerJoin::clone() const { +PlanNode* HashInnerJoin::clone() const { auto* lnode = left() ? left()->clone() : nullptr; auto* rnode = right() ? right()->clone() : nullptr; - auto* newInnerJoin = BiInnerJoin::make(qctx_, lnode, rnode); + auto* newInnerJoin = HashInnerJoin::make(qctx_, lnode, rnode); newInnerJoin->cloneMembers(*this); return newInnerJoin; } -void BiInnerJoin::cloneMembers(const BiInnerJoin& l) { - BiJoin::cloneMembers(l); +void HashInnerJoin::cloneMembers(const HashInnerJoin& l) { + HashJoin::cloneMembers(l); } std::unique_ptr RollUpApply::explain() const { diff --git a/src/graph/planner/plan/Query.h b/src/graph/planner/plan/Query.h index a3c4569aac9..b39108d9f7c 100644 --- a/src/graph/planner/plan/Query.h +++ b/src/graph/planner/plan/Query.h @@ -1649,7 +1649,7 @@ class AppendVertices final : public GetVertices { }; // Binary Join that joins two results from two inputs. -class BiJoin : public BinaryInputNode { +class HashJoin : public BinaryInputNode { public: const std::vector& hashKeys() const { return hashKeys_; @@ -1672,14 +1672,14 @@ class BiJoin : public BinaryInputNode { void accept(PlanNodeVisitor* visitor) override; protected: - BiJoin(QueryContext* qctx, - Kind kind, - PlanNode* left, - PlanNode* right, - std::vector hashKeys, - std::vector probeKeys); + HashJoin(QueryContext* qctx, + Kind kind, + PlanNode* left, + PlanNode* right, + std::vector hashKeys, + std::vector probeKeys); - void cloneMembers(const BiJoin&); + void cloneMembers(const HashJoin&); protected: std::vector hashKeys_; @@ -1687,14 +1687,14 @@ class BiJoin : public BinaryInputNode { }; // Left join -class BiLeftJoin final : public BiJoin { +class HashLeftJoin final : public HashJoin { public: - static BiLeftJoin* make(QueryContext* qctx, - PlanNode* left, - PlanNode* right, - std::vector hashKeys = {}, - std::vector probeKeys = {}) { - return qctx->objPool()->makeAndAdd( + static HashLeftJoin* make(QueryContext* qctx, + PlanNode* left, + PlanNode* right, + std::vector hashKeys = {}, + std::vector probeKeys = {}) { + return qctx->objPool()->makeAndAdd( qctx, left, right, std::move(hashKeys), std::move(probeKeys)); } @@ -1703,25 +1703,26 @@ class BiLeftJoin final : public BiJoin { private: friend ObjectPool; - BiLeftJoin(QueryContext* qctx, - PlanNode* left, - PlanNode* right, - std::vector hashKeys, - std::vector probeKeys) - : BiJoin(qctx, Kind::kBiLeftJoin, left, right, std::move(hashKeys), std::move(probeKeys)) {} - - void cloneMembers(const BiLeftJoin&); + HashLeftJoin(QueryContext* qctx, + PlanNode* left, + PlanNode* right, + std::vector hashKeys, + std::vector probeKeys) + : HashJoin( + qctx, Kind::kHashLeftJoin, left, right, std::move(hashKeys), std::move(probeKeys)) {} + + void cloneMembers(const HashLeftJoin&); }; // Inner join -class BiInnerJoin final : public BiJoin { +class HashInnerJoin final : public HashJoin { public: - static BiInnerJoin* make(QueryContext* qctx, - PlanNode* left, - PlanNode* right, - std::vector hashKeys = {}, - std::vector probeKeys = {}) { - return qctx->objPool()->makeAndAdd( + static HashInnerJoin* make(QueryContext* qctx, + PlanNode* left, + PlanNode* right, + std::vector hashKeys = {}, + std::vector probeKeys = {}) { + return qctx->objPool()->makeAndAdd( qctx, left, right, std::move(hashKeys), std::move(probeKeys)); } @@ -1730,14 +1731,15 @@ class BiInnerJoin final : public BiJoin { private: friend ObjectPool; - BiInnerJoin(QueryContext* qctx, - PlanNode* left, - PlanNode* right, - std::vector hashKeys, - std::vector probeKeys) - : BiJoin(qctx, Kind::kBiInnerJoin, left, right, std::move(hashKeys), std::move(probeKeys)) {} - - void cloneMembers(const BiInnerJoin&); + HashInnerJoin(QueryContext* qctx, + PlanNode* left, + PlanNode* right, + std::vector hashKeys, + std::vector probeKeys) + : HashJoin( + qctx, Kind::kHashInnerJoin, left, right, std::move(hashKeys), std::move(probeKeys)) {} + + void cloneMembers(const HashInnerJoin&); }; // Roll Up Apply two results from two inputs. diff --git a/src/graph/visitor/PrunePropertiesVisitor.cpp b/src/graph/visitor/PrunePropertiesVisitor.cpp index 263171c1719..0bc8d43c333 100644 --- a/src/graph/visitor/PrunePropertiesVisitor.cpp +++ b/src/graph/visitor/PrunePropertiesVisitor.cpp @@ -427,11 +427,11 @@ void PrunePropertiesVisitor::pruneCurrent(AppendVertices *node) { node->setVertexProps(std::move(prunedVertexProps)); } -void PrunePropertiesVisitor::visit(BiJoin *node) { +void PrunePropertiesVisitor::visit(HashJoin *node) { status_ = depsPruneProperties(node->dependencies()); } -void PrunePropertiesVisitor::visit(BiCartesianProduct *node) { +void PrunePropertiesVisitor::visit(CrossJoin *node) { status_ = pruneMultiBranch(node->dependencies()); } diff --git a/src/graph/visitor/PrunePropertiesVisitor.h b/src/graph/visitor/PrunePropertiesVisitor.h index cb14523e1ba..98c6fe9e638 100644 --- a/src/graph/visitor/PrunePropertiesVisitor.h +++ b/src/graph/visitor/PrunePropertiesVisitor.h @@ -66,10 +66,10 @@ class PrunePropertiesVisitor final : public PlanNodeVisitor { // prune properties in AppendVertices according to the used properties collected previous void pruneCurrent(AppendVertices *node); - void visit(BiJoin *node) override; + void visit(HashJoin *node) override; void visit(Union *node) override; - void visit(BiCartesianProduct *node) override; + void visit(CrossJoin *node) override; void visit(Unwind *node) override; void visitCurrent(Unwind *node); diff --git a/tests/tck/features/bugfix/ArgumentPlanNodeDep.feature b/tests/tck/features/bugfix/ArgumentPlanNodeDep.feature index 511a44f6878..cb3e5d52860 100644 --- a/tests/tck/features/bugfix/ArgumentPlanNodeDep.feature +++ b/tests/tck/features/bugfix/ArgumentPlanNodeDep.feature @@ -17,7 +17,7 @@ Feature: Fix Argument plan node dependency And the execution plan should be: | id | name | dependencies | operator info | | 11 | Aggregate | 10 | | - | 10 | BiInnerJoin | 8,4 | | + | 10 | HashInnerJoin | 8,4 | | | 8 | AppendVertices | 7 | | | 7 | Dedup | 6 | | | 6 | PassThrough | 5 | | diff --git a/tests/tck/features/match/MultiQueryParts.feature b/tests/tck/features/match/MultiQueryParts.feature index a77ef51184f..31599bcf9f1 100644 --- a/tests/tck/features/match/MultiQueryParts.feature +++ b/tests/tck/features/match/MultiQueryParts.feature @@ -155,10 +155,10 @@ Feature: Multi Query Parts | ("Tony Parker") | ("Tim Duncan" ) | [:like "Tim Duncan"->"Manu Ginobili" @0 {likeness: 95}] | ("Manu Ginobili") | ("Tim Duncan") | [:teammate "Manu Ginobili"->"Tony Parker" @0 {}] | | ("Tony Parker") | ("Tim Duncan" ) | [:like "Tim Duncan"->"Manu Ginobili" @0 {likeness: 95}] | ("Manu Ginobili") | ("Tim Duncan") | [:teammate "Manu Ginobili"->"Tony Parker" @0 {}] | | ("Tony Parker") | ("Tony Parker") | [:like "Tony Parker"->"LaMarcus Aldridge" @0 {likeness: 90}] | ("LaMarcus Aldridge") | ("Tim Duncan") | [:like "LaMarcus Aldridge"->"Tony Parker" @0 {}] | - # The redudant Project after BiInnerJoin is removed now + # The redudant Project after HashInnerJoin is removed now And the execution plan should be: | id | name | dependencies | profiling data | operator info | - | 19 | BiInnerJoin | 7,14 | | | + | 19 | HashInnerJoin | 7,14 | | | | 7 | Project | 6 | | | | 6 | AppendVertices | 5 | | | | 5 | Traverse | 20 | | | @@ -191,10 +191,10 @@ Feature: Multi Query Parts | ("Tony Parker") | ("Tony Parker") | [:like "Tony Parker"->"Manu Ginobili" @0 {likeness: 95}] | ("Manu Ginobili") | ("Tim Duncan") | [:teammate "Manu Ginobili"->"Tony Parker" @0 {}] | | ("Tony Parker") | ("Tim Duncan") | [:like "Tim Duncan"->"Manu Ginobili" @0 {likeness: 95}] | ("Manu Ginobili") | ("Tim Duncan") | [:teammate "Manu Ginobili"->"Tony Parker" @0 {}] | | ("Tony Parker") | ("Tim Duncan") | [:like "Tim Duncan"->"Manu Ginobili" @0 {likeness: 95}] | ("Manu Ginobili") | ("Tim Duncan") | [:teammate "Manu Ginobili"->"Tony Parker" @0 {}] | - # The redudant Project after BiLeftJoin is removed now + # The redudant Project after HashLeftJoin is removed now And the execution plan should be: | id | name | dependencies | profiling data | operator info | - | 19 | BiLeftJoin | 7,14 | | | + | 19 | HashLeftJoin | 7,14 | | | | 7 | Project | 6 | | | | 6 | AppendVertices | 5 | | | | 5 | Traverse | 20 | | | diff --git a/tests/tck/features/optimizer/PrunePropertiesRule.feature b/tests/tck/features/optimizer/PrunePropertiesRule.feature index 4fdc4c245c5..85b906f7bb3 100644 --- a/tests/tck/features/optimizer/PrunePropertiesRule.feature +++ b/tests/tck/features/optimizer/PrunePropertiesRule.feature @@ -173,7 +173,7 @@ Feature: Prune Properties rule | id | name | dependencies | operator info | | 16 | TopN | 12 | | | 12 | Project | 9 | | - | 9 | BiInnerJoin | 22, 23 | | + | 9 | HashInnerJoin | 22, 23 | | | 22 | Project | 5 | | | 5 | AppendVertices | 4 | { "props": "[{\"props\":[\"name\"],\"tagId\":9}]" } | | 4 | Traverse | 2 | { "vertexProps": "[{\"props\":[\"name\"],\"tagId\":9}]" } | @@ -207,8 +207,8 @@ Feature: Prune Properties rule | id | name | dependencies | operator info | | 20 | TopN | 23 | | | 23 | Project | 13 | | - | 13 | BiInnerJoin | 9, 30 | | - | 9 | BiInnerJoin | 28, 29 | | + | 13 | HashInnerJoin | 9, 30 | | + | 9 | HashInnerJoin | 28, 29 | | | 28 | Project | 5 | | | 5 | AppendVertices | 4 | { "props": "[{\"props\":[\"name\"],\"tagId\":9}]" } | | 4 | Traverse | 2 | { "vertexProps": "[{\"props\":[\"name\"],\"tagId\":9}]", "edgeProps": "[{\"type\": -5, \"props\": [\"_dst\", \"_rank\", \"_type\"]}, {\"type\": 5, \"props\": [\"_dst\", \"_rank\", \"_type\"]}, {\"props\": [\"_dst\", \"_rank\", \"_type\"], \"type\": -3}, {\"props\": [\"_dst\", \"_rank\", \"_type\"], \"type\": 3}, {\"type\": -4, \"props\": [\"_dst\", \"_rank\", \"_type\"]}, {\"props\": [\"_dst\", \"_rank\", \"_type\"], \"type\": 4}]" } | @@ -253,7 +253,7 @@ Feature: Prune Properties rule | id | name | dependencies | operator info | | 17 | TopN | 13 | | | 13 | Project | 12 | | - | 12 | BiInnerJoin | 19, 11 | | + | 12 | HashInnerJoin | 19, 11 | | | 19 | Project | 5 | | | 5 | AppendVertices | 4 | { "props": "[{\"props\":[\"name\"],\"tagId\":9}]" } | | 4 | Traverse | 2 | { "vertexProps": "[{\"props\":[\"name\"],\"tagId\":9}]" } | @@ -287,14 +287,14 @@ Feature: Prune Properties rule | id | name | dependencies | operator info | | 21 | TopN | 17 | | | 17 | Project | 16 | | - | 16 | BiInnerJoin | 23, 14 | | + | 16 | HashInnerJoin | 23, 14 | | | 23 | Project | 5 | | | 5 | AppendVertices | 4 | { "props": "[{\"props\":[\"name\"],\"tagId\":9}]" } | | 4 | Traverse | 2 | { "vertexProps": "[{\"props\":[\"name\"],\"tagId\":9}]" } | | 2 | Dedup | 1 | | | 1 | PassThrough | 3 | | | 3 | Start | | | - | 14 | BiInnerJoin | 33, 34 | | + | 14 | HashInnerJoin | 33, 34 | | | 33 | Project | 10 | | | 10 | AppendVertices | 9 | { "props": "[{\"tagId\":10,\"props\":[\"name\"]}]" } | | 9 | Traverse | 8 | { "vertexProps": "[{\"tagId\":9,\"props\":[\"name\"]}]" } | @@ -317,7 +317,7 @@ Feature: Prune Properties rule And the execution plan should be: | id | name | dependencies | operator info | | 10 | Project | 11 | | - | 11 | BiInnerJoin | 14, 9 | | + | 11 | HashInnerJoin | 14, 9 | | | 14 | Project | 3 | | | 3 | AppendVertices | 12 | { "props": "[{\"props\":[\"name\"],\"tagId\":9}]" } | | 12 | IndexScan | 2 | | @@ -354,7 +354,7 @@ Feature: Prune Properties rule | id | name | dependencies | operator info | | 17 | TopN | 13 | | | 13 | Project | 12 | | - | 12 | BiLeftJoin | 19, 11 | | + | 12 | HashLeftJoin | 19, 11 | | | 19 | Project | 5 | | | 5 | AppendVertices | 4 | { "props": "[{\"props\":[\"name\"],\"tagId\":9}]" } | | 4 | Traverse | 2 | | @@ -379,7 +379,7 @@ Feature: Prune Properties rule And the execution plan should be: | id | name | dependencies | operator info | | 12 | Aggregate | 13 | | - | 13 | BiInnerJoin | 15, 11 | | + | 13 | HashInnerJoin | 15, 11 | | | 15 | Project | 4 | | | 4 | Traverse | 3 | { "vertexProps": "" } | | 3 | Traverse | 14 | { "vertexProps": "" } | @@ -469,7 +469,7 @@ Feature: Prune Properties rule And the execution plan should be: | id | name | dependencies | operator info | | 14 | Project | 13 | | - | 13 | BiInnerJoin | 15,12 | | + | 13 | HashInnerJoin | 15,12 | | | 15 | Project | 17 | | | 17 | AppendVertices | 16 | { "props": "[{\"props\":[\"_tag\", \"name\", \"speciality\"],\"tagId\":8}, {\"props\":[\"_tag\", \"name\", \"age\"],\"tagId\":9}, {\"props\":[\"_tag\", \"name\"],\"tagId\":10}]" } | | 16 | Traverse | 2 | {"vertexProps": "[{\"props\":[\"name\", \"age\", \"_tag\"],\"tagId\":9}, {\"props\":[\"name\", \"speciality\", \"_tag\"],\"tagId\":8}, {\"props\":[\"name\", \"_tag\"],\"tagId\":10}]", "edgeProps": "[{\"type\": 3, \"props\": [\"_type\", \"_rank\", \"_dst\", \"_src\", \"likeness\"]}]" } | @@ -536,7 +536,7 @@ Feature: Prune Properties rule | id | name | dependencies | operator info | | 21 | Aggregate | 20 | | | 20 | Aggregate | 19 | | - | 19 | BiLeftJoin | 10, 25 | | + | 19 | HashLeftJoin | 10, 25 | | | 10 | Aggregate | 23 | | | 23 | Project | 22 | | | 22 | Filter | 29 | |