Skip to content

Commit

Permalink
address the comment
Browse files Browse the repository at this point in the history
Signed-off-by: yisaer <disxiaofei@163.com>
  • Loading branch information
Yisaer committed Nov 29, 2021
1 parent cd6ec77 commit 518c657
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions planner/core/logical_plan_trace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ func (s *testPlanSuite) TestSingleRuleTraceStep(c *C) {
assertRuleName: "aggregation_eliminate",
assertRuleSteps: []assertTraceStep{
{
assertReason: ".*unique.*",
assertAction: ".*distinct eliminated.*",
assertReason: "[test.t.a] is a unique key",
assertAction: "min(distinct ...) is simplified to min(...)",
},
{
assertReason: ".*unique.*",
assertAction: ".*aggregation eliminated.*",
assertReason: "[test.t.a] is a unique key",
assertAction: "aggregation is simplified to a projection",
},
},
},
Expand Down Expand Up @@ -132,8 +132,8 @@ func (s *testPlanSuite) TestSingleRuleTraceStep(c *C) {
if step.RuleName == tc.assertRuleName {
assert = true
for i, ruleStep := range step.Steps {
c.Assert(ruleStep.Action, Matches, tc.assertRuleSteps[i].assertAction)
c.Assert(ruleStep.Reason, Matches, tc.assertRuleSteps[i].assertReason)
c.Assert(ruleStep.Action, Equals, tc.assertRuleSteps[i].assertAction)
c.Assert(ruleStep.Reason, Equals, tc.assertRuleSteps[i].assertReason)
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions planner/core/rule_aggregation_elimination.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,15 @@ func (a *aggregationEliminateChecker) tryToEliminateDistinct(agg *LogicalAggrega

func appendAggregationEliminateTraceStep(agg *LogicalAggregation, uniqueKey expression.KeyInfo, opt *logicalOptimizeOp) {
opt.appendStepToCurrent(agg.ID(), agg.TP(),
fmt.Sprintf("%s is unique key", uniqueKey.String()),
"aggregation eliminated to projection")
fmt.Sprintf("%s is a unique key", uniqueKey.String()),
"aggregation is simplified to a projection")
}

func appendDistinctEliminateTraceStep(agg *LogicalAggregation, uniqueKey expression.KeyInfo, af *aggregation.AggFuncDesc,
opt *logicalOptimizeOp) {
opt.appendStepToCurrent(agg.ID(), agg.TP(),
fmt.Sprintf("%s is unique key", uniqueKey.String()),
fmt.Sprintf("agg[%s]'s distinct eliminated", af.Name))
fmt.Sprintf("%s is a unique key", uniqueKey.String()),
fmt.Sprintf("%s(distinct ...) is simplified to %s(...)", af.Name, af.Name))
}

// ConvertAggToProj convert aggregation to projection.
Expand Down

0 comments on commit 518c657

Please sign in to comment.