HyukjinKwon opened a new pull request, #655:
URL: https://github.com/apache/spark-connect-rust/pull/655
### What changes were proposed in this pull request?
A follow-up of #646 (SPARK-61638). #646 stored a UDTF's name as `_name`, as
PySpark Connect's `UserDefinedTableFunction` does, and kept `name` readable as
a read-only property, so `udtf.name = "x"` raised `AttributeError`. This PR
makes `name` a descriptor without a setter. It reads `_name` until the object
has a `name` of its own, which an assignment gives it, as on PySpark's object,
and `_name` stays as it was.
### Why are the changes needed?
A post-merge review of #646 found the regression. PySpark 4.3.0's UDTF has
no `name` attribute: `t.name = "renamed"` adds one to the object, `t._name`
stays `"T"`, and `spark.udtf.register("reg_t", t)` registers the handler as
before. In the drop-in before #646, the assignment worked too.
- Before (after #646): `t.name = "renamed"` raised `AttributeError: property
'name' of 'UserDefinedTableFunction' object has no setter`.
- After: it sets the attribute and leaves `_name`, as in PySpark.
### Does this PR introduce _any_ user-facing change?
Yes. `name` can be set on a UDTF again. As in PySpark, setting it does not
change the name that the plan sends.
### How was this patch tested?
`test_udf_and_udtf_pickle_as_pyspark_connect_classes` sets the name and
checks `name`, `_name` and the object's attributes. It fails without the fix
with the `AttributeError` above. CI's offline Python set passes with `TZ=UTC`:
3730 passed. The ruff gates pass.
### 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]