Tim-53 opened a new pull request, #9508:
URL: https://github.com/apache/arrow-rs/pull/9508
# Which issue does this PR close?
- Closes https://github.com/apache/arrow-rs/issues/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?
No
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]