Skip to content

Commit

Permalink
planner: column pruning should use a shallow copy slice (pingcap#53237)
Browse files Browse the repository at this point in the history
  • Loading branch information
winoros authored and terry1purcell committed May 17, 2024
1 parent 324cdb8 commit 62141ee
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/planner/core/rule_column_pruning.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"bytes"
"context"
"fmt"
"slices"

"github.com/pingcap/tidb/pkg/expression"
"github.com/pingcap/tidb/pkg/expression/aggregation"
Expand All @@ -37,7 +38,7 @@ type columnPruner struct {

func (*columnPruner) optimize(_ context.Context, lp base.LogicalPlan, opt *optimizetrace.LogicalOptimizeOp) (base.LogicalPlan, bool, error) {
planChanged := false
lp, err := lp.PruneColumns(lp.Schema().Columns, opt)
lp, err := lp.PruneColumns(slices.Clone(lp.Schema().Columns), opt)
if err != nil {
return nil, planChanged, err
}
Expand Down

0 comments on commit 62141ee

Please sign in to comment.