HyukjinKwon opened a new pull request, #295: URL: https://github.com/apache/spark-connect-rust/pull/295
### What changes were proposed in this pull request? [SPARK-61091](https://issues.apache.org/jira/browse/SPARK-61091): the methods of `spark.catalog` now return the NamedTuples of `pyspark.sql.catalog`, and `registerFunction` registers functions, as PySpark does. As PySpark's: - the methods of the catalog return the NamedTuples of `pyspark.sql.catalog`: `CatalogMetadata`, `Database`, `Table` (with its `database` property), `Column`, `Function` and `TablePartition`. They are tuples, so `_fields`, `_asdict`, indexing, unpacking and tuple equality work: ```python >>> spark.catalog.getTable("default.t") Table(name='t', catalog='spark_catalog', namespace=['default'], description=None, tableType='MANAGED', isTemporary=False) ``` - `Catalog.registerFunction(name, f, returnType)` issues its `FutureWarning` ("Deprecated in 2.3.0. Use spark.udf.register instead.") and registers the function with `spark.udf.register`. The NamedTuples are PySpark's definitions, in the shim `pyspark.sql.catalog`, and the Rust methods build them. The Rust classes of the results are removed. The core `Catalog` gains `spark_session()`. ### Why are the changes needed? - The client returned classes of its own, which were not tuples: they had no `_fields`, and their repr differed. - The class of a column was named `CatalogColumn`. - `registerFunction` raised `NOT_EXPECTED_TYPE` for `evalType`, because it passed its arguments to `UserDefinedFunction` out of order. ### Does this PR introduce _any_ user-facing change? Yes. The catalog returns the results of PySpark 4.3.0, and `registerFunction` works. ### How was this patch tested? - A new live test checks the `Table`, the `Column`s, the `Database` and the `Function` of a table and a function, as tuples, and registers a function with `registerFunction`, including its warning. It passes with official PySpark 4.3.0 and fails without this change. - The offline test of the result classes now checks that they are the NamedTuples of PySpark, with their fields and the `database` of a `Table`. - On a local server, 45 cases of the catalog give the same results as official PySpark 4.3.0. The exceptions are the messages of the `TypeError`s for non-str names, which are protobuf's in PySpark. The reprs of the results, and the warning of `registerFunction`, are the same too. - The lib tests of both crates (592 passed), the build of all tests, also with `wasm-udf`, the offline Python suites (2041 passed, 12 skipped), and the live drop-in and Arrow suites (145 passed) and live cases (10 passed) against a local Spark 4.3.0 server. Clippy reports no diagnostics in the changed lines. ### 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]
