ryanvickr opened a new pull request, #55686: URL: https://github.com/apache/arrow/pull/55686
### Rationale for this change `DeltaLengthByteArrayEncoder` currently overwrites the caller's `MemoryPool*` with `default_memory_pool()` in its constructor initializer list (affecting both `DELTA_LENGTH_BYTE_ARRAY` and `DELTA_BYTE_ARRAY`'s `suffix_encoder_`), and calls `BufferBuilder::UnsafeAppend` on zero-length `ByteArray` items (which triggers UB under UBSan when `ptr == nullptr`). Split out from #55488 so these fixes can be reviewed separately from the `PutBinaryArray` optimization. ### What changes are included in this PR? - Forward `pool` directly in `DeltaLengthByteArrayEncoder`'s constructor instead of reassigning it to `default_memory_pool()`. - Skip `sink_.Reserve` / `sink_.UnsafeAppend` for zero-length items in `DeltaLengthByteArrayEncoder::Put(const ByteArray*, int)`. ### Are these changes tested? Yes, added unit tests in `cpp/src/parquet/encoding_test.cc` for custom memory pool tracking (for both `DELTA_LENGTH_BYTE_ARRAY` and `DELTA_BYTE_ARRAY`) and zero-length `ByteArray(0, nullptr)` inputs. ### Are there any user-facing changes? Callers passing a custom `MemoryPool*` when encoding `DELTA_LENGTH_BYTE_ARRAY` or `DELTA_BYTE_ARRAY` columns will now have encoder allocations tracked on that pool. ### Was AI used for this PR? In accordance to the [AI generation guidelines](https://arrow.apache.org/docs/dev/developers/overview.html#ai-generated-code), please disclose below whether and how AI was used in this PR. **PR code and description written by:** - [x] Human - [x] AI **Reviewed before submission by:** - [x] Human - [ ] AI - [ ] Not reviewed Closes #55685 -- 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]
