apache / apache/datafusion

Expose set_data_page_v2_compression_ratio_threshold for Parquet

Open
#23,949 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
9.3k
Forks
2.4k
Avg merge
3d 7h
Merged PRs (30d)
344

Description

### Is your feature request related to a problem or challenge?

Writing Parquet V2 can benefit from [set_data_page_v2_compression_ratio_threshold](https://docs.rs/parquet/58.3.0/parquet/file/properties/struct.WriterPropertiesBuilder.html#method.set_data_page_v2_compression_ratio_threshold), which is not exposed in Datafusion.

### Describe the solution you'd like

Expose `data_page_compression_ratio_threshold` on `datafusion_common::config::ParquetOptions` and `ParquetColumnOptions` so it can be passed along to `WriterPropertiesBuilder`.

This primarily enables `datafusion_datasource_parquet::file_format::ParquetFormat` to use this setting.

### Describe alternatives you've considered

We are evaluating if we should always disable compression for sorted delta-encoded columns. This can easily be done with `ParquetColumnOptions.compression` today.

We can also create a wrapper `ParquetSink` to set more options on the `WriterPropertiesBuilder` but that's quite a painful workaround for little gain.

### Additional context

We experience poor compression ratios (<5%) with Zstd for delta-encoded columns of timestamps and other types. Disabling compression with a threshold would be ideal to avoid the decompression overhead at query time.

Contributor guide

Open the contributing guide

Research direction

Start with datafusion_common::config::ParquetOptions and ParquetColumnOptions, then trace how datafusion_datasource_parquet::file_format::ParquetFormat builds WriterPropertiesBuilder. Check the linked parquet API for set_data_page_v2_compression_ratio_threshold; done means the option is exposed and passed through so Parquet V2 writing can apply the configured threshold.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
data-engineering
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.