Skip to content

Commit

Permalink
Partial fix of optional match, for bug vesoft-inc#4745.
Browse files Browse the repository at this point in the history
  • Loading branch information
xtcyclist committed Oct 21, 2022
1 parent 92e9a08 commit 837a9ea
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/graph/planner/match/MatchPlanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ Status MatchPlanner::connectMatchPlan(SubPlan& queryPlan, MatchClauseContext* ma
}
queryPlan =
SegmentsConnector::leftJoin(matchCtx->qctx, queryPlan, matchPlan, intersectedAliases);
matchCtx->isOptional = false;
} else {
queryPlan =
SegmentsConnector::innerJoin(matchCtx->qctx, queryPlan, matchPlan, intersectedAliases);
Expand All @@ -127,7 +128,8 @@ Status MatchPlanner::genQueryPartPlan(QueryContext* qctx,
for (auto& match : queryPart.matchs) {
NG_RETURN_IF_ERROR(connectMatchPlan(queryPlan, match.get()));
// connect match filter
if (match->where != nullptr && !match->isOptional) {
if ((match->where != nullptr && !match->isOptional) ||
(match->isOptional && queryPart.matchs.size())) {
match->where->inputColNames = queryPlan.root->colNames();
auto wherePlanStatus = std::make_unique<WhereClausePlanner>()->transform(match->where.get());
NG_RETURN_IF_ERROR(wherePlanStatus);
Expand Down

0 comments on commit 837a9ea

Please sign in to comment.