ryanvickr opened a new issue, #55487:
URL: https://github.com/apache/arrow/issues/55487
### Describe the bug, including details regarding any error messages,
version, and platform.
`DeltaLengthByteArrayEncoder` in `cpp/src/parquet/encoder.cc` has three
issues when encoding string/binary pages:
1. **Caller `MemoryPool*` is overwritten with `default_memory_pool()`**: The
constructor writes `EncoderImpl(descr, Encoding::DELTA_LENGTH_BYTE_ARRAY, pool
= ::arrow::default_memory_pool())` (assignment in the initializer list instead
of a default parameter), resetting `pool` before initializing `sink_(pool)` and
`length_encoder_(nullptr, pool)`. Allocations on `DeltaLengthByteArrayEncoder`
(and `DeltaByteArrayEncoder::suffix_encoder_`) bypass caller-provided memory
pools.
2. **Unbatched `PutBinaryArray` without pre-reserving `sink_`**:
`PutBinaryArray` invokes `length_encoder_.Put({len}, 1)` per element and
appends to `sink_` without pre-reserving capacity, unlike `Put(const
ByteArray*, int)` (which batches 256 lengths and reserves `sink_` up front) and
other Parquet writers (`parquet-rs`, Polars).
3. **Zero-length `UnsafeAppend` with null data pointer**: `Put(const
ByteArray*, int)` calls `sink_.UnsafeAppend(src[idx].ptr, src[idx].len)`
unconditionally, passing `nullptr` to `std::memcpy(dest, nullptr, 0)` under
UBSan on `ByteArray(0, nullptr)` values.
### Component(s)
C++, Parquet
--
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]