Commit fec3c02
authored
fix: remove incorrect debug assertion in BatchCoalescer (#9508)
# Which issue does this PR close?
- Closes #9506
# Rationale for this change
`Vec::reserve(n)` does not guarantee exact capacity, Rust's
`MIN_NON_ZERO_CAP` optimization means `reserve(2)` gives capacity = 4
for most numeric types, causing `debug_assert_eq!(capacity, batch_size)`
to panic in debug mode when `batch_size < 4`.
# What changes are included in this PR?
Replace `reserve` with `reserve_exact` in `ensure_capacity` in both
`InProgressPrimitiveArray` and `InProgressByteViewArray`.
`reserve_exact` skips the amortized growth optimization and allocates
exactly the requested capacity, making the assertion correct.
# Are these changes tested?
No. This only fixes an incorrect debug assertion.
# Are there any user-facing changes?
No1 parent 097c203 commit fec3c02
2 files changed
+0
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
105 | 104 | | |
106 | 105 | | |
107 | 106 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
62 | 61 | | |
63 | 62 | | |
64 | 63 | | |
| |||
0 commit comments