HyukjinKwon opened a new pull request, #390: URL: https://github.com/apache/spark-connect-rust/pull/390
### What changes were proposed in this pull request? [SPARK-61204](https://issues.apache.org/jira/browse/SPARK-61204): Give None for the className of a builtin function without a class in `Catalog.listFunctions` and `getFunction`, as PySpark does. - The server sends a null `className` for the builtins `!=`, `<>`, `case` and `||`. The catalog parser read every string column with `row_str`, which turns a null into `""`. The `className` column is now read with `row_opt_str`, so it is `None` when the server sends null, and the Python `Function.className` is `None` for those four builtins. - The Rust `spark_connect::catalog::Function::class_name` field changes from `String` to `Option<String>`. This is the only public type change. - Official PySpark 4.3.0 reads the same columns with `as_py()`, which is `None` for a null, and gives `None` for these four builtins. The other nullable columns (`locationUri`, `tableType`, `dataType`, the partition names) are never null in the server's catalog results, so they keep `row_str`. A probe of `listCatalogs`, `listDatabases`, `getDatabase`, `listTables`, `getTable`, `listColumns`, `listFunctions` and `getFunction` gives the same fields and the same `None`s with the drop-in and with official PySpark 4.3.0. ### Why are the changes needed? `spark.catalog.listFunctions()` returned `className == ""` for `!=`, `<>`, `case` and `||`, where PySpark returns `None`. Code that filters on `f.className is None`, or compares the value with PySpark's, gets different results. ### Does this PR introduce _any_ user-facing change? Yes. `Function.className` is `None` (not `""`) for the builtins that have no class. The Rust `Function::class_name` is an `Option<String>`. ### How was this patch tested? - An offline test `test_catalog_function_class_name_is_none_without_a_class_as_pyspark` (the mock server answers `listFunctions` with a `!=` row whose className is null, and an `abs` row). It fails without this change (`''` for `!=`) and passes with it. Official PySpark 4.3.0 gives `None` for the same rows. - A live test with the same name, which checks `className is None` for `!=` and `||`, and that `getFunction("abs")` gives the same className as `listFunctions`. Official PySpark 4.3.0 gives the same results on a Spark 4.3.0 server. - Against a local Spark 4.3.0 server, the live `test_dropin_e2e.py -k "catalog or function or table"` tests (33 passed). - The lib tests of both crates (618 passed), the build of all tests, also with `wasm-udf`, and the offline Python suites (2457 passed, 8 skipped); rustfmt passes, and clippy reports no diagnostics in the changed lines. CI runs the e2e and live suites. ### 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]
