Repository: spark Updated Branches: refs/heads/master 05d7151cc -> 91a443b84
[SPARK-16433][SQL] Improve StreamingQuery.explain when no data arrives ## What changes were proposed in this pull request? Display `No physical plan. Waiting for data.` instead of `N/A` for StreamingQuery.explain when no data arrives because `N/A` doesn't provide meaningful information. ## How was this patch tested? Existing unit tests. Author: Shixiong Zhu <[email protected]> Closes #14100 from zsxwing/SPARK-16433. Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/91a443b8 Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/91a443b8 Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/91a443b8 Branch: refs/heads/master Commit: 91a443b849e4d1ccc50a32b25fdd2bb502cf9b84 Parents: 05d7151 Author: Shixiong Zhu <[email protected]> Authored: Mon Jul 11 18:11:06 2016 -0700 Committer: Tathagata Das <[email protected]> Committed: Mon Jul 11 18:11:06 2016 -0700 ---------------------------------------------------------------------- .../apache/spark/sql/execution/streaming/StreamExecution.scala | 2 +- .../org/apache/spark/sql/streaming/FileStreamSourceSuite.scala | 4 ++-- .../test/scala/org/apache/spark/sql/streaming/StreamSuite.scala | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/91a443b8/sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/StreamExecution.scala ---------------------------------------------------------------------- diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/StreamExecution.scala b/sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/StreamExecution.scala index f1af79e..c90dcc5 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/StreamExecution.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/StreamExecution.scala @@ -477,7 +477,7 @@ class StreamExecution( /** Expose for tests */ def explainInternal(extended: Boolean): String = { if (lastExecution == null) { - "N/A" + "No physical plan. Waiting for data." } else { val explain = ExplainCommand(lastExecution.logical, extended = extended) sparkSession.sessionState.executePlan(explain).executedPlan.executeCollect() http://git-wip-us.apache.org/repos/asf/spark/blob/91a443b8/sql/core/src/test/scala/org/apache/spark/sql/streaming/FileStreamSourceSuite.scala ---------------------------------------------------------------------- diff --git a/sql/core/src/test/scala/org/apache/spark/sql/streaming/FileStreamSourceSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/streaming/FileStreamSourceSuite.scala index 29ce578..3d28d4f 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/streaming/FileStreamSourceSuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/streaming/FileStreamSourceSuite.scala @@ -672,8 +672,8 @@ class FileStreamSourceSuite extends FileStreamSourceTest { val q = df.writeStream.queryName("file_explain").format("memory").start() .asInstanceOf[StreamExecution] try { - assert("N/A" === q.explainInternal(false)) - assert("N/A" === q.explainInternal(true)) + assert("No physical plan. Waiting for data." === q.explainInternal(false)) + assert("No physical plan. Waiting for data." === q.explainInternal(true)) val tempFile = Utils.tempFileWith(new File(tmp, "text")) val finalFile = new File(src, tempFile.getName) http://git-wip-us.apache.org/repos/asf/spark/blob/91a443b8/sql/core/src/test/scala/org/apache/spark/sql/streaming/StreamSuite.scala ---------------------------------------------------------------------- diff --git a/sql/core/src/test/scala/org/apache/spark/sql/streaming/StreamSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/streaming/StreamSuite.scala index 28170f3..1caafb9 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/streaming/StreamSuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/streaming/StreamSuite.scala @@ -251,8 +251,8 @@ class StreamSuite extends StreamTest { val q = df.writeStream.queryName("memory_explain").format("memory").start() .asInstanceOf[StreamExecution] try { - assert("N/A" === q.explainInternal(false)) - assert("N/A" === q.explainInternal(true)) + assert("No physical plan. Waiting for data." === q.explainInternal(false)) + assert("No physical plan. Waiting for data." === q.explainInternal(true)) inputData.addData("abc") q.processAllAvailable() --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
