diff options
author | Shixiong Zhu <shixiong@databricks.com> | 2016-07-11 18:11:06 -0700 |
---|---|---|
committer | Tathagata Das <tathagata.das1565@gmail.com> | 2016-07-11 18:11:06 -0700 |
commit | 91a443b849e4d1ccc50a32b25fdd2bb502cf9b84 (patch) | |
tree | 6758d67216266e60a1d08b19059ca772e13fd65e /sql | |
parent | 05d7151ccbccdd977ec2f2301d5b12566018c988 (diff) | |
download | spark-91a443b849e4d1ccc50a32b25fdd2bb502cf9b84.tar.gz spark-91a443b849e4d1ccc50a32b25fdd2bb502cf9b84.tar.bz2 spark-91a443b849e4d1ccc50a32b25fdd2bb502cf9b84.zip |
[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 <shixiong@databricks.com>
Closes #14100 from zsxwing/SPARK-16433.
Diffstat (limited to 'sql')
3 files changed, 5 insertions, 5 deletions
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 f1af79e738..c90dcc5680 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() 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 29ce578bcd..3d28d4f99c 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) 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 28170f3064..1caafb9d74 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() |