HyukjinKwon opened a new pull request, #636:
URL: https://github.com/apache/spark-connect-rust/pull/636
### What changes were proposed in this pull request?
A survey looked for one class of mistake: a parity reference to the wrong
code, such as a deprecated API, classic instead of Connect code, full pyspark
instead of pyspark-client, or another version. The native ML is excluded, since
it is being moved off the deprecated `pyspark.ml.connect` separately. This PR
fixes what the survey found:
- `DataFrame::register_temp_table` in the Rust client calls
`create_or_replace_temp_view`. It called `create_temp_view`, which fails for an
existing name, while PySpark 4.3.0's `registerTempTable` is
`createOrReplaceTempView` with a FutureWarning. The drop-in's Python binding
was already right.
- The classic `pyspark.sql.SQLContext` and `HiveContext` shims behave as
pyspark-client 4.3.0's: they give PySpark's deprecation warnings, then raise
`PySparkAttributeError` with `JVM_ATTRIBUTE_NOT_SUPPORTED` for `_jsc` on a
session. Before, they raised `NOT_IMPLEMENTED` with an invented message.
- Three comments in `functions.py` that cited PySpark 4.2.0 now cite 4.3.0.
The `_FN_COL_ARGS` table already matched 4.3.0, all 170 entries.
- `test_functions_bucket` asserts the deprecation warning of `F.bucket`.
### Why are the changes needed?
For parity with PySpark 4.3.0:
- After `df.createOrReplaceTempView("v")`, `other.register_temp_table("v")`
failed with `TEMP_TABLE_OR_VIEW_ALREADY_EXISTS`. Now it replaces the view, as
PySpark's `registerTempTable` does.
- `SQLContext(spark)` raised `NOT_IMPLEMENTED`. pyspark-client 4.3.0 raises
`JVM_ATTRIBUTE_NOT_SUPPORTED` (`attr_name=_jsc`). The class, condition,
parameters and message now match the reference for `SQLContext(spark)`,
`HiveContext(spark, spark)` and `SQLContext(None)`.
The survey checked these as matching the reference already:
- about 30 deprecated APIs, with their warnings, categories, texts and
timing;
- every remote-only branch: `sparkContext`, `_jsc`, `_jvm`, the DataFrame
JVM attributes, and `hasattr` of `SparkContext`, `RDD` and `SQLContext`;
- the error timing of about 20 eager or lazy cases;
- the version claims in the docs.
### Does this PR introduce _any_ user-facing change?
Yes. In the Rust API, `register_temp_table` replaces an existing temporary
view instead of failing. In the Python client, `SQLContext(session)` and
`HiveContext(session)` raise PySpark's error and give its deprecation warnings.
### How was this patch tested?
- New tests, each checked to fail without the fix:
- Rust e2e: `register_temp_table_replaces_existing_view`;
- offline: `test_classic_sql_context_on_session_raises_jvm_attribute`.
- The `SQLContext(None)` test now expects the reference's error, and
`test_functions_bucket` asserts the warning.
- Also passing, with `TZ=UTC`:
- the Rust lib tests and the `--no-run` builds;
- `e2e_new_methods` and `e2e_coverage` against Spark 4.3.0;
- CI's offline Python set: 3532 passed;
- `cargo fmt`, the stub audit and ruff.
### 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]