You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[C++][Parquet] Expose the API to fine tune the window_bits parameter of ZLIB compression #35287
ZLIB library supports history buffers of different sizes by setting windowBits parameter, while currently in Arrow it is set as a fixed value. It makes sense that setting the window size to the maximum number will give a better performance, while it does not provide too much flexibility. As we know there would be some scenarios where the memory efficiency is very limited, or the software stack is relatively old and do not have a large memory capacity. For those cases, the user may want to set the window bits to a small number to save some memory. At least it would be much more flexible to give users such an option to choose the window size when de/compressing. If that makes sense, we would like to add such a property for the user to set the ZLIB(GZIP) window_bits, and will ensure not affecting the existing function calls. Thanks!
Maybe you can just the style of compression_level to pass the argument in?
Hi, thanks for your quick reply! Do you mean we could add another parquet writer property (maybe can call it window_bits) just like how compression_level passed in? That's also what we are trying to do now :)
Yes, it will give much more flexibility! Seems like rocksdb already support window_bits as an option, and many other arguments as well. Maybe I could help to draft a PR to add the window_bits option (or any other if needed) to Arrow as a kickoff?
And use MakeGZipCodec in src/arrow/util/compression_internal.h firstly. Later we can extend it. Do you think this is ok?
Yes we would definitely not break the original interface. Change MakeGZipCodec is also what I want to do first! The only thing I need to double confirm is that since we want to pass the argument from user level to the function MakeGZipCodec, we may need to add another property similar to compression_level in parquet writer and pass it down to the compression_internal right? Then user can set the window_bits when creating the parquet writer :)
changed the title [-]Expose the API to fine tune the window_bits parameter of ZLIB compression [/-][+][C++][Parquet] Expose the API to fine tune the window_bits parameter of ZLIB compression [/+]on Apr 23, 2023
I'm OK with make window_bits customizable.
But I don't think that calling MakeGZipCodec() from cpp/parquet/ directly is a good idea.
Currently, we use Codec::Create() instead of Make*Codec() directly in cpp/parquet/.
I don't think that adding a new parameter Codec::Create() such as Codec::Create(Compression::type codec, int compression_level, int window_bits) is a good idea.
If we choose this approach, we may need to add more parameters later.
I like that we introduce a new options class such as Codec::Options but it may be too complex.
I'm OK with make window_bits customizable. But I don't think that calling MakeGZipCodec() from cpp/parquet/ directly is a good idea. Currently, we use Codec::Create() instead of Make*Codec() directly in cpp/parquet/.
I don't think that adding a new parameter Codec::Create() such as Codec::Create(Compression::type codec, int compression_level, int window_bits) is a good idea. If we choose this approach, we may need to add more parameters later. I like that we introduce a new options class such as Codec::Options but it may be too complex.
Thanks for your suggestion @kou! I agree that introducing a new option class is a better design and will make the extension of the parameters much easier. And it's also true that it will be more complex to do such a refactor. Do I need to initialize a discussion on [email protected] cause I have not used that before, thanks!
When building parquet::WriterProperties, there could be 2 design options: one is to pass compression parameters separately (as the current implementation, with more properties to be added) and make CodecOptions internally, for example:
I prefer the latter too.
But I want to use CodecOptions not CodecOption because other existing options class has s.
For example, EqualOptions, ArithmeticOptions and so on.
I seems that we can use std::shared_ptr<CodecOptions> for this. Or we may want to copy CodecOptions instead of sharing it by std::shared_ptr.
Activity
mapleFU commentedon Apr 23, 2023
Maybe you can just the style of
compression_levelto pass the argument in?yyang52 commentedon Apr 23, 2023
Hi, thanks for your quick reply! Do you mean we could add another parquet writer property (maybe can call it
window_bits) just like howcompression_levelpassed in? That's also what we are trying to do now :)mapleFU commentedon Apr 23, 2023
By the way, currently, arrow compression arguments are just level. Maybe we can support argument like rocksdb: https://github.com/facebook/rocksdb/blob/main/include/rocksdb/advanced_options.h#L87
yyang52 commentedon Apr 23, 2023
Yes, it will give much more flexibility! Seems like rocksdb already support window_bits as an option, and many other arguments as well. Maybe I could help to draft a PR to add the window_bits option (or any other if needed) to Arrow as a kickoff?
mapleFU commentedon Apr 23, 2023
Personally I'm +1 for this, but please not break original interface a lot, maybe just change it firstly:
And use
MakeGZipCodecinsrc/arrow/util/compression_internal.hfirstly. Later we can extend it. Do you think this is ok?yyang52 commentedon Apr 23, 2023
Yes we would definitely not break the original interface. Change
MakeGZipCodecis also what I want to do first! The only thing I need to double confirm is that since we want to pass the argument from user level to the functionMakeGZipCodec, we may need to add another property similar tocompression_levelin parquet writer and pass it down to thecompression_internalright? Then user can set thewindow_bitswhen creating the parquet writer :)mapleFU commentedon Apr 23, 2023
I'm ok on this.
@wjones127 @kou What's your opinion for adding a
window_bitshere?[-]Expose the API to fine tune the window_bits parameter of ZLIB compression [/-][+][C++][Parquet] Expose the API to fine tune the window_bits parameter of ZLIB compression [/+]kou commentedon Apr 23, 2023
I'm OK with make
window_bitscustomizable.But I don't think that calling
MakeGZipCodec()fromcpp/parquet/directly is a good idea.Currently, we use
Codec::Create()instead ofMake*Codec()directly incpp/parquet/.I don't think that adding a new parameter
Codec::Create()such asCodec::Create(Compression::type codec, int compression_level, int window_bits)is a good idea.If we choose this approach, we may need to add more parameters later.
I like that we introduce a new options class such as
Codec::Optionsbut it may be too complex.I suggest that we discuss API on
[email protected]too.george-gu-2021 commentedon Apr 23, 2023
Given the variety of usage scenarios, it does be quite helpful to expose the capability and flexibility to applications to decide the codec parameter.
yyang52 commentedon Apr 23, 2023
Thanks for your suggestion @kou! I agree that introducing a new option class is a better design and will make the extension of the parameters much easier. And it's also true that it will be more complex to do such a refactor. Do I need to initialize a discussion on
[email protected]cause I have not used that before, thanks!mapleFU commentedon Apr 23, 2023
Just subscribe [email protected] and send a request here, maybe you can follow others' https://lists.apache.org/[email protected]
5 remaining items
yyang52 commentedon Apr 25, 2023
When building
parquet::WriterProperties, there could be 2 design options: one is to pass compression parameters separately (as the current implementation, with more properties to be added) and make CodecOptions internally, for example:std::shared_ptr<parquet::WriterProperties> props = builder.compression(parquet::Compression::GZIP) ->compression_level(9) ->set_gzip_format(parquet::GZipFormat::DEFLATE) ->gzip_window_bits(12) ->build();Another is to let the user create a CodecOption and pass the option to the builder directly:
Which one do you prefer? Thanks! @kou @wgtmac @mapleFU
mapleFU commentedon Apr 25, 2023
(2) is much better for me.
wgtmac commentedon Apr 25, 2023
I'd vote for (2) and adopt CodecOption proposed by @pitrou in the mailing list.
mapleFU commentedon Apr 25, 2023
@wgtmac If we want it in mailiist, maybe we need a
std::unique_ptr<CodecOption>?wgtmac commentedon Apr 25, 2023
It would be a
std::shared_ptr<CodecOption>or we cannot copyWriterPropertiesany more.kou commentedon Apr 25, 2023
The mailing list discussion: https://lists.apache.org/thread/6gzmfhpfkflfhjmy3ws4y775tfx7g2f8
kou commentedon Apr 25, 2023
I prefer the latter too.
But I want to use
CodecOptionsnotCodecOptionbecause other existing options class hass.For example,
EqualOptions,ArithmeticOptionsand so on.I seems that we can use
std::shared_ptr<CodecOptions>for this. Or we may want to copyCodecOptionsinstead of sharing it bystd::shared_ptr.yyang52 commentedon Apr 26, 2023
Thanks for all your suggestions! So I'd go with the latter one with
std::shared_ptr<CodecOptions>GH-35287: [C++][Parquet] Add CodecOptions to customize the compressio…