HyukjinKwon opened a new pull request, #426: URL: https://github.com/apache/spark-connect-rust/pull/426
### What changes were proposed in this pull request? [SPARK-61246](https://issues.apache.org/jira/browse/SPARK-61246): Add the Connect session and client members of PySpark 4.3.0 that the drop-in lacks, found by an item-by-item comparison of the `pyspark-client` API and by running the official test files against the drop-in itself. - `pyspark.sql.connect.client` exports `ChannelBuilder` and `DefaultChannelBuilder`. They parse an `sc://` connection string as PySpark's do (`host`, `port`, `endpoint`, `get`/`set`, `userId`, `token`, `session_id`, `use_ssl`, `secure`, `metadata()`), and `SparkSession.builder.channelBuilder(DefaultChannelBuilder(url))` honors them. The gRPC channel members (`toChannel`, interceptors, channel options) are not provided: the transport is native (`dev/parity/known-differences.md`). - The Connect `SparkSession` gets PySpark's class-level registry that its tests use (`_default_session`, `_active_session`, `_get_default_session()`, `_lock`), `release_session_on_close` (honored by `stop()`), and direct construction `SparkSession(connection=..., userId=..., hook_factories=...)`, which makes a session that is neither the default nor the active one, as PySpark's constructor does. - `SparkConnectClient` gets `host`, `_closed`, `_proto_to_string`, and `_server_session_id`: the server-side session ID that the client observed (None before the first response), settable as PySpark's tests do to simulate a server restart. ### Why are the changes needed? Code written for PySpark Connect could not use them: `from pyspark.sql.connect.client import DefaultChannelBuilder` failed, and the official `pyspark/sql/tests/connect/test_connect_session.py` failed at import against the drop-in. ### Does this PR introduce _any_ user-facing change? Yes, the members above, as PySpark has them. ### How was this patch tested? - The official test files, run against the drop-in itself (not through the transport plugin), as official PySpark 4.3.0 on the same server: - `test_connect_session.py`: import error -> 10 passed, 17 skipped (official: 10 passed, 17 skipped) - `test_connect_context.py`: 9 passed, 1 failed -> 10 passed (official: 10 passed) - `test_connect_error.py`: 11 passed, 2 failed -> 12 passed, 1 failed (official: 13 passed). The remaining `test_recursion_handling_for_plan_logging` needs the Python plan of a deep DataFrame, which the Rust core builds instead (recorded in `known-differences.md`). - New offline tests in `test_dropin_offline.py` and live tests in `test_dropin_e2e.py`, and a Rust unit test of the session's accessors. - The lib tests of both crates (666 passed), the build of all tests, also with `wasm-udf`, the offline Python suites (2825 passed, 8 skipped), and the live drop-in and Arrow suites (234 passed) and live cases (13 passed) against a local Spark 4.3.0 server. rustfmt passes. Clippy's only diagnostic on a changed line is `result_large_err` of the execute-plan hook closure, which this moves unchanged from the builder into a helper (master has the same diagnostic there). The official `streaming/test_parity_listener.py` (9), `test_parity_catalog.py` (27) and `test_parity_readwriter.py` (22) still pass against the drop-in. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Opus 5.5 and Claude Haiku 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]
