Skip to content

Commit 00ac9f8

Browse files
authored
planner: use slices.Compact to deduplicate (#59214)
1 parent d0d4876 commit 00ac9f8

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

pkg/planner/core/rule_partition_processor.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -411,13 +411,8 @@ func (s *PartitionProcessor) findUsedPartitions(ctx base.PlanContext,
411411
return s.convertToIntSlice(or, pi, partitionNames), nil
412412
}
413413
slices.Sort(used)
414-
ret := used[:0]
415-
for i := 0; i < len(used); i++ {
416-
if i == 0 || used[i] != used[i-1] {
417-
ret = append(ret, used[i])
418-
}
419-
}
420-
return ret, nil
414+
used = slices.Compact(used)
415+
return used, nil
421416
}
422417

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

0 commit comments

Comments
 (0)