Github user viirya commented on a diff in the pull request:
https://github.com/apache/spark/pull/18301#discussion_r124710724
--- Diff:
sql/core/src/test/scala/org/apache/spark/sql/execution/metric/SQLMetricsSuite.scala
---
@@ -163,29 +178,45 @@ class SQLMetricsSuite extends SparkFunSuite with
SharedSQLContext {
val df2 = testData2.groupBy('a).count()
val expected2 = Seq(
Map("number of output rows" -> 4L,
- "avg hashmap probe (min, med, max)" -> "\n(1, 1, 1)"),
+ "avg hash probe (min, med, max)" -> "\n(1, 1, 1)"),
Map("number of output rows" -> 3L,
- "avg hashmap probe (min, med, max)" -> "\n(1, 1, 1)"))
+ "avg hash probe (min, med, max)" -> "\n(1, 1, 1)"))
testSparkPlanMetrics(df2, 1, Map(
2L -> ("HashAggregate", expected2(0)),
0L -> ("HashAggregate", expected2(1)))
)
}
test("Aggregate metrics: track avg probe") {
- val random = new Random()
- val manyBytes = (0 until 65535).map { _ =>
- val byteArrSize = random.nextInt(100)
- val bytes = new Array[Byte](byteArrSize)
- random.nextBytes(bytes)
- (bytes, random.nextInt(100))
- }
- val df = manyBytes.toSeq.toDF("a",
"b").repartition(1).groupBy('a).count()
- val metrics = getSparkPlanMetrics(df, 1, Set(2L, 0L)).get
- Seq(metrics(2L)._2("avg hashmap probe (min, med, max)"),
- metrics(0L)._2("avg hashmap probe (min, med, max)")).foreach {
probes =>
- probes.toString.stripPrefix("\n(").stripSuffix(")").split(",
").foreach { probe =>
- assert(probe.toInt > 1)
+ // The executed plan looks like:
+ // HashAggregate(keys=[a#61], functions=[count(1)], output=[a#61,
count#71L])
+ // +- Exchange hashpartitioning(a#61, 5)
+ // +- HashAggregate(keys=[a#61], functions=[partial_count(1)],
output=[a#61, count#76L])
+ // +- Exchange RoundRobinPartitioning(1)
+ // +- LocalTableScan [a#61]
+ //
+ // Assume the execution plan is:
+ // Wholestage disabled:
+ // LocalTableScan(nodeId = 4) ->Exchange (nodeId = 3) ->
HashAggregate(nodeId = 2) ->
--- End diff --
I attached the tree string. This doc is used to show `nodeId` relations.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]