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

   ### What changes were proposed in this pull request?
   
   The Python client's `pyspark/sql/connect/client/__init__.py` defined the 
client and its helpers, with an `__all__` of its own, and `core.py` was a shim 
to which the package assigned its classes. pyspark-client 4.3.0 has it the 
other way around. This moves the client into `core.py`:
   
   - `pyspark.sql.connect.client.core` defines everything that PySpark's core 
defines, of PySpark's `__all__` (`SparkConnectClient`, `ChannelBuilder`, 
`DefaultChannelBuilder`, `RpcDeadlines`) and of the drop-in's private helpers. 
The classes are of `pyspark.sql.connect.client.core`, as PySpark's, so the type 
checkers, `help()`, `inspect.getsource` and the pickles of their functions are 
PySpark's: the class of `SparkSession.client` is 
`pyspark.sql.connect.client.core.SparkConnectClient`.
   - The package's `__init__.py` is PySpark's file, as it is (vendored), of no 
`__all__`: `from pyspark.sql.connect.client.core import *` and `getLogLevel`.
   - The Rust binding imports its helpers from `core`. Its 
`ExecutePlanResponses`, `RustConnectStub` and `ResponseStream`, which PySpark 
has not, are of `pyspark._pyspark`, the module that exports them, so that they 
pickle by reference.
   - The code moves as it is: a `git diff -B -M` shows `core.py` as a copy of 
the old `__init__.py`. Three annotations are PySpark's (`session_hooks`, and 
the `handler` of `register_progress_handler` and `remove_progress_handler`).
   
   ### Why are the changes needed?
   
   To close these differences from PySpark (the known-differences review), of 
the layout and names of `pyspark.sql.connect.client` and of the class of 
`SparkSession.client`.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes: the module of the client's classes is 
`pyspark.sql.connect.client.core`, and the package has PySpark's names. What 
remains is documented in `dev/parity/known-differences.md` ("The modules and 
names of `pyspark.sql.connect.client`"): the package has no `artifact` or 
`reattach` modules, which the transport replaces, and has `retries` once it is 
imported, as it imports grpc.
   
   ### How was this patch tested?
   
   - New tests in `python/tests/test_dropin_class_modules_offline.py` and 
`test_type_stubs_offline.py`, which fail without the change. They compare, with 
pyspark-client's:
     - the names of the package and of core, in a fresh process, with and 
without the optional dependencies;
     - the modules, qualified names and sources of the classes;
     - the pickles of the results, byte for byte;
     - mypy's view of `SparkSession.client`.
   - Probes of both clients, of a live session too: all 33 pickles and every 
field identical.
   - The core tests (release and debug), wasm, clippy, rustdoc, the stubs, the 
licenses, the native server's crates, the offline suite in sorted order and 
under coverage, and the live e2e with and without protobuf.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code
   
   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