Files
tidb/pkg/planner/core/plan_clone_generated.go

183 lines
6.2 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
}