HyukjinKwon opened a new pull request, #359: URL: https://github.com/apache/spark-connect-rust/pull/359
### What changes were proposed in this pull request? [SPARK-61170](https://issues.apache.org/jira/browse/SPARK-61170): PySpark's Column, also of Spark Connect, has the operators of the names of Python 2, and `__getnewargs__`. The client's Column now has the same four methods, as PySpark's: - `__div__` and `__rdiv__` divide as `__truediv__` and `__rtruediv__`, of the origins of their own names. pandas-on-Spark calls `__div__`: its `rfloordiv` does `F.lit(np.inf).__div__(right)`. - `__nonzero__` raises `CANNOT_CONVERT_COLUMN_INTO_BOOL`, as `__bool__`. - `__getnewargs__` gives the expression of the column (`_expr`). ### Why are the changes needed? The client's Column had none of them. Its `__getattr__` refuses a name that starts with `__`, as PySpark's, so `F.lit(1).__div__(x)` raised: ``` PySparkAttributeError: [ATTRIBUTE_NOT_SUPPORTED] Attribute `__div__` is not supported. ``` Apache Spark's `test_rfloordiv` of pandas-on-Spark's `computation/test_parity_binary_ops.py` failed on this client. ### Does this PR introduce _any_ user-facing change? Yes. Columns have the methods of PySpark 4.3.0's above. ### How was this patch tested? - A new offline test checks: - the reprs and the plan of `__div__` and `__rdiv__`, which are those of `/` - the error of `__nonzero__` - the expression of `__getnewargs__` It passes with official PySpark 4.3.0, and fails without this change. - The reprs and the rows of `__div__` and `__rdiv__` against a local server are those of official PySpark 4.3.0. - The dunder methods of `Column` are those of official PySpark 4.3.0, but for `__dict__` and `__weakref__` (SPARK-61171) and `__getattr__`, which PyO3 implements as a slot. - The lib tests of both crates (597 passed), the build of all tests, also with `wasm-udf`, the offline Python suites (2223 passed, 8 skipped), and the live drop-in and Arrow suites (206 passed) and live cases (10 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]
