You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "ueshin (via GitHub)" <gi...@apache.org> on 2025/10/14 22:45:32 UTC
[PR] [SPARK-53908][CONNECT] Fix observations on Spark Connect with plan cache [spark]
ueshin opened a new pull request, #52616:
URL: https://github.com/apache/spark/pull/52616
### What changes were proposed in this pull request?
Fixes observations on Spark Connect with plan cache enabled.
### Why are the changes needed?
The observations on Spark Connect has cases that can't see the observed values with plan cache enabled.
```py
>>> from pyspark.sql.observation import Observation
>>> from pyspark.sql import functions as F
>>>
>>> df = spark.range(10)
>>> observation = Observation()
>>> observed_df = df.observe(observation, F.count(F.lit(1)).alias("cnt"))
>>>
>>> observed_df.schema # cause to cache
StructType([StructField('id', LongType(), False)])
>>>
>>> observed_df.show()
+---+
| id|
+---+
...
+---+
>>>
>>> observation.get
{}
```
This should be:
```py
>>> observation.get
{'cnt': 10}
```
This is because the cached plan by the Analyze request for `observed_df.schema` doesn't register the new `Observation` for the actual execution.
The observations should be registered later.
### Does this PR introduce _any_ user-facing change?
Yes, the observations will be available.
### How was this patch tested?
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-53908][CONNECT] Fix observations on Spark Connect with plan cache [spark]
Posted by "ueshin (via GitHub)" <gi...@apache.org>.
ueshin commented on PR #52616:
URL: https://github.com/apache/spark/pull/52616#issuecomment-3412640990
Thanks! merging to master.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-53908][CONNECT] Fix observations on Spark Connect with plan cache [spark]
Posted by "ueshin (via GitHub)" <gi...@apache.org>.
ueshin closed pull request #52616: [SPARK-53908][CONNECT] Fix observations on Spark Connect with plan cache
URL: https://github.com/apache/spark/pull/52616
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org