-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[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
Conversation
python/pyspark/sql/streaming.py
Outdated
| :return: the StreamingQueryException if the query was terminated by an exception, or None. | ||
| >>> sq = sdf.writeStream.format('memory').queryName('query_exception').start() | ||
| >>> str(sq.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.
Convert None to a string 'None'. Otherwise, REPL prints nothing.
|
Test build #69596 has finished for PR 16125 at commit
|
|
Test build #69597 has finished for PR 16125 at commit
|
python/pyspark/sql/streaming.py
Outdated
| ... pass # Ignore the error as we want to test the "exception" method | ||
| >>> sq.exception() | ||
| StreamingQueryException() | ||
| >>> sq.stop() |
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 am not sure if such a big test should be present as doc tests. please add this to the sql/tests.py.
| val numRowsUpdated: Long) { | ||
|
|
||
| /** The compact JSON representation of this progress. */ | ||
| def json: String = compact(render(jsonValue)) |
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.
why are these needed? the outer StreamingQueryProgress already converts to json correctly. is this just for consistency with SourceProgress?
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.
is this just for consistency with SourceProgress?
Yes. Other progress classes have these json methods.
| "incorrect start offset on exception") | ||
| AssertOnQuery(q => { | ||
| q.exception.get.startOffset === | ||
| q.committedOffsets.toOffsetSeq(Seq(inputData), "{}").toString && |
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.
This line would conflict with my PR #16113 , you may have to fix issues after my PR gets merged.
|
Test build #69607 has finished for PR 16125 at commit
|
| endOffset: String) { | ||
| this( | ||
| // scalastyle:off | ||
| s"""${classOf[StreamingQueryException].getName}: ${cause.getMessage} ${cause.getStackTrace.take(10).mkString("", "\n|\t", "\n")} |
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.
|
Merging this to master and 2.1 |
|
Merged to master, but 2.1 failed due to mima exclude conflict. can you make another PR for 2.1 @zsxwing thanks! |
…and fix StreamingQueryException (branch 2.1) ## What changes were proposed in this pull request? Backport #16125 to branch 2.1. ## How was this patch tested? Jenkins Author: Shixiong Zhu <[email protected]> Closes #16153 from zsxwing/SPARK-18694-2.1.
…and fix StreamingQueryException ## What changes were proposed in this pull request? - Add StreamingQuery.explain and exception to Python. - Fix StreamingQueryException to not expose `OffsetSeq`. ## How was this patch tested? Jenkins Author: Shixiong Zhu <[email protected]> Closes apache#16125 from zsxwing/py-streaming-explain.
…and fix StreamingQueryException ## What changes were proposed in this pull request? - Add StreamingQuery.explain and exception to Python. - Fix StreamingQueryException to not expose `OffsetSeq`. ## How was this patch tested? Jenkins Author: Shixiong Zhu <[email protected]> Closes apache#16125 from zsxwing/py-streaming-explain.
What changes were proposed in this pull request?
OffsetSeq.How was this patch tested?
Jenkins