Skip to content

Commit

Permalink
added some comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
xtcyclist committed Nov 17, 2022
1 parent 571caa9 commit c6b9b39
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/graph/optimizer/rule/PushFilterDownAggregateRule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,23 @@ StatusOr<OptRule::TransformResult> PushFilterDownAggregateRule::transform(
newFilterNode->setCondition(newCondition);

// Exchange planNode
newAggNode->setOutputVar(oldFilterNode->outputVar()); // ~ok
newFilterNode->setInputVar(oldAggNode->inputVar()); // ok
// before exchanging:
// newAggNode's inputs and outputs are clone of the oldAggNode
DCHECK_EQ(newAggNode->inputVar(), oldAggNode->inputVar());
DCHECK_EQ(newAggNode->outputVar(), oldAggNode->outputVar());
// newFilterNode's inputs and outputs are clone of the oldFilterNode
DCHECK_EQ(newFilterNode->inputVar(), oldFilterNode->inputVar());
DCHECK_EQ(newFilterNode->outputVar(), oldFilterNode->outputVar());

// newAggNode shall inherit the output of the oldFilterNode
newAggNode->setOutputVar(oldFilterNode->outputVar());
// newFilterNode shall inherit the input of the oldAggNode
newFilterNode->setInputVar(oldAggNode->inputVar());
DCHECK_EQ(oldAggNode->outputVar(), oldFilterNode->inputVar());
// newAggNode->setInputVar(oldAggNode->outputVar());
newAggNode->setInputVar(oldAggNode->inputVar());
// newFilterNode->setOutputVar(oldAggNode->outputVar());
newFilterNode->setOutputVar(newAggNode->inputVar());
// newAggNode's input shall be newFilterNode's output
newAggNode->setInputVar(newFilterNode->outputVar());
// newFilterNode's output does not need to be changed
// it inheris the output from oldFilterNode as its clone

// Push down filter's optGroup and embed newAggGroupNode into old filter's
// Group
Expand Down

0 comments on commit c6b9b39

Please sign in to comment.