Skip to content

Commit

Permalink
final changes
Browse files Browse the repository at this point in the history
  • Loading branch information
aziz-mu committed May 12, 2023
1 parent 40bebb9 commit 961330d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
12 changes: 5 additions & 7 deletions src/planner/join_order_enumerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,14 @@ void JoinOrderEnumerator::planRelScan(uint32_t relPos) {
newSubgraph.addQueryRel(relPos);
auto predicates = getNewlyMatchedExpressions(
context->getEmptySubqueryGraph(), newSubgraph, context->getWhereExpressions());

std::vector<ExtendDirection> EXTEND_DIRECTIONS = {ExtendDirection::FWD, ExtendDirection::BWD};
for (auto direction : EXTEND_DIRECTIONS) {
// Regardless of whether rel is directed or not,
// we always enumerate two plans, one from src to dst, and the other from dst to src.
for (auto direction : {ExtendDirection::FWD, ExtendDirection::BWD}) {
auto plan = std::make_unique<LogicalPlan>();
auto [boundNode, _] = getBoundAndNbrNodes(*rel, direction);
auto extendDirection = rel->isDirected() ? direction : ExtendDirection::BOTH;
appendScanNodeID(boundNode, *plan);
appendExtendAndFilter(rel, extendDirection, predicates, *plan);
appendExtendAndFilter(rel, direction, predicates, *plan);
context->addPlan(newSubgraph, std::move(plan));
}
}
Expand Down Expand Up @@ -490,9 +490,7 @@ void JoinOrderEnumerator::appendRecursiveExtend(std::shared_ptr<NodeExpression>
std::shared_ptr<NodeExpression> nbrNode, std::shared_ptr<RelExpression> rel,
common::ExtendDirection direction, LogicalPlan& plan) {
auto hasAtMostOneNbr = extendHasAtMostOneNbrGuarantee(*rel, *boundNode, direction, catalog);
if (!rel->isDirected()) {
direction = ExtendDirection::BOTH;
}
assert(rel->isDirected());
auto extend = std::make_shared<LogicalRecursiveExtend>(
boundNode, nbrNode, rel, direction, plan.getLastOperator());
queryPlanner->appendFlattens(extend->getGroupsPosToFlatten(), plan);
Expand Down
2 changes: 1 addition & 1 deletion src/planner/operator/base_logical_extend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ static std::string relToString(const binder::RelExpression& rel) {

std::string BaseLogicalExtend::getExpressionsForPrinting() const {
auto result = boundNode->toString();
if (direction == common::ExtendDirection::BOTH) {
if (!rel->isDirected()) {
result += "<-";
result += relToString(*rel);
result += "->";
Expand Down
2 changes: 1 addition & 1 deletion src/processor/mapper/map_extend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace kuzu {
namespace processor {

static RelDataDirection getRelDataDirection(ExtendDirection extendDirection) {
// assert(extendDirection != ExtendDirection::BOTH);
assert(extendDirection != ExtendDirection::BOTH);
return extendDirection == ExtendDirection::BWD ? BWD : FWD;
}

Expand Down

0 comments on commit 961330d

Please sign in to comment.