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

   ### What changes were proposed in this pull request?
   
   Fixes observation when named observations with the same name on different 
datasets.
   
   ### Why are the changes needed?
   
   Currently if there are observations with the same name on different dataset, 
one of them will be overwritten by the other execution.
   
   For example,
   
   ```py
   >>> observation1 = Observation("named")
   >>> df1 = spark.range(50)
   >>> observed_df1 = df1.observe(observation1, count(lit(1)).alias("cnt"))
   >>>
   >>> observation2 = Observation("named")
   >>> df2 = spark.range(100)
   >>> observed_df2 = df2.observe(observation2, count(lit(1)).alias("cnt"))
   >>>
   >>> observed_df1.collect()
   ...
   >>> observed_df2.collect()
   ...
   >>> observation1.get
   {'cnt': 50}
   >>> observation2.get
   {'cnt': 50}
   ```
   
   `observation2` should return `{'cnt': 100}`.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, the observations with the same name will be available if they observe 
different datasets.
   
   ### How was this patch tested?
   
   Added 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