HyukjinKwon commented on a change in pull request #33545: URL: https://github.com/apache/spark/pull/33545#discussion_r679561495
########## File path: sql/core/src/main/scala/org/apache/spark/sql/Observation.scala ########## @@ -75,23 +79,39 @@ class Observation(name: String) { } /** - * Get the observed metrics. This waits for the observed dataset to finish its first action. - * Only the result of the first action is available. Subsequent actions do not modify the result. + * (Scala-specific) Get the observed metrics. This waits for the observed dataset to finish + * its first action. Only the result of the first action is available. Subsequent actions do not + * modify the result. * - * @return the observed metrics as a [[Row]] + * @return the observed metrics as a `Map[String, Any]` * @throws InterruptedException interrupted while waiting */ @throws[InterruptedException] - def get: Row = { + def get: Map[String, Any] = { synchronized { // we need to loop as wait might return without us calling notify // https://en.wikipedia.org/w/index.php?title=Spurious_wakeup&oldid=992601610 - while (this.row.isEmpty) { + while (this.metrics.isEmpty) { wait() } } - this.row.get + this.metrics.get + } + + /** + * (Java-specific) Get the observed metrics. This waits for the observed dataset to finish + * its first action. Only the result of the first action is available. Subsequent actions do not + * modify the result. + * + * @return the observed metrics as a `java.util.Map[String, Object]` + * @throws InterruptedException interrupted while waiting + */ + @throws[InterruptedException] + def getAsJava: java.util.Map[String, Object] = { Review comment: Here too. BTW, I remember `AnyRef` corresponds to `Object`. If `Map[String, _]` doesn't work, can we switch to `AnyRef`? -- 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-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org