ueshin opened a new pull request, #43469:
URL: https://github.com/apache/spark/pull/43469

   ### What changes were proposed in this pull request?
   
   Apply the observed metrics to `Observation` object.
   
   ### Why are the changes needed?
   
   When using `Observation`, the observed metrics should be applied to the 
object.
   
   For example, in vanilla PySpark:
   
   ```py
   >>> df = spark.createDataFrame([["Alice", 2], ["Bob", 5]], ["name", "age"])
   >>> observation = Observation("my metrics")
   >>> observed_df = df.observe(observation, count(lit(1)).alias("count"), 
max(col("age")))
   >>> observed_df.count()
   2
   >>>
   >>> observation.get
   {'count': 2, 'max(age)': 5}
   ```
   
   whereas in Spark Connect, currently it fails with 
`PySparkNotImplementedError`:
   
   ```py
   >>> observation.get
   Traceback (most recent call last):
   ...
       raise PySparkNotImplementedError(
   pyspark.errors.exceptions.base.PySparkNotImplementedError: [NOT_IMPLEMENTED] 
Observation support for Spark Connect is not implemented.
   ```
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, the `Observation` will see the changes.
   
   ### How was this patch tested?
   
   Added/modified the related tests.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   No.


-- 
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