This is an automated email from the ASF dual-hosted git repository.

gengliang pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new b1976ac  [SPARK-31004][WEBUI][SS] Show message for empty Streaming 
Queries instead of empty timelines and histograms
b1976ac is described below

commit b1976ac43ce8cdda58916c300fd5b01677fd5973
Author: Kousuke Saruta <saru...@oss.nttdata.com>
AuthorDate: Fri Mar 13 12:58:49 2020 -0700

    [SPARK-31004][WEBUI][SS] Show message for empty Streaming Queries instead 
of empty timelines and histograms
    
    ### What changes were proposed in this pull request?
    
    `StreamingQueryStatisticsPage` shows a message "No visualization 
information available because there is no batches" instead of showing empty 
timelines and histograms for empty streaming queries.
    
    [Before this change applied]
    
![before-fix-for-empty-streaming-query](https://user-images.githubusercontent.com/4736016/75642391-b32e1d80-5c7e-11ea-9c07-e2f0f1b5b4f9.png)
    
    [After this change applied]
    
![after-fix-for-empty-streaming-query2](https://user-images.githubusercontent.com/4736016/75694583-1904be80-5cec-11ea-9b13-dc7078775188.png)
    
    ### Why are the changes needed?
    
    Empty charts are ugly and a little bit confusing.
    It's better to clearly say "No visualization information available".
    
    Also, this change fixes a JS error shown in the capture above.
    This error occurs because `drawTimeline` in `streaming-page.js` is called 
even though `formattedDate` will be `undefined` for empty streaming queries.
    
    ### Does this PR introduce any user-facing change?
    
    Yes. screen captures are shown above.
    
    ### How was this patch tested?
    
    Manually tested by creating an empty streaming query like as follows.
    ```
    val df = 
spark.readStream.format("socket").options(Map("host"->"<non-existing 
hostname>", "port"->"...")).load
    df.writeStream.format("console").start
    ```
    This streaming query will fail because of `non-existing hostname` and has 
no batches.
    
    Closes #27755 from sarutak/fix-for-empty-batches.
    
    Authored-by: Kousuke Saruta <saru...@oss.nttdata.com>
    Signed-off-by: Gengliang Wang <gengliang.w...@databricks.com>
    (cherry picked from commit 680981587d3219aea7caadb56df6519c8b3acb7f)
    Signed-off-by: Gengliang Wang <gengliang.w...@databricks.com>
---
 .../sql/streaming/ui/StreamingQueryStatisticsPage.scala    | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git 
a/sql/core/src/main/scala/org/apache/spark/sql/streaming/ui/StreamingQueryStatisticsPage.scala
 
b/sql/core/src/main/scala/org/apache/spark/sql/streaming/ui/StreamingQueryStatisticsPage.scala
index 65052d9..227e5e5 100644
--- 
a/sql/core/src/main/scala/org/apache/spark/sql/streaming/ui/StreamingQueryStatisticsPage.scala
+++ 
b/sql/core/src/main/scala/org/apache/spark/sql/streaming/ui/StreamingQueryStatisticsPage.scala
@@ -229,14 +229,15 @@ private[ui] class StreamingQueryStatisticsPage(parent: 
StreamingQueryTab)
         0L,
         "ms")
 
-    val table =
-    // scalastyle:off
+    val table = if (query.lastProgress != null) {
+      // scalastyle:off
       <table id="stat-table" class="table table-bordered" style="width: auto">
         <thead>
           <tr>
             <th style="width: 160px;"></th>
             <th style="width: 492px;">Timelines</th>
-            <th style="width: 350px;">Histograms</th></tr>
+            <th style="width: 350px;">Histograms</th>
+          </tr>
         </thead>
         <tbody>
           <tr>
@@ -285,7 +286,12 @@ private[ui] class StreamingQueryStatisticsPage(parent: 
StreamingQueryTab)
           </tr>
         </tbody>
       </table>
-    // scalastyle:on
+    } else {
+      <div id="empty-streaming-query-message">
+        <b>No visualization information available.</b>
+      </div>
+      // scalastyle:on
+    }
 
     generateTimeToValues(operationDurationData) ++
       generateFormattedTimeTipStrings(batchToTimestamps) ++


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to