Skip to content

Commit 337ad48

Browse files
[SPARK-21901][SS] Define toString for StateOperatorProgress
1 parent acb7fed commit 337ad48

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

sql/core/src/main/scala/org/apache/spark/sql/streaming/progress.scala

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ class StateOperatorProgress private[sql](
5555
("numRowsUpdated" -> JInt(numRowsUpdated)) ~
5656
("memoryUsedBytes" -> JInt(memoryUsedBytes))
5757
}
58+
59+
override def toString: String = prettyJson
5860
}
5961

6062
/**
@@ -177,11 +179,11 @@ class SourceProgress protected[sql](
177179
}
178180

179181
("description" -> JString(description)) ~
180-
("startOffset" -> tryParse(startOffset)) ~
181-
("endOffset" -> tryParse(endOffset)) ~
182-
("numInputRows" -> JInt(numInputRows)) ~
183-
("inputRowsPerSecond" -> safeDoubleToJValue(inputRowsPerSecond)) ~
184-
("processedRowsPerSecond" -> safeDoubleToJValue(processedRowsPerSecond))
182+
("startOffset" -> tryParse(startOffset)) ~
183+
("endOffset" -> tryParse(endOffset)) ~
184+
("numInputRows" -> JInt(numInputRows)) ~
185+
("inputRowsPerSecond" -> safeDoubleToJValue(inputRowsPerSecond)) ~
186+
("processedRowsPerSecond" -> safeDoubleToJValue(processedRowsPerSecond))
185187
}
186188

187189
private def tryParse(json: String) = try {
@@ -200,7 +202,7 @@ class SourceProgress protected[sql](
200202
*/
201203
@InterfaceStability.Evolving
202204
class SinkProgress protected[sql](
203-
val description: String) extends Serializable {
205+
val description: String) extends Serializable {
204206

205207
/** The compact JSON representation of this progress. */
206208
def json: String = compact(render(jsonValue))
@@ -211,6 +213,6 @@ class SinkProgress protected[sql](
211213
override def toString: String = prettyJson
212214

213215
private[sql] def jsonValue: JValue = {
214-
("description" -> JString(description))
216+
"description" -> JString(description)
215217
}
216218
}

0 commit comments

Comments
 (0)