Github user viirya commented on a diff in the pull request:
https://github.com/apache/spark/pull/18301#discussion_r122195150
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/metric/SQLMetrics.scala
---
@@ -57,6 +57,11 @@ class SQLMetric(val metricType: String, initValue: Long
= 0L) extends Accumulato
override def add(v: Long): Unit = _value += v
+ // Because `SQLMetric` only stores long value, in order to store double
average metrics, we
+ // multiply the given double with a base integer. When showing the
metrics, it will be
+ // divided by the base integer to restore back a double.
+ def setWithDouble(v: Double): Unit = _value = (v *
SQLMetrics.baseForAvgMetric).toLong
--- End diff --
To store a float value into `SQLMetric`, currently I have no better idea to
do. Any suggestion welcome.
---
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]