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 }