From 6cffa2fbab0fbf2bb69278c5afcda93547bd41bf Mon Sep 17 00:00:00 2001 From: Weizhen Wang Date: Wed, 22 Jan 2025 22:04:41 +0800 Subject: [PATCH] planner: Bound Check Elimination in the PhysicalTableScan.Clone (#59102) ref pingcap/tidb#34669 --- pkg/planner/core/physical_plans.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/planner/core/physical_plans.go b/pkg/planner/core/physical_plans.go index 163ff6145a..39b67b1930 100644 --- a/pkg/planner/core/physical_plans.go +++ b/pkg/planner/core/physical_plans.go @@ -995,10 +995,10 @@ func (ts *PhysicalTableScan) Clone(newCtx base.PlanContext) (base.PhysicalPlan, clonedScan.Ranges = util.CloneRanges(ts.Ranges) clonedScan.TableAsName = ts.TableAsName clonedScan.rangeInfo = ts.rangeInfo - clonedScan.runtimeFilterList = make([]*RuntimeFilter, len(ts.runtimeFilterList)) - for i, rf := range ts.runtimeFilterList { + clonedScan.runtimeFilterList = make([]*RuntimeFilter, 0, len(ts.runtimeFilterList)) + for _, rf := range ts.runtimeFilterList { clonedRF := rf.Clone() - clonedScan.runtimeFilterList[i] = clonedRF + clonedScan.runtimeFilterList = append(clonedScan.runtimeFilterList, clonedRF) } return clonedScan, nil }