planner: eliminate the findBestTask function pointer when call for physicalization of show (#63971)
ref pingcap/tidb#52714
This commit is contained in:
@ -33,7 +33,6 @@ func init() {
|
||||
utilfuncp.FindBestTask4LogicalShow = findBestTask4LogicalShow
|
||||
utilfuncp.FindBestTask4LogicalCTETable = findBestTask4LogicalCTETable
|
||||
utilfuncp.FindBestTask4LogicalDataSource = findBestTask4LogicalDataSource
|
||||
utilfuncp.FindBestTask4LogicalShowDDLJobs = findBestTask4LogicalShowDDLJobs
|
||||
utilfuncp.ExhaustPhysicalPlans4LogicalJoin = exhaustPhysicalPlans4LogicalJoin
|
||||
utilfuncp.ExhaustPhysicalPlans4LogicalApply = exhaustPhysicalPlans4LogicalApply
|
||||
utilfuncp.ExhaustPhysicalPlans4LogicalWindow = exhaustPhysicalPlans4LogicalWindow
|
||||
|
||||
@ -76,22 +76,6 @@ func findBestTask4LogicalShow(super base.LogicalPlan, prop *property.PhysicalPro
|
||||
return rt, nil
|
||||
}
|
||||
|
||||
func findBestTask4LogicalShowDDLJobs(super base.LogicalPlan, prop *property.PhysicalProperty) (base.Task, error) {
|
||||
if prop.IndexJoinProp != nil {
|
||||
// even enforce hint can not work with this.
|
||||
return base.InvalidTask, nil
|
||||
}
|
||||
_, p := base.GetGEAndLogicalOp[*logicalop.LogicalShowDDLJobs](super)
|
||||
if !prop.IsSortItemEmpty() {
|
||||
return base.InvalidTask, nil
|
||||
}
|
||||
pShow := physicalop.PhysicalShowDDLJobs{JobNumber: p.JobNumber}.Init(p.SCtx())
|
||||
pShow.SetSchema(p.Schema())
|
||||
rt := &physicalop.RootTask{}
|
||||
rt.SetPlan(pShow)
|
||||
return rt, nil
|
||||
}
|
||||
|
||||
func prepareIterationDownElems(super base.LogicalPlan) (*memo.GroupExpression, *logicalop.BaseLogicalPlan, int, iterFunc, base.LogicalPlan) {
|
||||
// get the possible group expression and logical operator from common lp pointer.
|
||||
ge, self := getGEAndSelf(super)
|
||||
|
||||
@ -493,7 +493,7 @@ func FindBestTask(e base.LogicalPlan, prop *property.PhysicalProperty) (bestTask
|
||||
case *logicalop.DataSource:
|
||||
return utilfuncp.FindBestTask4LogicalDataSource(e, prop)
|
||||
case *logicalop.LogicalShowDDLJobs:
|
||||
return utilfuncp.FindBestTask4LogicalShowDDLJobs(e, prop)
|
||||
return findBestTask4LogicalShowDDLJobs(e, prop)
|
||||
case *logicalop.MockDataSource:
|
||||
return findBestTask4LogicalMockDatasource(lop, prop)
|
||||
default:
|
||||
|
||||
@ -71,3 +71,19 @@ func (p *PhysicalShowDDLJobs) MemoryUsage() (sum int64) {
|
||||
}
|
||||
return p.PhysicalSchemaProducer.MemoryUsage() + size.SizeOfInt64
|
||||
}
|
||||
|
||||
func findBestTask4LogicalShowDDLJobs(super base.LogicalPlan, prop *property.PhysicalProperty) (base.Task, error) {
|
||||
if prop.IndexJoinProp != nil {
|
||||
// even enforce hint can not work with this.
|
||||
return base.InvalidTask, nil
|
||||
}
|
||||
_, p := base.GetGEAndLogicalOp[*logicalop.LogicalShowDDLJobs](super)
|
||||
if !prop.IsSortItemEmpty() {
|
||||
return base.InvalidTask, nil
|
||||
}
|
||||
pShow := PhysicalShowDDLJobs{JobNumber: p.JobNumber}.Init(p.SCtx())
|
||||
pShow.SetSchema(p.Schema())
|
||||
rt := &RootTask{}
|
||||
rt.SetPlan(pShow)
|
||||
return rt, nil
|
||||
}
|
||||
|
||||
@ -53,10 +53,6 @@ var FindBestTask4LogicalCTETable func(lp base.LogicalPlan,
|
||||
// FindBestTask4LogicalShow will be called by LogicalShow in logicalOp pkg.
|
||||
var FindBestTask4LogicalShow func(lp base.LogicalPlan, prop *property.PhysicalProperty) (base.Task, error)
|
||||
|
||||
// FindBestTask4LogicalShowDDLJobs will be called by LogicalShowDDLJobs in logicalOp pkg.
|
||||
var FindBestTask4LogicalShowDDLJobs func(lp base.LogicalPlan,
|
||||
prop *property.PhysicalProperty) (base.Task, error)
|
||||
|
||||
// FindBestTask4LogicalCTE will be called by LogicalCTE in logicalOp pkg.
|
||||
var FindBestTask4LogicalCTE func(lp base.LogicalPlan,
|
||||
prop *property.PhysicalProperty) (t base.Task, err error)
|
||||
|
||||
Reference in New Issue
Block a user