luoyuqinlaura commented on code in PR #59966:
URL: https://github.com/apache/spark/pull/59966#discussion_r4647334066
##########
sql/core/src/test/scala/org/apache/spark/sql/execution/ui/SQLAppStatusListenerSuite.scala:
##########
@@ -599,6 +599,33 @@ abstract class SQLAppStatusListenerSuite extends
SharedSparkSession with JsonTes
assert(metrics(driverMetric2.id) === expectedValue2)
}
+ test("SPARK-60759: aggregateMetrics merges repeated driver updates of the
same accumulator") {
+ val statusStore = spark.sharedState.statusStore
+
+ val values = Seq(10L, 20L)
+ val physicalPlan =
MyPlanWithRepeatedDriverAccumUpdates(sqlContext.sparkContext, values)
+ val dummyQueryExecution = new QueryExecution(spark, LocalRelation()) {
+ override lazy val sparkPlan = physicalPlan
+ override lazy val executedPlan = physicalPlan
+ }
+
+ val execId = runAndWaitForExecution {
+ SQLExecution.withNewExecutionId(dummyQueryExecution) {
+ physicalPlan.execute().collect()
+ }
+ }
+
+ val metrics = statusStore.executionMetrics(execId)
+ val driverMetric = physicalPlan.metrics("dummy")
+ // The accumulator is cumulative, so each post reports the running total.
+ val postedValues = values.scanLeft(0L)(_ + _).tail
Review Comment:
Good catch. That test and MyPlanWithRepeatedDriverAccumUpdates are gone. The
new test asserts the full rendered string from MetricUtils.stringValue with
distinct per-entry values, so it no longer encodes the summed 40.
--
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]