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
Parquet: accept zstd compression level 0 and negative levels in ZstdLevel #11545
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
parquet::basic::ZstdLevel::try_new accepts only levels 1 to 22 (MINIMUM_LEVEL = 1, MAXIMUM_LEVEL = 22 in parquet/src/compression.rs). zstd itself also accepts:
level 0, which means its default level (ZSTD_CLEVEL_DEFAULT, 3)
negative "fast" levels, down to ZSTD_minCLevel(), which trade compression ratio for speed
parquet-java (through zstd-jni) accepts both, so a writer that wants to honor a table's configured zstd level cannot do so with parquet-rs. Apache Iceberg tables, for example, can set write.parquet.compression-level to 0 or a negative value, and iceberg-java writes them; DataFusion Comet's native Iceberg writer has to fall back to the JVM writer for those tables.
Describe the solution you'd like
Let ZstdLevel accept the full range the linked zstd library supports (zstd::compression_level_range()), including 0 and negative levels, and pass them through to the encoder unchanged.
Describe alternatives you've considered
Callers can map 0 to 3 themselves, but there is no equivalent for the negative levels.
Additional context
compression_level_range() is not const, which is presumably why the bounds are hard-coded today.
I think this already landed in #10601, which shipped in 60.0.0. ZstdLevel::MINIMUM_LEVEL is now -131072, so try_new accepts 0 and the negative levels, and ZSTDCodec::new passes the level straight to zstd::bulk::Compressor. The 1 to 22 bounds in the description match 59.x, so Comet may only need the 60 upgrade.
Activity
bharadwaj-pendyala commentedon Oct 23, 2026
I think this already landed in #10601, which shipped in 60.0.0.
ZstdLevel::MINIMUM_LEVELis now -131072, sotry_newaccepts 0 and the negative levels, andZSTDCodec::newpasses the level straight tozstd::bulk::Compressor. The 1 to 22 bounds in the description match 59.x, so Comet may only need the 60 upgrade.