@@ -21,8 +21,8 @@ import (
21
21
"github.com/pingcap/tidb/pkg/expression"
22
22
"github.com/pingcap/tidb/pkg/kv"
23
23
"github.com/pingcap/tidb/pkg/planner/cardinality"
24
- base2 "github.com/pingcap/tidb/pkg/planner/core/base"
25
- "github.com/pingcap/tidb/pkg/planner/core/operator/base "
24
+ "github.com/pingcap/tidb/pkg/planner/core/base"
25
+ "github.com/pingcap/tidb/pkg/planner/core/operator/baseimpl "
26
26
fd "github.com/pingcap/tidb/pkg/planner/funcdep"
27
27
"github.com/pingcap/tidb/pkg/planner/property"
28
28
"github.com/pingcap/tidb/pkg/planner/util"
@@ -35,15 +35,15 @@ import (
35
35
)
36
36
37
37
// AsSctx converts PlanContext to sessionctx.Context.
38
- func AsSctx (pctx base2 .PlanContext ) (sessionctx.Context , error ) {
38
+ func AsSctx (pctx base .PlanContext ) (sessionctx.Context , error ) {
39
39
sctx , ok := pctx .(sessionctx.Context )
40
40
if ! ok {
41
41
return nil , errors .New ("the current PlanContext cannot be converted to sessionctx.Context" )
42
42
}
43
43
return sctx , nil
44
44
}
45
45
46
- func enforceProperty (p * property.PhysicalProperty , tsk base2 .Task , ctx base2 .PlanContext ) base2 .Task {
46
+ func enforceProperty (p * property.PhysicalProperty , tsk base .Task , ctx base .PlanContext ) base .Task {
47
47
if p .TaskTp == property .MppTaskType {
48
48
mpp , ok := tsk .(* MppTask )
49
49
if ! ok || mpp .Invalid () {
@@ -75,7 +75,7 @@ func enforceProperty(p *property.PhysicalProperty, tsk base2.Task, ctx base2.Pla
75
75
}
76
76
77
77
// optimizeByShuffle insert `PhysicalShuffle` to optimize performance by running in a parallel manner.
78
- func optimizeByShuffle (tsk base2 .Task , ctx base2 .PlanContext ) base2 .Task {
78
+ func optimizeByShuffle (tsk base .Task , ctx base .PlanContext ) base .Task {
79
79
if tsk .Plan () == nil {
80
80
return tsk
81
81
}
@@ -97,7 +97,7 @@ func optimizeByShuffle(tsk base2.Task, ctx base2.PlanContext) base2.Task {
97
97
return tsk
98
98
}
99
99
100
- func optimizeByShuffle4Window (pp * PhysicalWindow , ctx base2 .PlanContext ) * PhysicalShuffle {
100
+ func optimizeByShuffle4Window (pp * PhysicalWindow , ctx base .PlanContext ) * PhysicalShuffle {
101
101
concurrency := ctx .GetSessionVars ().WindowConcurrency ()
102
102
if concurrency <= 1 {
103
103
return nil
@@ -128,15 +128,15 @@ func optimizeByShuffle4Window(pp *PhysicalWindow, ctx base2.PlanContext) *Physic
128
128
reqProp := & property.PhysicalProperty {ExpectedCnt : math .MaxFloat64 }
129
129
shuffle := PhysicalShuffle {
130
130
Concurrency : concurrency ,
131
- Tails : []base2 .PhysicalPlan {tail },
132
- DataSources : []base2 .PhysicalPlan {dataSource },
131
+ Tails : []base .PhysicalPlan {tail },
132
+ DataSources : []base .PhysicalPlan {dataSource },
133
133
SplitterType : PartitionHashSplitterType ,
134
134
ByItemArrays : [][]expression.Expression {byItems },
135
135
}.Init (ctx , pp .StatsInfo (), pp .QueryBlockOffset (), reqProp )
136
136
return shuffle
137
137
}
138
138
139
- func optimizeByShuffle4StreamAgg (pp * PhysicalStreamAgg , ctx base2 .PlanContext ) * PhysicalShuffle {
139
+ func optimizeByShuffle4StreamAgg (pp * PhysicalStreamAgg , ctx base .PlanContext ) * PhysicalShuffle {
140
140
concurrency := ctx .GetSessionVars ().StreamAggConcurrency ()
141
141
if concurrency <= 1 {
142
142
return nil
@@ -165,23 +165,23 @@ func optimizeByShuffle4StreamAgg(pp *PhysicalStreamAgg, ctx base2.PlanContext) *
165
165
reqProp := & property.PhysicalProperty {ExpectedCnt : math .MaxFloat64 }
166
166
shuffle := PhysicalShuffle {
167
167
Concurrency : concurrency ,
168
- Tails : []base2 .PhysicalPlan {tail },
169
- DataSources : []base2 .PhysicalPlan {dataSource },
168
+ Tails : []base .PhysicalPlan {tail },
169
+ DataSources : []base .PhysicalPlan {dataSource },
170
170
SplitterType : PartitionHashSplitterType ,
171
171
ByItemArrays : [][]expression.Expression {util .CloneExprs (pp .GroupByItems )},
172
172
}.Init (ctx , pp .StatsInfo (), pp .QueryBlockOffset (), reqProp )
173
173
return shuffle
174
174
}
175
175
176
- func optimizeByShuffle4MergeJoin (pp * PhysicalMergeJoin , ctx base2 .PlanContext ) * PhysicalShuffle {
176
+ func optimizeByShuffle4MergeJoin (pp * PhysicalMergeJoin , ctx base .PlanContext ) * PhysicalShuffle {
177
177
concurrency := ctx .GetSessionVars ().MergeJoinConcurrency ()
178
178
if concurrency <= 1 {
179
179
return nil
180
180
}
181
181
182
182
children := pp .Children ()
183
- dataSources := make ([]base2 .PhysicalPlan , len (children ))
184
- tails := make ([]base2 .PhysicalPlan , len (children ))
183
+ dataSources := make ([]base .PhysicalPlan , len (children ))
184
+ tails := make ([]base .PhysicalPlan , len (children ))
185
185
186
186
for i := range children {
187
187
sort , ok := children [i ].(* PhysicalSort )
@@ -215,7 +215,7 @@ func optimizeByShuffle4MergeJoin(pp *PhysicalMergeJoin, ctx base2.PlanContext) *
215
215
// LogicalPlan is a tree of logical operators.
216
216
// We can do a lot of logical optimizations to it, like predicate pushdown and column pruning.
217
217
type LogicalPlan interface {
218
- base2 .Plan
218
+ base .Plan
219
219
220
220
// HashCode encodes a LogicalPlan to fast compare whether a LogicalPlan equals to another.
221
221
// We use a strict encode method here which ensures there is no conflict.
@@ -237,7 +237,7 @@ type LogicalPlan interface {
237
237
// If planCounter > 0, the clock_th plan generated in this function will be returned.
238
238
// If planCounter = 0, the plan generated in this function will not be considered.
239
239
// If planCounter = -1, then we will not force plan.
240
- findBestTask (prop * property.PhysicalProperty , planCounter * PlanCounterTp , op * coreusage.PhysicalOptimizeOp ) (base2 .Task , int64 , error )
240
+ findBestTask (prop * property.PhysicalProperty , planCounter * PlanCounterTp , op * coreusage.PhysicalOptimizeOp ) (base .Task , int64 , error )
241
241
242
242
// BuildKeyInfo will collect the information of unique keys into schema.
243
243
// Because this method is also used in cascades planner, we cannot use
@@ -283,7 +283,7 @@ type LogicalPlan interface {
283
283
// It will return:
284
284
// 1. All possible plans that can match the required property.
285
285
// 2. Whether the SQL hint can work. Return true if there is no hint.
286
- exhaustPhysicalPlans (* property.PhysicalProperty ) (physicalPlans []base2 .PhysicalPlan , hintCanWork bool , err error )
286
+ exhaustPhysicalPlans (* property.PhysicalProperty ) (physicalPlans []base .PhysicalPlan , hintCanWork bool , err error )
287
287
288
288
// ExtractCorrelatedCols extracts correlated columns inside the LogicalPlan.
289
289
ExtractCorrelatedCols () []* expression.CorrelatedColumn
@@ -311,9 +311,9 @@ type LogicalPlan interface {
311
311
}
312
312
313
313
type baseLogicalPlan struct {
314
- base .Plan
314
+ baseimpl .Plan
315
315
316
- taskMap map [string ]base2 .Task
316
+ taskMap map [string ]base .Task
317
317
// taskMapBak forms a backlog stack of taskMap, used to roll back the taskMap.
318
318
taskMapBak []string
319
319
// taskMapBakTS stores the timestamps of logs.
@@ -349,7 +349,7 @@ func (*baseLogicalPlan) ExplainInfo() string {
349
349
return ""
350
350
}
351
351
352
- func getEstimatedProbeCntFromProbeParents (probeParents []base2 .PhysicalPlan ) float64 {
352
+ func getEstimatedProbeCntFromProbeParents (probeParents []base .PhysicalPlan ) float64 {
353
353
res := float64 (1 )
354
354
for _ , pp := range probeParents {
355
355
switch pp .(type ) {
@@ -363,7 +363,7 @@ func getEstimatedProbeCntFromProbeParents(probeParents []base2.PhysicalPlan) flo
363
363
return res
364
364
}
365
365
366
- func getActualProbeCntFromProbeParents (pps []base2 .PhysicalPlan , statsColl * execdetails.RuntimeStatsColl ) int64 {
366
+ func getActualProbeCntFromProbeParents (pps []base .PhysicalPlan , statsColl * execdetails.RuntimeStatsColl ) int64 {
367
367
res := int64 (1 )
368
368
for _ , pp := range pps {
369
369
switch pp .(type ) {
@@ -386,11 +386,11 @@ func getActualProbeCntFromProbeParents(pps []base2.PhysicalPlan, statsColl *exec
386
386
}
387
387
388
388
type basePhysicalPlan struct {
389
- base .Plan
389
+ baseimpl .Plan
390
390
391
391
childrenReqProps []* property.PhysicalProperty
392
- self base2 .PhysicalPlan
393
- children []base2 .PhysicalPlan
392
+ self base .PhysicalPlan
393
+ children []base .PhysicalPlan
394
394
395
395
// used by the new cost interface
396
396
planCostInit bool
@@ -399,15 +399,15 @@ type basePhysicalPlan struct {
399
399
400
400
// probeParents records the IndexJoins and Applys with this operator in their inner children.
401
401
// Please see comments in op.PhysicalPlan for details.
402
- probeParents []base2 .PhysicalPlan
402
+ probeParents []base .PhysicalPlan
403
403
404
404
// Only for MPP. If TiFlashFineGrainedShuffleStreamCount > 0:
405
405
// 1. For ExchangeSender, means its output will be partitioned by hash key.
406
406
// 2. For ExchangeReceiver/Window/Sort, means its input is already partitioned.
407
407
TiFlashFineGrainedShuffleStreamCount uint64
408
408
}
409
409
410
- func (p * basePhysicalPlan ) cloneWithSelf (newSelf base2 .PhysicalPlan ) (* basePhysicalPlan , error ) {
410
+ func (p * basePhysicalPlan ) cloneWithSelf (newSelf base .PhysicalPlan ) (* basePhysicalPlan , error ) {
411
411
base := & basePhysicalPlan {
412
412
Plan : p .Plan ,
413
413
self : newSelf ,
@@ -431,7 +431,7 @@ func (p *basePhysicalPlan) cloneWithSelf(newSelf base2.PhysicalPlan) (*basePhysi
431
431
}
432
432
433
433
// Clone implements op.PhysicalPlan interface.
434
- func (p * basePhysicalPlan ) Clone () (base2 .PhysicalPlan , error ) {
434
+ func (p * basePhysicalPlan ) Clone () (base .PhysicalPlan , error ) {
435
435
return nil , errors .Errorf ("%T doesn't support cloning" , p .self )
436
436
}
437
437
@@ -487,7 +487,7 @@ func (p *basePhysicalPlan) GetActualProbeCnt(statsColl *execdetails.RuntimeStats
487
487
return getActualProbeCntFromProbeParents (p .probeParents , statsColl )
488
488
}
489
489
490
- func (p * basePhysicalPlan ) SetProbeParents (probeParents []base2 .PhysicalPlan ) {
490
+ func (p * basePhysicalPlan ) SetProbeParents (probeParents []base .PhysicalPlan ) {
491
491
p .probeParents = probeParents
492
492
}
493
493
@@ -525,12 +525,12 @@ func (p *baseLogicalPlan) rollBackTaskMap(ts uint64) {
525
525
}
526
526
}
527
527
528
- func (p * baseLogicalPlan ) getTask (prop * property.PhysicalProperty ) base2 .Task {
528
+ func (p * baseLogicalPlan ) getTask (prop * property.PhysicalProperty ) base .Task {
529
529
key := prop .HashCode ()
530
530
return p .taskMap [string (key )]
531
531
}
532
532
533
- func (p * baseLogicalPlan ) storeTask (prop * property.PhysicalProperty , task base2 .Task ) {
533
+ func (p * baseLogicalPlan ) storeTask (prop * property.PhysicalProperty , task base .Task ) {
534
534
key := prop .HashCode ()
535
535
if p .SCtx ().GetSessionVars ().StmtCtx .StmtHints .TaskMapNeedBackUp () {
536
536
// Empty string for useless change.
@@ -597,19 +597,19 @@ func (p *logicalSchemaProducer) BuildKeyInfo(selfSchema *expression.Schema, chil
597
597
}
598
598
}
599
599
600
- func newBaseLogicalPlan (ctx base2 .PlanContext , tp string , self LogicalPlan , qbOffset int ) baseLogicalPlan {
600
+ func newBaseLogicalPlan (ctx base .PlanContext , tp string , self LogicalPlan , qbOffset int ) baseLogicalPlan {
601
601
return baseLogicalPlan {
602
- taskMap : make (map [string ]base2 .Task ),
602
+ taskMap : make (map [string ]base .Task ),
603
603
taskMapBak : make ([]string , 0 , 10 ),
604
604
taskMapBakTS : make ([]uint64 , 0 , 10 ),
605
- Plan : base .NewBasePlan (ctx , tp , qbOffset ),
605
+ Plan : baseimpl .NewBasePlan (ctx , tp , qbOffset ),
606
606
self : self ,
607
607
}
608
608
}
609
609
610
- func newBasePhysicalPlan (ctx base2 .PlanContext , tp string , self base2 .PhysicalPlan , offset int ) basePhysicalPlan {
610
+ func newBasePhysicalPlan (ctx base .PlanContext , tp string , self base .PhysicalPlan , offset int ) basePhysicalPlan {
611
611
return basePhysicalPlan {
612
- Plan : base .NewBasePlan (ctx , tp , offset ),
612
+ Plan : baseimpl .NewBasePlan (ctx , tp , offset ),
613
613
self : self ,
614
614
}
615
615
}
@@ -655,7 +655,7 @@ func (p *baseLogicalPlan) Children() []LogicalPlan {
655
655
}
656
656
657
657
// Children implements op.PhysicalPlan Children interface.
658
- func (p * basePhysicalPlan ) Children () []base2 .PhysicalPlan {
658
+ func (p * basePhysicalPlan ) Children () []base .PhysicalPlan {
659
659
return p .children
660
660
}
661
661
@@ -665,7 +665,7 @@ func (p *baseLogicalPlan) SetChildren(children ...LogicalPlan) {
665
665
}
666
666
667
667
// SetChildren implements op.PhysicalPlan SetChildren interface.
668
- func (p * basePhysicalPlan ) SetChildren (children ... base2 .PhysicalPlan ) {
668
+ func (p * basePhysicalPlan ) SetChildren (children ... base .PhysicalPlan ) {
669
669
p .children = children
670
670
}
671
671
@@ -675,7 +675,7 @@ func (p *baseLogicalPlan) SetChild(i int, child LogicalPlan) {
675
675
}
676
676
677
677
// SetChild implements op.PhysicalPlan SetChild interface.
678
- func (p * basePhysicalPlan ) SetChild (i int , child base2 .PhysicalPlan ) {
678
+ func (p * basePhysicalPlan ) SetChild (i int , child base .PhysicalPlan ) {
679
679
p .children [i ] = child
680
680
}
681
681
0 commit comments