PG1204 opened a new pull request, #1248: URL: https://github.com/apache/arrow-java/pull/1248
## What's Changed `AbstractCompressionCodec.compress()` wrote a length prefix of `0` for empty buffers. The Arrow IPC compression format only defines a positive length (compressed) or `-1` / `NO_COMPRESSION_LENGTH` (stored uncompressed); a `0` prefix is undefined. As a result, C++/PyArrow reject Java-produced streams that contain empty buffers, even though Java itself accepts them on read. This changes the empty-buffer shortcut in `compress()` to write `CompressionUtil.NO_COMPRESSION_LENGTH` (`-1`) instead of `0`. `decompress()` is intentionally left unchanged: - its `NO_COMPRESSION_LENGTH` branch handles the new output, and - its `decompressedLength == 0` branch remains for backward-compatible reads of older Java-produced streams. Added a parameterized test (`testEmptyBufferWritesUncompressedSentinel`, covering LZ4 and ZSTD) that compresses an empty buffer, asserts the prefix equals `NO_COMPRESSION_LENGTH`, and asserts it round-trips back to a zero-length buffer. The pre-existing `testEmptyBuffer` continues to pass with empty buffers now routed through the `-1` path. Closes #1196. -- 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]
