You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/12/28 04:31:47 UTC
[GitHub] [spark] cloud-fan commented on a change in pull request #35028: [SPARK-37578][SQL] Update task metrics from ds v2 custom metrics
cloud-fan commented on a change in pull request #35028:
URL: https://github.com/apache/spark/pull/35028#discussion_r775719876
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/execution/ui/SQLAppStatusListenerSuite.scala
##########
@@ -900,6 +900,46 @@ class SQLAppStatusListenerSuite extends SharedSparkSession with JsonTestUtils
assert(innerMetric.isDefined)
}
}
+
+ test("SPARK-37578: Update output metrics from Datasource v2") {
+ withTempDir { dir =>
+ val statusStore = spark.sharedState.statusStore
+ val oldCount = statusStore.executionsList().size
+
+ val bytesWritten = new ArrayBuffer[Long]()
+ val recordsWritten = new ArrayBuffer[Long]()
+
+ val bytesWrittenListener = new SparkListener() {
+ override def onTaskEnd(taskEnd: SparkListenerTaskEnd): Unit = {
+ bytesWritten += taskEnd.taskMetrics.outputMetrics.bytesWritten
+ recordsWritten += taskEnd.taskMetrics.outputMetrics.recordsWritten
+ }
+ }
+ spark.sparkContext.addSparkListener(bytesWrittenListener)
+
+ try {
+ val cls = classOf[CustomMetricsDataSource].getName
+ spark.range(0, 10, 1, 2).select('id as 'i, -'id as 'j).write.format(cls)
+ .option("path", dir.getCanonicalPath).mode("append").save()
+
+ // Wait until the new execution is started and being tracked.
+ eventually(timeout(10.seconds), interval(10.milliseconds)) {
+ assert(statusStore.executionsCount() >= oldCount)
Review comment:
```suggestion
assert(statusStore.executionsCount() > oldCount)
```
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org