Github user zsxwing commented on a diff in the pull request:
https://github.com/apache/spark/pull/18107#discussion_r118615627
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/statefulOperators.scala
---
@@ -61,11 +60,24 @@ trait StateStoreReader extends StatefulOperator {
}
/** An operator that writes to a StateStore. */
-trait StateStoreWriter extends StatefulOperator {
+trait StateStoreWriter extends StatefulOperator { self: SparkPlan =>
+
override lazy val metrics = Map(
"numOutputRows" -> SQLMetrics.createMetric(sparkContext, "number of
output rows"),
"numTotalStateRows" -> SQLMetrics.createMetric(sparkContext, "number
of total state rows"),
- "numUpdatedStateRows" -> SQLMetrics.createMetric(sparkContext, "number
of updated state rows"))
+ "numUpdatedStateRows" -> SQLMetrics.createMetric(sparkContext, "number
of updated state rows"),
+ "allUpdatesTimeMs" -> SQLMetrics.createTimingMetric(sparkContext,
"total time to update rows"),
+ "allRemovalsTimeMs" -> SQLMetrics.createTimingMetric(sparkContext,
"total time to remove rows"),
+ "commitTimeMs" -> SQLMetrics.createTimingMetric(sparkContext, "time to
commit changes")
+ )
+
+ /** Records the duration of running `body` for the next query progress
update. */
+ protected def timeTakenMs(body: => Unit): Long = {
+ val startTime = System.currentTimeMillis
--- End diff --
nit: Use `nanoTime` instead
---
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]