Skip to content

Commit

Permalink
planner: prealloc the slices in the SplitCorColAccessCondFromFilters (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkingrei authored Jan 8, 2025
1 parent d1ed962 commit 7479804
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/planner/util/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ func (path *AccessPath) SplitCorColAccessCondFromFilters(ctx planctx.PlanContext
}
access = make([]expression.Expression, len(path.IdxCols)-eqOrInCount)
used := make([]bool, len(path.TableFilters))
usedCnt := 0
for i := eqOrInCount; i < len(path.IdxCols); i++ {
matched := false
for j, filter := range path.TableFilters {
Expand All @@ -217,6 +218,7 @@ func (path *AccessPath) SplitCorColAccessCondFromFilters(ctx planctx.PlanContext
access[i-eqOrInCount] = filter
if path.IdxColLens[i] == types.UnspecifiedLength {
used[j] = true
usedCnt++
}
break
}
Expand All @@ -225,6 +227,7 @@ func (path *AccessPath) SplitCorColAccessCondFromFilters(ctx planctx.PlanContext
break
}
}
remained = make([]expression.Expression, 0, len(used)-usedCnt)
for i, ok := range used {
if !ok {
remained = append(remained, path.TableFilters[i]) // nozero
Expand Down

0 comments on commit 7479804

Please sign in to comment.