JustinBinber opened a new issue, #1839:
URL: https://github.com/apache/datafusion-python/issues/1839
## Problem
Setting only the supported `compression_level` option makes Parquet writing
fail with the default codec:
```python
from tempfile import TemporaryDirectory
from datafusion import SessionContext
from datafusion.dataframe import ParquetWriterOptions
df = SessionContext().from_pydict({"value": [1, 2, 3]})
options = ParquetWriterOptions(compression_level=6)
print(options.compression) # zstd(3)(6)
with TemporaryDirectory() as path:
df.write_parquet_with_options(path, options)
```
Actual error:
```text
DataFusion error: Invalid or Unsupported Configuration: Could not parse
compression string. Got codec: zstd and unknown level from zstd(3)(6)
```
`df.write_parquet(path, options)` fails in the same way. Explicit codec
strings containing a level also fail, for example
`ParquetWriterOptions(compression="brotli(7)", compression_level=4)` produces
`brotli(7)(4)`. A bare codec such as `compression="gzip"` works with a separate
level.
Reproduced against current main `878e5d3b8d373bca19671af43e49dfb1890f8da2`
Python sources on Windows/Python 3.11.7 with the released 55.0.0 native wheel
(engine 55.2.0).
## Expected behavior
An explicit `compression_level` should replace an embedded level, including
the default `zstd(3)`, rather than append a second parenthesized level. Without
an explicit override, the original compression string should be preserved.
I am preparing a focused fix with actual Parquet writes through both public
entry points, codec metadata/readback assertions, and rejection tests for
out-of-range levels.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]