xupefei commented on code in PR #45701:
URL: https://github.com/apache/spark/pull/45701#discussion_r1559266569
##########
connector/connect/client/jvm/src/main/scala/org/apache/spark/sql/Dataset.scala:
##########
@@ -3397,7 +3488,11 @@ class Dataset[T] private[sql] (
sparkSession.analyze(plan, proto.AnalyzePlanRequest.AnalyzeCase.SCHEMA)
}
- def collectResult(): SparkResult[T] = sparkSession.execute(plan,
agnosticEncoder)
+ def collectResult(): SparkResult[T] =
+ sparkSession.execute(plan, agnosticEncoder, getObservationsMapOpt)
+
+ def collectObservations(): Map[String, Map[String, Any]] =
+ collectResult().getObservedMetrics
Review Comment:
So far only in tests.
Now this API is the only we we can fetch metrics that are not associated to
`Observation` objects. It's serves the same propose as in the Python API, where
we have `df.attrs["observed_metrics"]` to access such metrics.
Please give suggestion about a better place to place it.
##########
connector/connect/client/jvm/src/main/scala/org/apache/spark/sql/Dataset.scala:
##########
@@ -3397,7 +3488,11 @@ class Dataset[T] private[sql] (
sparkSession.analyze(plan, proto.AnalyzePlanRequest.AnalyzeCase.SCHEMA)
}
- def collectResult(): SparkResult[T] = sparkSession.execute(plan,
agnosticEncoder)
+ def collectResult(): SparkResult[T] =
+ sparkSession.execute(plan, agnosticEncoder, getObservationsMapOpt)
+
+ def collectObservations(): Map[String, Map[String, Any]] =
+ collectResult().getObservedMetrics
Review Comment:
So far only in tests.
Now this API is the only we we can fetch metrics that are not associated to
`Observation` objects. It's serves the same propose as in the Python API, where
we have `df.attrs["observed_metrics"]` to access such metrics.
If possible, please give suggestion about a better place to place it.
--
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]