284 lines
9.7 KiB
Go
284 lines
9.7 KiB
Go
// Copyright 2024 PingCAP, Inc.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
// Code generated by plan_clone_generator; DO NOT EDIT IT DIRECTLY.
|
|
|
|
package core
|
|
|
|
import (
|
|
"github.com/pingcap/tidb/pkg/expression"
|
|
"github.com/pingcap/tidb/pkg/planner/core/base"
|
|
"github.com/pingcap/tidb/pkg/planner/util"
|
|
)
|
|
|
|
// CloneForPlanCache implements the base.Plan interface.
|
|
func (op *PhysicalTableScan) CloneForPlanCache(newCtx base.PlanContext) (base.Plan, bool) {
|
|
cloned := new(PhysicalTableScan)
|
|
*cloned = *op
|
|
basePlan, baseOK := op.physicalSchemaProducer.cloneForPlanCacheWithSelf(newCtx, cloned)
|
|
if !baseOK {
|
|
return nil, false
|
|
}
|
|
cloned.physicalSchemaProducer = *basePlan
|
|
cloned.AccessCondition = util.CloneExprs(op.AccessCondition)
|
|
cloned.filterCondition = util.CloneExprs(op.filterCondition)
|
|
cloned.LateMaterializationFilterCondition = util.CloneExprs(op.LateMaterializationFilterCondition)
|
|
cloned.Ranges = util.CloneRanges(op.Ranges)
|
|
cloned.HandleIdx = make([]int, len(op.HandleIdx))
|
|
copy(cloned.HandleIdx, op.HandleIdx)
|
|
cloned.HandleCols = op.HandleCols.Clone(newCtx.GetSessionVars().StmtCtx)
|
|
cloned.ByItems = util.CloneByItems(op.ByItems)
|
|
cloned.PlanPartInfo = op.PlanPartInfo.Clone()
|
|
if op.SampleInfo != nil {
|
|
return nil, false
|
|
}
|
|
cloned.constColsByCond = make([]bool, len(op.constColsByCond))
|
|
copy(cloned.constColsByCond, op.constColsByCond)
|
|
if op.runtimeFilterList != nil {
|
|
return nil, false
|
|
}
|
|
return cloned, true
|
|
}
|
|
|
|
// CloneForPlanCache implements the base.Plan interface.
|
|
func (op *PhysicalIndexScan) CloneForPlanCache(newCtx base.PlanContext) (base.Plan, bool) {
|
|
cloned := new(PhysicalIndexScan)
|
|
*cloned = *op
|
|
basePlan, baseOK := op.physicalSchemaProducer.cloneForPlanCacheWithSelf(newCtx, cloned)
|
|
if !baseOK {
|
|
return nil, false
|
|
}
|
|
cloned.physicalSchemaProducer = *basePlan
|
|
cloned.AccessCondition = util.CloneExprs(op.AccessCondition)
|
|
cloned.IdxCols = util.CloneCols(op.IdxCols)
|
|
cloned.IdxColLens = make([]int, len(op.IdxColLens))
|
|
copy(cloned.IdxColLens, op.IdxColLens)
|
|
cloned.Ranges = util.CloneRanges(op.Ranges)
|
|
if op.GenExprs != nil {
|
|
return nil, false
|
|
}
|
|
cloned.ByItems = util.CloneByItems(op.ByItems)
|
|
cloned.pkIsHandleCol = op.pkIsHandleCol.Clone().(*expression.Column)
|
|
cloned.constColsByCond = make([]bool, len(op.constColsByCond))
|
|
copy(cloned.constColsByCond, op.constColsByCond)
|
|
return cloned, true
|
|
}
|
|
|
|
// CloneForPlanCache implements the base.Plan interface.
|
|
func (op *PhysicalSelection) CloneForPlanCache(newCtx base.PlanContext) (base.Plan, bool) {
|
|
cloned := new(PhysicalSelection)
|
|
*cloned = *op
|
|
basePlan, baseOK := op.basePhysicalPlan.cloneForPlanCacheWithSelf(newCtx, cloned)
|
|
if !baseOK {
|
|
return nil, false
|
|
}
|
|
cloned.basePhysicalPlan = *basePlan
|
|
cloned.Conditions = util.CloneExprs(op.Conditions)
|
|
return cloned, true
|
|
}
|
|
|
|
// CloneForPlanCache implements the base.Plan interface.
|
|
func (op *PhysicalProjection) CloneForPlanCache(newCtx base.PlanContext) (base.Plan, bool) {
|
|
cloned := new(PhysicalProjection)
|
|
*cloned = *op
|
|
basePlan, baseOK := op.physicalSchemaProducer.cloneForPlanCacheWithSelf(newCtx, cloned)
|
|
if !baseOK {
|
|
return nil, false
|
|
}
|
|
cloned.physicalSchemaProducer = *basePlan
|
|
cloned.Exprs = util.CloneExprs(op.Exprs)
|
|
return cloned, true
|
|
}
|
|
|
|
// CloneForPlanCache implements the base.Plan interface.
|
|
func (op *PhysicalSort) CloneForPlanCache(newCtx base.PlanContext) (base.Plan, bool) {
|
|
cloned := new(PhysicalSort)
|
|
*cloned = *op
|
|
basePlan, baseOK := op.basePhysicalPlan.cloneForPlanCacheWithSelf(newCtx, cloned)
|
|
if !baseOK {
|
|
return nil, false
|
|
}
|
|
cloned.basePhysicalPlan = *basePlan
|
|
cloned.ByItems = util.CloneByItems(op.ByItems)
|
|
return cloned, true
|
|
}
|
|
|
|
// CloneForPlanCache implements the base.Plan interface.
|
|
func (op *PhysicalTopN) CloneForPlanCache(newCtx base.PlanContext) (base.Plan, bool) {
|
|
cloned := new(PhysicalTopN)
|
|
*cloned = *op
|
|
basePlan, baseOK := op.basePhysicalPlan.cloneForPlanCacheWithSelf(newCtx, cloned)
|
|
if !baseOK {
|
|
return nil, false
|
|
}
|
|
cloned.basePhysicalPlan = *basePlan
|
|
cloned.ByItems = util.CloneByItems(op.ByItems)
|
|
cloned.PartitionBy = util.CloneSortItem(op.PartitionBy)
|
|
return cloned, true
|
|
}
|
|
|
|
// CloneForPlanCache implements the base.Plan interface.
|
|
func (op *PhysicalStreamAgg) CloneForPlanCache(newCtx base.PlanContext) (base.Plan, bool) {
|
|
cloned := new(PhysicalStreamAgg)
|
|
*cloned = *op
|
|
basePlan, baseOK := op.basePhysicalAgg.cloneForPlanCacheWithSelf(newCtx, cloned)
|
|
if !baseOK {
|
|
return nil, false
|
|
}
|
|
cloned.basePhysicalAgg = *basePlan
|
|
return cloned, true
|
|
}
|
|
|
|
// CloneForPlanCache implements the base.Plan interface.
|
|
func (op *PhysicalHashAgg) CloneForPlanCache(newCtx base.PlanContext) (base.Plan, bool) {
|
|
cloned := new(PhysicalHashAgg)
|
|
*cloned = *op
|
|
basePlan, baseOK := op.basePhysicalAgg.cloneForPlanCacheWithSelf(newCtx, cloned)
|
|
if !baseOK {
|
|
return nil, false
|
|
}
|
|
cloned.basePhysicalAgg = *basePlan
|
|
return cloned, true
|
|
}
|
|
|
|
// CloneForPlanCache implements the base.Plan interface.
|
|
func (op *PhysicalHashJoin) CloneForPlanCache(newCtx base.PlanContext) (base.Plan, bool) {
|
|
cloned := new(PhysicalHashJoin)
|
|
*cloned = *op
|
|
basePlan, baseOK := op.basePhysicalJoin.cloneForPlanCacheWithSelf(newCtx, cloned)
|
|
if !baseOK {
|
|
return nil, false
|
|
}
|
|
cloned.basePhysicalJoin = *basePlan
|
|
cloned.EqualConditions = util.CloneScalarFunctions(op.EqualConditions)
|
|
cloned.NAEqualConditions = util.CloneScalarFunctions(op.NAEqualConditions)
|
|
if op.runtimeFilterList != nil {
|
|
return nil, false
|
|
}
|
|
return cloned, true
|
|
}
|
|
|
|
// CloneForPlanCache implements the base.Plan interface.
|
|
func (op *PhysicalMergeJoin) CloneForPlanCache(newCtx base.PlanContext) (base.Plan, bool) {
|
|
cloned := new(PhysicalMergeJoin)
|
|
*cloned = *op
|
|
basePlan, baseOK := op.basePhysicalJoin.cloneForPlanCacheWithSelf(newCtx, cloned)
|
|
if !baseOK {
|
|
return nil, false
|
|
}
|
|
cloned.basePhysicalJoin = *basePlan
|
|
return cloned, true
|
|
}
|
|
|
|
// CloneForPlanCache implements the base.Plan interface.
|
|
func (op *PhysicalTableReader) CloneForPlanCache(newCtx base.PlanContext) (base.Plan, bool) {
|
|
cloned := new(PhysicalTableReader)
|
|
*cloned = *op
|
|
basePlan, baseOK := op.physicalSchemaProducer.cloneForPlanCacheWithSelf(newCtx, cloned)
|
|
if !baseOK {
|
|
return nil, false
|
|
}
|
|
cloned.physicalSchemaProducer = *basePlan
|
|
tablePlan, ok := op.tablePlan.CloneForPlanCache(newCtx)
|
|
if !ok {
|
|
return nil, false
|
|
}
|
|
cloned.tablePlan = tablePlan.(base.PhysicalPlan)
|
|
cloned.TablePlans = flattenPushDownPlan(cloned.tablePlan)
|
|
cloned.PlanPartInfo = op.PlanPartInfo.Clone()
|
|
if op.TableScanAndPartitionInfos != nil {
|
|
return nil, false
|
|
}
|
|
return cloned, true
|
|
}
|
|
|
|
// CloneForPlanCache implements the base.Plan interface.
|
|
func (op *PhysicalIndexReader) CloneForPlanCache(newCtx base.PlanContext) (base.Plan, bool) {
|
|
cloned := new(PhysicalIndexReader)
|
|
*cloned = *op
|
|
basePlan, baseOK := op.physicalSchemaProducer.cloneForPlanCacheWithSelf(newCtx, cloned)
|
|
if !baseOK {
|
|
return nil, false
|
|
}
|
|
cloned.physicalSchemaProducer = *basePlan
|
|
indexPlan, ok := op.indexPlan.CloneForPlanCache(newCtx)
|
|
if !ok {
|
|
return nil, false
|
|
}
|
|
cloned.indexPlan = indexPlan.(base.PhysicalPlan)
|
|
cloned.IndexPlans = flattenPushDownPlan(cloned.indexPlan)
|
|
cloned.OutputColumns = util.CloneCols(op.OutputColumns)
|
|
cloned.PlanPartInfo = op.PlanPartInfo.Clone()
|
|
return cloned, true
|
|
}
|
|
|
|
// CloneForPlanCache implements the base.Plan interface.
|
|
func (op *PhysicalIndexLookUpReader) CloneForPlanCache(newCtx base.PlanContext) (base.Plan, bool) {
|
|
cloned := new(PhysicalIndexLookUpReader)
|
|
*cloned = *op
|
|
basePlan, baseOK := op.physicalSchemaProducer.cloneForPlanCacheWithSelf(newCtx, cloned)
|
|
if !baseOK {
|
|
return nil, false
|
|
}
|
|
cloned.physicalSchemaProducer = *basePlan
|
|
indexPlan, ok := op.indexPlan.CloneForPlanCache(newCtx)
|
|
if !ok {
|
|
return nil, false
|
|
}
|
|
cloned.indexPlan = indexPlan.(base.PhysicalPlan)
|
|
tablePlan, ok := op.tablePlan.CloneForPlanCache(newCtx)
|
|
if !ok {
|
|
return nil, false
|
|
}
|
|
cloned.tablePlan = tablePlan.(base.PhysicalPlan)
|
|
cloned.IndexPlans = flattenPushDownPlan(cloned.indexPlan)
|
|
cloned.TablePlans = flattenPushDownPlan(cloned.tablePlan)
|
|
cloned.ExtraHandleCol = op.ExtraHandleCol.Clone().(*expression.Column)
|
|
cloned.PushedLimit = op.PushedLimit.Clone()
|
|
cloned.CommonHandleCols = util.CloneCols(op.CommonHandleCols)
|
|
cloned.PlanPartInfo = op.PlanPartInfo.Clone()
|
|
return cloned, true
|
|
}
|
|
|
|
// CloneForPlanCache implements the base.Plan interface.
|
|
func (op *PhysicalIndexMergeReader) CloneForPlanCache(newCtx base.PlanContext) (base.Plan, bool) {
|
|
cloned := new(PhysicalIndexMergeReader)
|
|
*cloned = *op
|
|
basePlan, baseOK := op.physicalSchemaProducer.cloneForPlanCacheWithSelf(newCtx, cloned)
|
|
if !baseOK {
|
|
return nil, false
|
|
}
|
|
cloned.physicalSchemaProducer = *basePlan
|
|
cloned.PushedLimit = op.PushedLimit.Clone()
|
|
cloned.ByItems = util.CloneByItems(op.ByItems)
|
|
partialPlans, ok := clonePhysicalPlansForPlanCache(newCtx, op.partialPlans)
|
|
if !ok {
|
|
return nil, false
|
|
}
|
|
cloned.partialPlans = partialPlans
|
|
tablePlan, ok := op.tablePlan.CloneForPlanCache(newCtx)
|
|
if !ok {
|
|
return nil, false
|
|
}
|
|
cloned.tablePlan = tablePlan.(base.PhysicalPlan)
|
|
cloned.PartialPlans = make([][]base.PhysicalPlan, len(op.PartialPlans))
|
|
for i, plan := range cloned.partialPlans {
|
|
cloned.PartialPlans[i] = flattenPushDownPlan(plan)
|
|
}
|
|
cloned.TablePlans = flattenPushDownPlan(cloned.tablePlan)
|
|
cloned.PlanPartInfo = op.PlanPartInfo.Clone()
|
|
cloned.HandleCols = op.HandleCols.Clone(newCtx.GetSessionVars().StmtCtx)
|
|
return cloned, true
|
|
}
|