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

   ### What changes were proposed in this pull request?
   
   [SPARK-61171](https://issues.apache.org/jira/browse/SPARK-61171): PySpark's 
classes of Spark Connect are Python classes. Their objects can be referred to 
weakly (`weakref.ref`, `WeakKeyDictionary`, `WeakValueDictionary`) and take 
attributes of their own, as libraries that cache by weak reference or tag a 
DataFrame do.
   
   The public classes of the client's Rust extension now support both too, with 
PyO3's `weakref` and `dict`, 31 classes:
   - `SparkSession`, `DataFrame`, `Column`, `GroupedData`, 
`PandasCogroupedOps`, `WindowSpec`
   - `DataFrameReader`, `DataFrameWriter`, `DataFrameWriterV2`, 
`MergeIntoWriter`
   - `DataStreamReader`, `DataStreamWriter`, `StreamingQuery`, 
`StreamingQueryManager`
   - `Catalog`, `RuntimeConf`, `DataFrameNaFunctions`, `DataFrameStatFunctions`
   - `TableValuedFunction`, `TableArg`, `DataSourceRegistration`, `Observation`
   - `DataType`, whose subclasses, the data types, inherit them, and 
`StructField`
   - `VariantVal`, `Geometry`, `Geography`
   - `ExecutorResourceRequests`, `TaskResourceRequests`, 
`ResourceProfileBuilder`, `ResourceProfile`
   
   An attribute that an object takes is found before the `__getattr__` of 
`DataFrame` and `Column`, which give columns and fields, as with PySpark's.
   
   ### Why are the changes needed?
   
   They refused both:
   
   ```
   TypeError: cannot create weak reference to 'DataFrame' object
   AttributeError: 'pyspark.sql.connect.dataframe.DataFrame' object has no 
attribute '...'
   ```
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. The objects of these classes can be referred to weakly and take 
attributes, as with PySpark 4.3.0.
   
   ### How was this patch tested?
   
   - A new offline test refers weakly to an object of each of 22 of these 
classes, and sets, reads and deletes an attribute on it. It fails without this 
change, and its body passes with official PySpark 4.3.0.
   - The weak references and attributes of the main classes against a local 
server are those of official PySpark 4.3.0, where only the `UDFRegistration` of 
the client supported both before this change.
   - The lib tests of both crates (597 passed), the build of all tests, also 
with `wasm-udf`, the offline Python suites (2223 passed, 8 skipped), and the 
live drop-in and Arrow suites (206 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]

Reply via email to