Skip to content

Commit

Permalink
Refactor SegmentsConnector.
Browse files Browse the repository at this point in the history
  • Loading branch information
CPWstatic committed Dec 23, 2021
1 parent e8a298c commit 9f8aa44
Show file tree
Hide file tree
Showing 18 changed files with 100 additions and 436 deletions.
4 changes: 0 additions & 4 deletions src/graph/planner/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ nebula_add_library(
SequentialPlanner.cpp
match/MatchSolver.cpp
match/SegmentsConnector.cpp
match/InnerJoinStrategy.cpp
match/AddDependencyStrategy.cpp
match/AddInputStrategy.cpp
match/CartesianProductStrategy.cpp
match/MatchPlanner.cpp
match/MatchClausePlanner.cpp
match/UnwindClausePlanner.cpp
Expand Down
18 changes: 0 additions & 18 deletions src/graph/planner/match/AddDependencyStrategy.cpp

This file was deleted.

26 changes: 0 additions & 26 deletions src/graph/planner/match/AddDependencyStrategy.h

This file was deleted.

27 changes: 0 additions & 27 deletions src/graph/planner/match/AddInputStrategy.cpp

This file was deleted.

30 changes: 0 additions & 30 deletions src/graph/planner/match/AddInputStrategy.h

This file was deleted.

29 changes: 0 additions & 29 deletions src/graph/planner/match/CartesianProductStrategy.cpp

This file was deleted.

30 changes: 0 additions & 30 deletions src/graph/planner/match/CartesianProductStrategy.h

This file was deleted.

51 changes: 0 additions & 51 deletions src/graph/planner/match/InnerJoinStrategy.cpp

This file was deleted.

44 changes: 0 additions & 44 deletions src/graph/planner/match/InnerJoinStrategy.h

This file was deleted.

17 changes: 0 additions & 17 deletions src/graph/planner/match/LeftOuterJoinStrategy.h

This file was deleted.

25 changes: 5 additions & 20 deletions src/graph/planner/match/MatchClausePlanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#include "graph/util/SchemaUtil.h"
#include "graph/visitor/RewriteVisitor.h"

using JoinStrategyPos = nebula::graph::InnerJoinStrategy::JoinPos;

namespace nebula {
namespace graph {
static std::vector<std::string> genTraverseColNames(const std::vector<std::string>& inputCols,
Expand Down Expand Up @@ -458,8 +456,7 @@ Status MatchClausePlanner::appendFilterPlan(MatchClauseContext* matchClauseCtx,
auto wherePlan = std::make_unique<WhereClausePlanner>()->transform(matchClauseCtx->where.get());
NG_RETURN_IF_ERROR(wherePlan);
auto plan = std::move(wherePlan).value();
SegmentsConnector::addInput(plan.tail, subplan.root, true);
subplan.root = plan.root;
subplan = SegmentsConnector::addInput(plan, subplan, true);
VLOG(1) << subplan;
return Status::OK();
}
Expand All @@ -485,24 +482,12 @@ Status MatchClausePlanner::connectPathPlan(const std::vector<NodeInfo>& nodeInfo
matchClausePlan = subplan;
} else {
if (intersectedAliases.empty()) {
matchClausePlan.root =
BiCartesianProduct::make(matchClauseCtx->qctx, matchClausePlan.root, subplan.root);
matchClausePlan =
SegmentsConnector::cartesianProduct(matchClauseCtx->qctx, matchClausePlan, subplan);
} else {
// TODO: Actually a natural join would be much easy use.
auto innerJoin = BiInnerJoin::make(matchClauseCtx->qctx, matchClausePlan.root, subplan.root);
std::vector<Expression*> hashKeys;
std::vector<Expression*> probeKeys;
auto pool = matchClauseCtx->qctx->objPool();
for (auto& alias : intersectedAliases) {
auto* args = ArgumentList::make(pool);
args->addArgument(InputPropertyExpression::make(pool, alias));
auto* expr = FunctionCallExpression::make(pool, "id", args);
hashKeys.emplace_back(expr);
probeKeys.emplace_back(expr->clone());
}
innerJoin->setHashKeys(std::move(hashKeys));
innerJoin->setProbeKeys(std::move(probeKeys));
matchClausePlan.root = innerJoin;
matchClausePlan = SegmentsConnector::innerJoin(
matchClauseCtx->qctx, matchClausePlan, subplan, intersectedAliases);
}
}
return Status::OK();
Expand Down
Loading

0 comments on commit 9f8aa44

Please sign in to comment.