ueshin commented on code in PR #45701: URL: https://github.com/apache/spark/pull/45701#discussion_r1543431051
########## connector/connect/client/jvm/src/main/scala/org/apache/spark/sql/Dataset.scala: ########## @@ -3338,7 +3358,25 @@ class Dataset[T] private[sql] ( } def observe(name: String, expr: Column, exprs: Column*): Dataset[T] = { Review Comment: Don't we need to annotate this with `@varargs` for Java client? ########## connector/connect/client/jvm/src/main/scala/org/apache/spark/sql/Dataset.scala: ########## @@ -3338,7 +3358,25 @@ class Dataset[T] private[sql] ( } def observe(name: String, expr: Column, exprs: Column*): Dataset[T] = { - throw new UnsupportedOperationException("observe is not implemented.") + sparkSession.newDataset(agnosticEncoder, getObservationsMapOpt) { builder => + builder.getCollectMetricsBuilder + .setInput(plan.getRoot) + .setName(name) + .addAllMetrics((expr +: exprs).map(_.expr).asJava) + } + } + + def observe(observation: Observation, expr: Column, exprs: Column*): Dataset[T] = { Review Comment: ditto. -- 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