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

   ### What changes were proposed in this pull request?
   
   [SPARK-61161](https://issues.apache.org/jira/browse/SPARK-61161): Export the 
deprecated functions of `pyspark.sql.connect.functions`, such as 
`countDistinct` and `bitwiseNOT`, as PySpark does.
   
   - `pyspark/sql/connect/functions/__init__.py` star-imports 
`pyspark.sql.connect.functions.builtin` instead of `pyspark.sql.functions`, as 
PySpark's package does. The builtin module has no `__all__`, so its public 
names are exported.
   - `pyspark/sql/connect/functions/builtin.py` exposes `py_random`, the 
`random` module imported as in PySpark's builtin module.
   - `pyspark.sql.functions` itself is unchanged.
   
   The public functions of PySpark's `pyspark.sql.connect.functions` that were 
missing are `countDistinct`, `sumDistinct`, `approxCountDistinct`, `chr`, 
`toDegrees`, `toRadians`, `shiftLeft`, `shiftRight`, `shiftRightUnsigned`, 
`bitwiseNOT`, `random`, `uuid` and `py_random`. The Connect tests use them 
through the `CF` alias. After the change, the public names of the package match 
PySpark 4.3.0's, apart from the expression classes and modules that PySpark's 
builtin module imports, which are internal.
   
   ### Why are the changes needed?
   
   ```python
   from pyspark.sql.connect.functions import countDistinct
   # ImportError: cannot import name 'countDistinct' from 
'pyspark.sql.connect.functions'
   ```
   
   PySpark 4.3.0 imports these names from the same package.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. `pyspark.sql.connect.functions` exposes the 13 functions above (and 
`py_random`), as PySpark does.
   
   ### How was this patch tested?
   
   - Offline 
`test_connect_functions_package_exports_the_deprecated_functions_as_pyspark`: 
each of the 12 functions of the package is the one of the builtin module, 
`py_random` is the `random` module, and `bitwiseNOT` builds a column. The same 
results with official PySpark 4.3.0.
   - The lib tests of both crates (590 passed), the build of all tests, also 
with `wasm-udf`, and the offline Python suites (2202 passed, 8 skipped), and 
the live tests of functions and columns (45 passed) against a local Spark 4.3.0 
server; rustfmt passes.
   
   ### 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