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
Add Compression Level Configuration for JSON/CSV Output #18947
When writing ZSTD-compressed JSON (NDJSON) files using DataFrame::write_json(), DataFusion uses the default ZSTD compression level (3). There's no way to configure a higher compression level (e.g., level 9) for better compression ratios.
The underlying async-compression crate supports configurable levels via ZstdEncoder::with_quality(writer, Level::Precise(level)), but DataFusion hardcodes the default:
// In file_compression_type.rsCompressionTypeVariant::ZSTD => Box::new(ZstdEncoder::new(w))
Describe the solution you'd like
Add an optional compression_level field to JsonOptions and CsvOptions:
Bandwidth: Faster transfers for compressed data over networks
Consistency with Parquet: Parquet already supports parquet.compression_level option
ZSTD Level Reference
Level
Compression Ratio
Speed (MB/s)
1
~2.8:1
~500
3
~3.2:1
~350
9
~3.6:1
~90
19
~4.0:1
~10
Additional context
This would align JSON/CSV writers with Parquet, which already supports compression level configuration. The change is backward-compatible since the field is optional and defaults to the current behavior.
Activity
feat: add compression level configuration for JSON/CSV writers
feat: add compression level configuration for JSON/CSV writers
feat: add compression level configuration for JSON/CSV writers
feat: add compression level configuration for JSON/CSV writers (#18954)