Skip to content

Commit d4758ef

Browse files
AilinKid3AceShowHand
authored andcommitted
planner: refine cop task as a capital one for latter pkg move (pingcap#52506)
ref pingcap#52181
1 parent 9e08848 commit d4758ef

File tree

5 files changed

+251
-242
lines changed

5 files changed

+251
-242
lines changed

pkg/planner/core/exhaust_physical_plans.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,7 +1075,7 @@ func (p *LogicalJoin) constructInnerTableScanTask(
10751075
if usedStats != nil && usedStats.GetUsedInfo(ts.physicalTableID) != nil {
10761076
ts.usedStatsInfo = usedStats.GetUsedInfo(ts.physicalTableID)
10771077
}
1078-
copTask := &copTask{
1078+
copTask := &CopTask{
10791079
tablePlan: ts,
10801080
indexPlanFinished: true,
10811081
tblColHists: ds.TblColHists,
@@ -1237,7 +1237,7 @@ func (p *LogicalJoin) constructInnerIndexScanTask(
12371237
tblColHists: ds.TblColHists,
12381238
pkIsHandleCol: ds.getPKIsHandleCol(),
12391239
}.Init(ds.SCtx(), ds.QueryBlockOffset())
1240-
cop := &copTask{
1240+
cop := &CopTask{
12411241
indexPlan: is,
12421242
tblColHists: ds.TblColHists,
12431243
tblCols: ds.TblCols,

pkg/planner/core/find_best_task.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,8 @@ func getTaskPlanCost(t Task, pop *coreusage.PhysicalOptimizeOp) (float64, bool,
425425
switch t.(type) {
426426
case *RootTask:
427427
taskType = property.RootTaskType
428-
case *copTask: // no need to know whether the task is single-read or double-read, so both CopSingleReadTaskType and CopDoubleReadTaskType are OK
429-
cop := t.(*copTask)
428+
case *CopTask: // no need to know whether the task is single-read or double-read, so both CopSingleReadTaskType and CopDoubleReadTaskType are OK
429+
cop := t.(*CopTask)
430430
if cop.indexPlan != nil && cop.tablePlan != nil { // handle IndexLookup specially
431431
taskType = property.CopMultiReadTaskType
432432
// keep compatible with the old cost interface, for CopMultiReadTask, the cost is idxCost + tblCost.
@@ -481,7 +481,7 @@ func getTaskPlanCost(t Task, pop *coreusage.PhysicalOptimizeOp) (float64, bool,
481481
// It's a very special case for index merge case.
482482
// t.plan() == nil in index merge COP case, it means indexPlanFinished is false in other words.
483483
cost := 0.0
484-
copTsk := t.(*copTask)
484+
copTsk := t.(*CopTask)
485485
for _, partialScan := range copTsk.idxMergePartPlans {
486486
partialCost, err := getPlanCost(partialScan, taskType, coreusage.NewDefaultPlanCostOption().WithOptimizeTracer(pop))
487487
if err != nil {
@@ -1610,7 +1610,7 @@ func (ds *DataSource) convertToIndexMergeScan(prop *property.PhysicalProperty, c
16101610
})
16111611
path := candidate.path
16121612
scans := make([]PhysicalPlan, 0, len(path.PartialIndexPaths))
1613-
cop := &copTask{
1613+
cop := &CopTask{
16141614
indexPlanFinished: false,
16151615
tblColHists: ds.TblColHists,
16161616
}
@@ -2019,7 +2019,7 @@ func (ds *DataSource) convertToIndexScan(prop *property.PhysicalProperty,
20192019
}
20202020
path := candidate.path
20212021
is := ds.getOriginalPhysicalIndexScan(prop, path, candidate.isMatchProp, candidate.path.IsSingleScan)
2022-
cop := &copTask{
2022+
cop := &CopTask{
20232023
indexPlan: is,
20242024
tblColHists: ds.TblColHists,
20252025
tblCols: ds.TblCols,
@@ -2204,7 +2204,7 @@ func (is *PhysicalIndexScan) initSchema(idxExprCols []*expression.Column, isDoub
22042204
is.SetSchema(expression.NewSchema(indexCols...))
22052205
}
22062206

2207-
func (is *PhysicalIndexScan) addPushedDownSelection(copTask *copTask, p *DataSource, path *util.AccessPath, finalStats *property.StatsInfo) {
2207+
func (is *PhysicalIndexScan) addPushedDownSelection(copTask *CopTask, p *DataSource, path *util.AccessPath, finalStats *property.StatsInfo) {
22082208
// Add filter condition to table plan now.
22092209
indexConds, tableConds := path.IndexFilters, path.TableFilters
22102210
tableConds, copTask.rootTaskConds = SplitSelCondsWithVirtualColumn(tableConds)
@@ -2477,7 +2477,7 @@ func (ds *DataSource) convertToTableScan(prop *property.PhysicalProperty, candid
24772477
// prop.TaskTp is cop related, just return invalidTask.
24782478
return invalidTask, nil
24792479
}
2480-
copTask := &copTask{
2480+
copTask := &CopTask{
24812481
tablePlan: ts,
24822482
indexPlanFinished: true,
24832483
tblColHists: ds.TblColHists,
@@ -2711,7 +2711,7 @@ func (ts *PhysicalTableScan) addPushedDownSelectionToMppTask(mpp *MppTask, stats
27112711
return mpp
27122712
}
27132713

2714-
func (ts *PhysicalTableScan) addPushedDownSelection(copTask *copTask, stats *property.StatsInfo) {
2714+
func (ts *PhysicalTableScan) addPushedDownSelection(copTask *CopTask, stats *property.StatsInfo) {
27152715
ts.filterCondition, copTask.rootTaskConds = SplitSelCondsWithVirtualColumn(ts.filterCondition)
27162716
var newRootConds []expression.Expression
27172717
ts.filterCondition, newRootConds = expression.PushDownExprs(GetPushDownCtx(ts.SCtx()), ts.filterCondition, ts.StoreType)

pkg/planner/core/planbuilder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1555,7 +1555,7 @@ func (b *PlanBuilder) buildPhysicalIndexLookUpReader(_ context.Context, dbName m
15551555
}
15561556
}
15571557

1558-
cop := &copTask{
1558+
cop := &CopTask{
15591559
indexPlan: is,
15601560
tablePlan: ts,
15611561
tblColHists: is.StatsInfo().HistColl,

0 commit comments

Comments
 (0)