Github user dbkerkela commented on a diff in the pull request:
https://github.com/apache/spark/pull/21634#discussion_r197807962
--- Diff:
sql/core/src/test/scala/org/apache/spark/sql/execution/metric/SQLMetricsSuite.scala
---
@@ -504,4 +504,38 @@ class SQLMetricsSuite extends SparkFunSuite with
SQLMetricsTestUtils with Shared
test("writing data out metrics with dynamic partition: parquet") {
testMetricsDynamicPartition("parquet", "parquet", "t1")
}
+
+ test("writing metrics from single thread") {
+ val nAdds = 10
+ val acc = new SQLMetric("test", -10)
+ assert(acc.isZero())
+ acc.set(0)
+ for (i <- 1 to nAdds) acc.add(1)
+ assert(!acc.isZero())
+ assert(nAdds === acc.value)
+ acc.reset()
+ assert(acc.isZero())
+ }
+
+ test("writing metrics from multiple threads") {
+ implicit val ec: ExecutionContextExecutor = ExecutionContext.global
+ val nThreads = 1000
--- End diff --
True - I'll rename.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]