L. C. Hsieh created SPARK-61429:
-----------------------------------
Summary: Share the argument-error and option helpers of the PyO3
wrappers of Spark Connect Rust
Key: SPARK-61429
URL: https://issues.apache.org/jira/browse/SPARK-61429
Project: Spark
Issue Type: Improvement
Components: Connect
Affects Versions: connect-rust-4.3.0
Reporter: L. C. Hsieh
The PyO3 wrapper crate (crates/pyspark-rs) carries several copy-pasted helpers:
* The NOT_EXPECTED_TYPE helper exists as separate copies in column.rs,
dataframe.rs, readwriter.rs and stat_arguments.rs, plus inline copies in
dataframe.rs and catalog.rs, and raise_pyspark, which some sixteen modules use,
is defined in column.rs.
* The option plumbing of the readers and writers has near-identical helpers
over three builder types (set_opt, set_ropt, wset_opt), the loop that turns
**options into a map of strings is written out seven times, and
coerce_option_value lives in lib.rs. The two treatments PySpark has of an
option of None (skip it, as OptionUtils._set_opts does, or unset the key, as
DataFrameReader.option does) are not named anywhere.
This is a refactoring with no intended change to the Python API: move
raise_pyspark and one not_expected_type to errors.rs, and give the option
helpers one module, options.rs, with names that say which treatment of None
each implements.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]