HyukjinKwon opened a new pull request, #405:
URL: https://github.com/apache/spark-connect-rust/pull/405

   ### What changes were proposed in this pull request?
   
   [SPARK-61223](https://issues.apache.org/jira/browse/SPARK-61223): Make 
`DataFrameReader.parquet(*paths, **options)` apply only the seven options that 
PySpark applies.
   
   `DataFrameReader.parquet` set every keyword option on the reader. PySpark's 
`parquet` sets `mergeSchema`, `pathGlobFilter`, `recursiveFileLookup`, 
`modifiedBefore`, `modifiedAfter`, `datetimeRebaseMode` and `int96RebaseMode` 
(in that order) and ignores the others, so the other keys are not in the 
reader's `_options` afterwards either. The method now sets only these seven, as 
`orc` already follows its PySpark counterpart.
   
   The parameters (names, kinds, defaults) of the other reader and writer 
methods, and of the streaming reader and writer, were compared with official 
PySpark 4.3.0: no other format method takes a `**options` catch-all where 
PySpark takes named options only.
   
   ### Why are the changes needed?
   
   A keyword that PySpark ignores changed the result of a read here. With 
`ignoreCorruptFiles=True`, PySpark still fails on a corrupt Parquet footer 
(`FAILED_READ_FILE.CANNOT_READ_FILE_FOOTER`), but this client skipped the file 
and then failed with `UNABLE_TO_INFER_SCHEMA`. After `spark.read.parquet(path, 
ignoreCorruptFiles=True)`, the reader's `_options` is `{}` in PySpark and was 
`{'ignoreCorruptFiles': 'true'}` here.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. `parquet()` ignores the keyword options that PySpark ignores, and its 
reader keeps only the seven named options.
   
   ### How was this patch tested?
   
   - Added `test_parquet_sets_only_its_options_as_pyspark` to 
`test_dropin_offline.py`. It checks the reader's `_options` and `_format` after 
`parquet()` with named, unknown and None keywords, on a reader with a prior 
option. It fails without this change (the `_options` keep `header` and 
`ignoreCorruptFiles`) and passes with it. The same `_options` were checked 
against official PySpark 4.3.0 on a live Connect server.
   - Against official PySpark 4.3.0 on a live server, `ignoreCorruptFiles=True` 
on a corrupt Parquet file gives `FAILED_READ_FILE.CANNOT_READ_FILE_FOOTER` in 
both clients.
   - The lib tests of both crates (658 passed), the build of all tests, also 
with `wasm-udf`, the offline Python suites (2704 passed, 8 skipped), and the 
live drop-in and Arrow suites (224 passed) and live cases (12 passed) against a 
local Spark 4.3.0 server. Clippy reports no diagnostics in the changed lines.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Opus 5.5
   
   This pull request and its description were written by Isaac.
   


-- 
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]

Reply via email to