juliuszsompolski commented on code in PR #57323:
URL: https://github.com/apache/spark/pull/57323#discussion_r3613351807


##########
sql/core/src/test/scala/org/apache/spark/sql/execution/metric/MetricsFailureInjectionSuite.scala:
##########
@@ -299,6 +304,71 @@ class MetricsFailureInjectionSuite
     }
   }
 
+  test("Observation metrics block failure injection") {

Review Comment:
   what do you mean by "block failure injection"? Failures should be firing, 
just that with last attempt metrics you shouldn't get duplicate results.



##########
sql/core/src/main/scala/org/apache/spark/sql/execution/CollectMetricsExec.scala:
##########
@@ -36,9 +36,10 @@ case class CollectMetricsExec(
     child: SparkPlan)
   extends UnaryExecNode {
 
-  private lazy val accumulator: AggregatingAccumulator = {
-    val acc = AggregatingAccumulator(metricExpressions, child.output)
+  private lazy val accumulator: LastAttemptAggregatingAccumulator = {
+    val acc = AggregatingAccumulator.lastAttempt(metricExpressions, 
child.output)
     acc.register(sparkContext, Option(CollectMetricsExec.ACCUMULATOR_NAME))
+    acc.initializeLastAttemptAccumulator()

Review Comment:
   nit: (pre-existing) I think it would be better if AggregatingAccumulator 
apply and lastAttempt would handle registration (pass the name to them) and 
initialization. That would be parallel of how the SQLMetrics helper do 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]

Reply via email to