EnricoMi commented on a change in pull request #31905:
URL: https://github.com/apache/spark/pull/31905#discussion_r600788977



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala
##########
@@ -683,6 +683,12 @@ class SparkSession private(
     ret
   }
 
+  def observation(expr: Column, exprs: Column*): Observation =

Review comment:
       This method is to create the `Observation` instance, whereas a method on 
a DataFrame would be expected to return a DataFrame, as in 
`Dataset[T].observe(name, expr, exprs): Dataset[T]`.
   
   This approach here is similar to AccumulatorV2, which is instantiated and 
registered by calling a method on `SparkContext`, e.g. 
`SparkContext.LongAccumulator`.
   
   An alternative would extend the Dataset API as you suggest:
   
       val observation = Observation(count(lit(1)))
       df.observe(observation).collect()
       val count = observation.get




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

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