gaborgsomogyi commented on a change in pull request #31944:
URL: https://github.com/apache/spark/pull/31944#discussion_r620995101
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/streaming/progress.scala
##########
@@ -188,7 +178,8 @@ class SourceProgress protected[sql](
val latestOffset: String,
val numInputRows: Long,
val inputRowsPerSecond: Double,
- val processedRowsPerSecond: Double) extends Serializable {
+ val processedRowsPerSecond: Double,
+ val metrics: ju.Map[String, String] = Map[String, String]().asJava) extends
Serializable {
Review comment:
I've had a deeper look and I think it's fine.
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/streaming/progress.scala
##########
@@ -138,31 +138,21 @@ class StreamingQueryProgress private[sql](
override def toString: String = prettyJson
private[sql] def jsonValue: JValue = {
- def safeDoubleToJValue(value: Double): JValue = {
- if (value.isNaN || value.isInfinity) JNothing else JDouble(value)
- }
-
- /** Convert map to JValue while handling empty maps. Also, this sorts the
keys. */
- def safeMapToJValue[T](map: ju.Map[String, T], valueToJValue: T =>
JValue): JValue = {
- if (map.isEmpty) return JNothing
- val keys = map.asScala.keySet.toSeq.sorted
- keys.map { k => k -> valueToJValue(map.get(k)) : JObject }.reduce(_ ~ _)
- }
-
("id" -> JString(id.toString)) ~
("runId" -> JString(runId.toString)) ~
("name" -> JString(name)) ~
("timestamp" -> JString(timestamp)) ~
("batchId" -> JInt(batchId)) ~
("numInputRows" -> JInt(numInputRows)) ~
- ("inputRowsPerSecond" -> safeDoubleToJValue(inputRowsPerSecond)) ~
- ("processedRowsPerSecond" -> safeDoubleToJValue(processedRowsPerSecond)) ~
- ("durationMs" -> safeMapToJValue[JLong](durationMs, v => JInt(v.toLong))) ~
- ("eventTime" -> safeMapToJValue[String](eventTime, s => JString(s))) ~
+ ("inputRowsPerSecond" ->
SafeJsonSerializer.safeDoubleToJValue(inputRowsPerSecond)) ~
+ ("processedRowsPerSecond" ->
SafeJsonSerializer.safeDoubleToJValue(processedRowsPerSecond)) ~
Review comment:
My comment was resolved but I still see `SafeJsonSerializer.` prefixes
all over the PR.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]