Skip to content

Commit

Permalink
planner: use slices.Compact to deduplicate (pingcap#59214)
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkingrei authored Jan 27, 2025
1 parent d0d4876 commit 00ac9f8
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions pkg/planner/core/rule_partition_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,13 +411,8 @@ func (s *PartitionProcessor) findUsedPartitions(ctx base.PlanContext,
return s.convertToIntSlice(or, pi, partitionNames), nil
}
slices.Sort(used)
ret := used[:0]
for i := 0; i < len(used); i++ {
if i == 0 || used[i] != used[i-1] {
ret = append(ret, used[i])
}
}
return ret, nil
used = slices.Compact(used)
return used, nil
}

func (s *PartitionProcessor) convertToIntSlice(or partitionRangeOR, pi *model.PartitionInfo, partitionNames []ast.CIStr) []int {
Expand Down

0 comments on commit 00ac9f8

Please sign in to comment.