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 Dec 15, 2021
1 parent 6071770 commit f642268
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
14 changes: 7 additions & 7 deletions planner/core/logical_plan_trace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (s *testPlanSuite) TestSingleRuleTraceStep(c *C) {
assertRuleName: "partition_processor",
assertRuleSteps: []assertTraceStep{
{
assertReason: "Datasource[1] have multi available partition tables[p1,p2] after partition pruning",
assertReason: "Datasource[1] has multiple needed partitions[p1,p2] after pruning",
assertAction: "Datasource[1] becomes PartitionUnion[6] with children[TableScan[1],TableScan[1]]",
},
},
Expand All @@ -103,7 +103,7 @@ func (s *testPlanSuite) TestSingleRuleTraceStep(c *C) {
assertRuleName: "partition_processor",
assertRuleSteps: []assertTraceStep{
{
assertReason: "Datasource[1] has one available partiton table[p1] after partition pruning",
assertReason: "Datasource[1] has one needed partition[p1] after pruning",
assertAction: "Datasource[1] becomes TableScan[1]",
},
},
Expand All @@ -114,7 +114,7 @@ func (s *testPlanSuite) TestSingleRuleTraceStep(c *C) {
assertRuleName: "partition_processor",
assertRuleSteps: []assertTraceStep{
{
assertReason: "Datasource[1] have multi available partition tables[p1,p2] after partition pruning",
assertReason: "Datasource[1] has multiple needed partitions[p1,p2] after pruning",
assertAction: "Datasource[1] becomes PartitionUnion[7] with children[TableScan[1],TableScan[1]]",
},
},
Expand All @@ -125,7 +125,7 @@ func (s *testPlanSuite) TestSingleRuleTraceStep(c *C) {
assertRuleName: "partition_processor",
assertRuleSteps: []assertTraceStep{
{
assertReason: "Datasource[1] has one available partiton table[p2] after partition pruning",
assertReason: "Datasource[1] has one needed partition[p2] after pruning",
assertAction: "Datasource[1] becomes TableScan[1]",
},
},
Expand All @@ -136,7 +136,7 @@ func (s *testPlanSuite) TestSingleRuleTraceStep(c *C) {
assertRuleName: "partition_processor",
assertRuleSteps: []assertTraceStep{
{
assertReason: "Datasource[1] has no available partition table after partition pruning",
assertReason: "Datasource[1] doesn't have needed partition table after pruning",
assertAction: "Datasource[1] becomes TableDual[5]",
},
},
Expand All @@ -147,7 +147,7 @@ func (s *testPlanSuite) TestSingleRuleTraceStep(c *C) {
assertRuleName: "partition_processor",
assertRuleSteps: []assertTraceStep{
{
assertReason: "Datasource[1] have multi available partition tables[p1,p2] after partition pruning",
assertReason: "Datasource[1] has multiple needed partitions[p1,p2] after pruning",
assertAction: "Datasource[1] becomes PartitionUnion[7] with children[TableScan[1],TableScan[1]]",
},
},
Expand All @@ -158,7 +158,7 @@ func (s *testPlanSuite) TestSingleRuleTraceStep(c *C) {
assertRuleName: "partition_processor",
assertRuleSteps: []assertTraceStep{
{
assertReason: "Datasource[1] has one available partiton table[p1] after partition pruning",
assertReason: "Datasource[1] has one needed partition[p1] after pruning",
assertAction: "Datasource[1] becomes TableScan[1]",
},
},
Expand Down
10 changes: 5 additions & 5 deletions planner/core/rule_partition_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ func (s *partitionProcessor) pruneRangePartition(ctx sessionctx.Context, pi *mod
if condsToBePruned == nil {
return result, nil, nil
}
// remove useless predicates after partition pruning
// remove useless predicates after pruning
newConds := make([]expression.Expression, 0, len(*condsToBePruned))
for _, cond := range *condsToBePruned {
if dataForPrune, ok := pruner.extractDataForPrune(ctx, cond); ok {
Expand Down Expand Up @@ -1594,7 +1594,7 @@ func appendMakeUnionAllChildrenTranceStep(ds *DataSource, usedMap map[int64]mode
})
if len(children) == 1 {
action = fmt.Sprintf("Datasource[%v] becomes %s[%v]", ds.ID(), plan.TP(), plan.ID())
reason = fmt.Sprintf("Datasource[%v] has one available partiton table[%s] after partition pruning", ds.ID(), used[0].Name)
reason = fmt.Sprintf("Datasource[%v] has one needed partition[%s] after pruning", ds.ID(), used[0].Name)
} else {
action = func() string {
buffer := bytes.NewBufferString(fmt.Sprintf("Datasource[%v] becomes %s[%v] with children[", ds.ID(), plan.TP(), plan.ID()))
Expand All @@ -1608,14 +1608,14 @@ func appendMakeUnionAllChildrenTranceStep(ds *DataSource, usedMap map[int64]mode
return buffer.String()
}()
reason = func() string {
buffer := bytes.NewBufferString(fmt.Sprintf("Datasource[%v] have multi available partition tables[", ds.ID()))
buffer := bytes.NewBufferString(fmt.Sprintf("Datasource[%v] has multiple needed partitions[", ds.ID()))
for i, u := range used {
if i > 0 {
buffer.WriteString(",")
}
buffer.WriteString(u.Name.String())
}
buffer.WriteString("] after partition pruning")
buffer.WriteString("] after pruning")
return buffer.String()
}()
}
Expand All @@ -1624,6 +1624,6 @@ func appendMakeUnionAllChildrenTranceStep(ds *DataSource, usedMap map[int64]mode

func appendNoPartitionChildTraceStep(ds *DataSource, dual LogicalPlan, opt *logicalOptimizeOp) {
action := fmt.Sprintf("Datasource[%v] becomes %v[%v]", ds.ID(), dual.TP(), dual.ID())
reason := fmt.Sprintf("Datasource[%v] has no available partition table after partition pruning", ds.ID())
reason := fmt.Sprintf("Datasource[%v] doesn't have needed partition table after pruning", ds.ID())
opt.appendStepToCurrent(dual.ID(), dual.TP(), reason, action)
}

0 comments on commit f642268

Please sign in to comment.