-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-18694][SS]Add StreamingQuery.explain and exception to Python and fix StreamingQueryException #16125
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
[SPARK-18694][SS]Add StreamingQuery.explain and exception to Python and fix StreamingQueryException #16125
Changes from all commits
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 |
|---|---|---|
|
|
@@ -38,6 +38,13 @@ import org.apache.spark.annotation.Experimental | |
| class StateOperatorProgress private[sql]( | ||
| val numRowsTotal: Long, | ||
| val numRowsUpdated: Long) { | ||
|
|
||
| /** The compact JSON representation of this progress. */ | ||
| def json: String = compact(render(jsonValue)) | ||
|
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. why are these needed? the outer StreamingQueryProgress already converts to json correctly. is this just for consistency with SourceProgress?
Member
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.
Yes. Other progress classes have these json methods. |
||
|
|
||
| /** The pretty (i.e. indented) JSON representation of this progress. */ | ||
| def prettyJson: String = pretty(render(jsonValue)) | ||
|
|
||
| private[sql] def jsonValue: JValue = { | ||
| ("numRowsTotal" -> JInt(numRowsTotal)) ~ | ||
| ("numRowsUpdated" -> JInt(numRowsUpdated)) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -103,10 +103,12 @@ class StreamingQuerySuite extends StreamTest with BeforeAndAfter with Logging { | |
| TestAwaitTermination(ExpectException[SparkException]), | ||
| TestAwaitTermination(ExpectException[SparkException], timeoutMs = 2000), | ||
| TestAwaitTermination(ExpectException[SparkException], timeoutMs = 10), | ||
| AssertOnQuery( | ||
| q => q.exception.get.startOffset.get.offsets === | ||
| q.committedOffsets.toOffsetSeq(Seq(inputData), "{}").offsets, | ||
| "incorrect start offset on exception") | ||
| AssertOnQuery(q => { | ||
| q.exception.get.startOffset === | ||
| q.committedOffsets.toOffsetSeq(Seq(inputData), "{}").toString && | ||
|
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. This line would conflict with my PR #16113 , you may have to fix issues after my PR gets merged. |
||
| q.exception.get.endOffset === | ||
| q.availableOffsets.toOffsetSeq(Seq(inputData), "{}").toString | ||
| }, "incorrect start offset or end offset on exception") | ||
| ) | ||
| } | ||
|
|
||
|
|
||
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.
The class name here allows capture_sql_exception to convert Java StreamingQueryException to Python StreamingQueryException.