marioloko opened a new pull request, #2943:
URL: https://github.com/apache/arrow-rs/pull/2943
# Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases. You can
link an issue to this PR using the GitHub syntax. For example `Closes #123`
indicates that this PR will close issue #123.
-->
Closes #1604
# Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in
the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your
changes and offer better suggestions for fixes.
-->
* This adds the implementation of LZ4_RAW codec by using lz4 block
compression algorithm. (#1604)
* This commit uses
https://stackoverflow.com/questions/25740471/lz4-library-decompressed-data-upper-bound-size-estimation
formula to estime the size of the uncompressed size. As it is said in thread,
this algorithm over-estimates the size, but it is probably the best we can get
with the current decompress API. As the size of a arrow LZ4_RAW block is not
prepended to the block.
* Other option would be to take the C++ approach to bypass the API
https://github.com/apache/arrow/blob/master/cpp/src/arrow/util/compression_lz4.cc#L343.
This approach consists on relaying on the output_buffer capacity to guess the
uncompress_size. This works as `serialized_reader.rs` already knows the
uncompressed_size, as it reads it from the page header, and allocates the
output_buffer with a capacity equal to the uncompress_size
https://github.com/marioloko/arrow-rs/blob/master/parquet/src/file/serialized_reader.rs#L417.
I did not follow this approach because:
1. It is too hacky.
2. It will limit the use cases of the `decompress` API, as the caller
will need to know to allocate the right uncompressed_size.
3. It is not compatible with the current test logic followed by the
other codecs. However, specific tests can be created if needed.
# What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is
sometimes worth providing a summary of the individual changes in this PR.
-->
The implementation of an LZ4_RAW codec using LZ4 block algorithm.
# Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.
-->
No changes in the API, but parquet files compressed using LZ4_RAW will be
supported now.
<!---
If there are any breaking changes to public APIs, please add the `breaking
change` label.
-->
--
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]