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

   ### What changes were proposed in this pull request?
   
   A round-2 review compared the requests of the core with PySpark 4.3.0's, 
through recording proxies. It found these gaps, in the Rust API and, where 
noted, in the drop-in:
   
   | | PySpark 4.3.0 (now here too) | before |
   |---|---|---|
   | `spark_connect::col("*")`, `col("t.*")`, and every `&str`/`String` column 
name, of `select`, `group_by`, `order_by`, `struct`/`array` and the window 
builders (Rust API) | `col("*")` is an `UnresolvedStar` 
(connect/functions/builtin.py:250-258), so `select(["*"])` works | an 
`unresolved_attribute`, which the server fails with `UNRESOLVED_COLUMN` of `*` |
   | the scalar catalog operations, such as `currentDatabase`, `tableExists`, 
`cacheTable` and `dropTempView` (both) | run as a DataFrame (catalog.py:47-50), 
of a plan id and the thread's tags | a relation of `common:{}`, and no tags |
   | the removal of a dropped checkpoint's cached relation (both) | one 
execution, not reattachable, of the chunking option only (plan.py:759-790) | 
reattachable, and a ReleaseExecute after it |
   | `create_dataframe_from_columns` of no rows (Rust API) | the schema alone, 
as PySpark's empty data (connect/session.py:525-528) | a Config request and 
Arrow data |
   | `mode("errorifexists")` (both) | `[UNSUPPORTED_OPERATION] errorifexists is 
not supported.` at the save, before any request (connect/plan.py:2183-2197) | 
wrote the data with `SAVE_MODE_ERROR_IF_EXISTS` |
   
   **How.**
   - **Stars.** `column::col`, and so `From<&str>` and `From<String>`, makes 
`*` and `prefix.*` a star, as `functions::col` did, which now delegates to it. 
`DataFrame::col` stays PySpark's `df[name]`, which handles `"*"` only.
   - **The catalog.** `execute_catalog` runs the operation as the DataFrame of 
its `LogicalPlan::Catalog` and collects it, as PySpark's `_execute_and_fetch` 
runs `DataFrame(plan)._to_table()`.
   - **The checkpoint.** The new doc-hidden 
`SparkConnectClient::spawn_unary_execute_plan` sends the removal as PySpark's 
`__del__` does:
     - with no hooks and no ReleaseExecute;
     - retried under the client's policy, with failures only logged;
     - with the dropping thread's tags and extensions.
   
     It does not wait for the server, where PySpark's `__del__` does. A 
blocking drop would hold the GIL, and could wait behind another thread's stream 
on the shared HTTP/2 connection. `dev/parity/known-differences.md` records this.
   - **`SaveMode::from_str`** no longer takes `errorifexists`. This changes the 
Rust API; its doc says so.
   - **The goldens.** The two golden tests that hid the first case now require 
a case for each of their goldens, as #788 (SPARK-61876) made 
`functions_golden.rs` do:
     - `golden_test.rs` compared 23 of the 28 goldens of `exprs.jsonl`. It now 
builds `upper`, `concat`, `coalesce`, `sum_agg` and `count_star`, the last as 
`count(col("*"))`.
     - `plans_golden.rs` built `select_star` by hand. It now builds it through 
`select(["*"])`.
   
   `docs/architecture.md` and `dev/parity/known-differences.md` are updated.
   
   ### Why are the changes needed?
   
   So that the Rust API's `select(["*"])` and the like work, and the requests 
of these operations are PySpark's.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, as above. In the Rust API, `col("*")` and `"t.*"` are stars, and 
`SaveMode` no longer parses `errorifexists`. In the drop-in, 
`mode("errorifexists")` raises PySpark's error at the save.
   
   ### How was this patch tested?
   
   - **New tests.** Each fails on master and passes here.
     - `catalog_golden.rs` records whole requests, and checks that every 
relation has a plan id and every request the thread's tags. On master, 34 
relations had no plan id.
     - The new `tests/checkpoint_release.rs`, an offline loopback service, 
checks the removal's request.
     - `create_dataframe_settings.rs` covers columns of no rows.
     - A unit test in `column.rs`, and a live test in `e2e_columns.rs` of 
`select`, `count`, `struct`, `to_json` of a struct and `t.*`, of the official 
client's values.
     - `golden_test.rs` and `plans_golden.rs` fail with the old `col`.
     - `readwriter_golden.rs`, and the drop-in's 
`test_reader_and_writer_check_their_arguments_as_pyspark`, cover 
`errorifexists`.
   - **The reviewer's probes** give identical requests on both clients. That 
covers the 16 scalar catalog operations, the checkpoint cases and the save 
modes.
   - **Rust.**
     - `cargo test -p apache-spark-connect -p apache-spark-connect-core 
--release` (1626 passed after the rebase on master);
     - `cargo test -p apache-spark-connect --release --features wasm-udf`;
     - live `e2e_coverage`, `e2e_dataframe`, `e2e_new_methods`, 
`e2e_session_catalog`, `e2e_columns` and `e2e_functions`.
   - **Python.** The offline suite of `coverage.yml` on pandas 2 and 3, and the 
live drop-in tests of the catalog, checkpoints and createDataFrame.
   - **Lint.** `cargo fmt --all --check`, `cargo +1.100.0 clippy -D warnings`, 
ruff 0.14.0, `audit_no_stubs.sh` and `scripts/tests`.
   
   ### 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