HyukjinKwon opened a new pull request, #911:
URL: https://github.com/apache/spark-connect-rust/pull/911
### What changes were proposed in this pull request?
A sweep compared the docstrings of pyspark-client 4.3.0 and of the drop-in
by their exact text, on master dd4d192a, of SPARK-62134 (#910), which moved the
client into `pyspark.sql.connect.client.core`, PySpark's layout. It covered the
modules of `pyspark.sql` and `pyspark.errors` that both import, 124 of them:
each module, each public class and function that it defines, and each public
member of such a class, as Python finds it on the class. As the golden compares
them, an object counts as the same if its `__doc__` is the same. Where
PySpark's object has no docstring of its own and inherits one, it counts as the
same if its `inspect.getdoc` is the same. Of 5548 objects of PySpark:
| | Same | Differ | Missing in the drop-in |
|---|---|---|---|
| Before, master dd4d192a | 4479 | 83 | 986 |
| After, this PR | 4558 | 4 | 986 |
All 79 that this PR makes PySpark's are of
`pyspark.sql.connect.client.core`, which went from 61 / 79 / 6 to 140 / 0 / 6
(same / differ / missing):
- the module docstring;
- the `RpcDeadlines`;
- the `ChannelBuilder` and 10 members;
- the `DefaultChannelBuilder` and 13 members, 9 of which it inherits from
the `ChannelBuilder`;
- the `PlanObservedMetrics` and `to_dict`;
- the `AnalyzeResult` and the `ConfigResult`;
- the `SparkConnectClient` and 47 members.
Its classes are of Python, and their docstrings were the drop-in's own,
where PySpark's have others or none. The package `pyspark.sql.connect.client`
is PySpark's file since #910.
**The changes:**
- **The classes of `core.py` have PySpark's docstrings, as PySpark's source
writes them.** That is 70 definitions, since 9 of the 79 objects are inherited.
PySpark's literal docstring replaces the drop-in's in each class or function,
and where PySpark's is None there is none:
- the module;
- the `AnalyzeResult` and the `ConfigResult`;
- the `PlanObservedMetrics`, which then shows that of `ObservedMetrics`
with `help()`, as with pyspark-client;
- members such as `ChannelBuilder.set`, `getDefault` and `token`,
`DefaultChannelBuilder.endpoint` and `secure`, and
`SparkConnectClient.add_tag`, `interrupt_all` and `release_session`.
The drop-in's text of each stays as a comment where it says more than
PySpark's, of the Rust transport that the client runs over. No code changes.
- **The golden covers every module of `pyspark.sql` and `pyspark.errors`.**
- `python/tests/_runtime_docstrings.py` has no `EXCLUDED` anymore.
- `tests/golden/runtime_docstrings.json` now holds 5689 docstrings of 131
modules, up from 5477 of 126.
- The modules of PySpark that the drop-in does not have, which the test
lets not import, now include `pyspark.sql.connect.client.artifact` and
`reattach`. The Rust transport replaces them
(`dev/parity/known-differences.md`).
- `test_the_docstrings_of_the_modules_are_pysparks` now compares 4491
docstrings, and asserts at least 4450, up from 4300.
- **Docs:** the docstring paragraphs of `dev/parity/known-differences.md`
and `docs/compatibility.md` say that the golden guards the docstrings of every
module, and that the classes of the client have PySpark's docstrings.
**What remains** of the 4 that differ is inherent: the `__init__` of the
`SparkSession`, the `DataFrame`, the `RuntimeConf` and the `Observation` of
Spark Connect. PySpark Connect gives each a docstring (their own, or copies),
and a native class's `__init__` is CPython's slot, which keeps CPython's
docstring. The 986 missing names are as before. Of them, 6 are of
`client.core`: the `add_interceptor`, `setChannelOption` and `toChannel` of the
channel builders, of a gRPC channel that the Rust transport does not have.
### Why are the changes needed?
So that `help()` and the other tools that read docstrings show PySpark's
documentation for the client of Spark Connect, as with pyspark-client, and so
that the golden guards the docstrings of every module of `pyspark.sql` and
`pyspark.errors`.
### Does this PR introduce _any_ user-facing change?
Yes. The `__doc__` of the module `pyspark.sql.connect.client.core`, of its
classes and of their members is PySpark's, as with pyspark-client: PySpark's
text, or none.
### How was this patch tested?
- **The golden test**, `test_the_docstrings_of_the_modules_are_pysparks` of
`test_dropin_class_modules_offline.py`, with the new golden:
- on master dd4d192a, 79 of 4491 differ, the 79 above;
- on this branch, none.
The golden reproduces when captured again with pyspark-client.
`test_dropin_class_modules_offline.py` gives 279 passed; on master dd4d192a, 1
failed (this test) and 278 passed.
- **The sweep of both clients**, before and after, in the table above.
- **The gates:**
- `cargo fmt --all --check`;
- `cargo +1.100.0 clippy -p apache-spark-connect-core -p
apache-spark-connect -p pyspark-rs --all-targets -- -D warnings`;
- `RUSTDOCFLAGS="-D warnings" cargo doc --no-deps -p apache-spark-connect
-p apache-spark-connect-core`;
- `cargo test -p pyspark-rs --lib`: 18 passed;
- `gen_connect_docstrings.py --check`, `gen_type_stubs.py --check`,
`gen_fn_dispatch.py --check`, `check_classic_bindings.py`,
`check_vendored_upstream.sh` (184 paths, none drifted);
- ruff 0.14.0, the license checks, the no-stub audit, the guards and
`test_type_stubs_offline.py` with pyright 1.1.414 (19 passed);
- the offline suite of `coverage.yml`: 6976 passed, 77 skipped;
- `test_dropin_e2e.py`, the tests of the client, its channel builder,
retries, interrupts, artifacts, configuration and session (`-k "client or
channel or builder or retries or retry or interrupt or artifact or config or
conf or session"`), against a Spark 4.3.0 server: 38 passed.
### 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]