-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-21901][SS] Define toString for StateOperatorProgress #19112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,6 +55,8 @@ class StateOperatorProgress private[sql]( | |
| ("numRowsUpdated" -> JInt(numRowsUpdated)) ~ | ||
| ("memoryUsedBytes" -> JInt(memoryUsedBytes)) | ||
| } | ||
|
|
||
| override def toString: String = prettyJson | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -177,11 +179,11 @@ class SourceProgress protected[sql]( | |
| } | ||
|
|
||
| ("description" -> JString(description)) ~ | ||
| ("startOffset" -> tryParse(startOffset)) ~ | ||
| ("endOffset" -> tryParse(endOffset)) ~ | ||
| ("numInputRows" -> JInt(numInputRows)) ~ | ||
| ("inputRowsPerSecond" -> safeDoubleToJValue(inputRowsPerSecond)) ~ | ||
| ("processedRowsPerSecond" -> safeDoubleToJValue(processedRowsPerSecond)) | ||
| ("startOffset" -> tryParse(startOffset)) ~ | ||
| ("endOffset" -> tryParse(endOffset)) ~ | ||
| ("numInputRows" -> JInt(numInputRows)) ~ | ||
| ("inputRowsPerSecond" -> safeDoubleToJValue(inputRowsPerSecond)) ~ | ||
| ("processedRowsPerSecond" -> safeDoubleToJValue(processedRowsPerSecond)) | ||
| } | ||
|
|
||
| private def tryParse(json: String) = try { | ||
|
|
@@ -200,7 +202,7 @@ class SourceProgress protected[sql]( | |
| */ | ||
| @InterfaceStability.Evolving | ||
| class SinkProgress protected[sql]( | ||
| val description: String) extends Serializable { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi, @jaceklaskowski . For this, the original one looks correct for me.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Really?! Then the other places in the file are incorrect like https://github.com/jaceklaskowski/spark/blob/337ad489bb43ef93a651bdd4952bd7f0738698dc/sql/core/src/main/scala/org/apache/spark/sql/streaming/progress.scala#L90 or https://github.com/jaceklaskowski/spark/blob/337ad489bb43ef93a651bdd4952bd7f0738698dc/sql/core/src/main/scala/org/apache/spark/sql/streaming/progress.scala#L161? I might be missing something though.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. Please refer here, https://github.com/databricks/scala-style-guide class Foo(
val param1: String, // 4 space indent for parameters
val param2: String,
val param3: Array[Byte])
extends FooInterface // 2 space indent here
with Logging {
def firstMethod(): Unit = { ... } // blank line above
}
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should I fix the other places then (to make the code consistent and according to the rules)?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I'm not in a position to say that. Maybe, committers will review this and give a direction.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not a committer but would like to leave this suggestion :
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am a committer. Generally, a PR should targets an issue without other changes. I use common sense - fixing styles around the changes (rather small scope) is fine if it does not look making revert/backport harder. |
||
| val description: String) extends Serializable { | ||
|
|
||
| /** The compact JSON representation of this progress. */ | ||
| def json: String = compact(render(jsonValue)) | ||
|
|
@@ -211,6 +213,6 @@ class SinkProgress protected[sql]( | |
| override def toString: String = prettyJson | ||
|
|
||
| private[sql] def jsonValue: JValue = { | ||
| ("description" -> JString(description)) | ||
| "description" -> JString(description) | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, the original style seems to be more frequent and looks correct, doesn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I though it'd been the opposite - see https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/streaming/progress.scala#L53-L57 and https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/streaming/progress.scala#L128-L140.
I've made the section to match the style of the others in the source file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. I guess that those are the less frequent style.