ezbr opened a new pull request, #52276: URL: https://github.com/apache/arrow/pull/52276
### Rationale for this change `std::vector::reserve(delta_)` only guarantees `capacity() >= delta_`, not `capacity() == delta_`. When the C++ standard library and allocator use size-returning allocations (such as C++23 `allocate_at_least`), `reserve(delta_)` can immediately set `capacity() > delta_`, causing `TDigestImpl::Validate()` to fail with `"oversized tdigest buffer"` even when the number of centroids is at most `delta_`. ### What changes are included in this PR? Check `tdigests_[0].size() > delta_ || tdigests_[1].size() > delta_` instead of `capacity() > delta_` in `TDigest::TDigestImpl::Validate()`. ### Are these changes tested? Yes, covered by existing `TDigestTest` unit tests in `cpp/src/arrow/util/tdigest_test.cc`. ### Are there any user-facing changes? No. ### Was AI used for this PR? **PR code and description written by:** - [x] Human - [x] AI **Reviewed before submission by:** - [x] Human - [ ] AI - [ ] Not reviewed -- 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]
