You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by zj...@apache.org on 2020/08/18 01:18:06 UTC

[zeppelin] branch branch-0.9 updated: [ZEPPELIN-4996]. Improve table streaming display

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

zjffdu pushed a commit to branch branch-0.9
in repository https://gitbox.apache.org/repos/asf/zeppelin.git


The following commit(s) were added to refs/heads/branch-0.9 by this push:
     new 73cffca  [ZEPPELIN-4996]. Improve table streaming display
73cffca is described below

commit 73cffcae8558c0c316ea4dab3f0d305721e3bbe1
Author: Jeff Zhang <zj...@apache.org>
AuthorDate: Sat Aug 15 15:24:36 2020 +0800

    [ZEPPELIN-4996]. Improve table streaming display
    
    ### What is this PR for?
    
    This ticket improve the table streaming display by disabling the table append. Instead just refresh the whole output at once. This could make the frontend display more smooth without any shaking. (See screenshot below)
    
    ### What type of PR is it?
    [Improvement]
    
    ### Todos
    * [ ] - Task
    
    ### What is the Jira issue?
    * https://issues.apache.org/jira/browse/ZEPPELIN-4996
    
    ### How should this be tested?
    Manually tested
    
    ### Screenshots (if appropriate)
    * Before
    ![before](https://user-images.githubusercontent.com/164491/90308002-52ce2800-df0e-11ea-840c-11d91d13a83d.gif)
    
    * Now
    
    ![now](https://user-images.githubusercontent.com/164491/90307844-e69ef480-df0c-11ea-97a4-18d3481a3f1f.gif)
    
    ### Questions:
    * Does the licenses files need update? No
    * Is there breaking changes for older versions? No
    * Does this needs documentation? No
    
    Author: Jeff Zhang <zj...@apache.org>
    
    Closes #3878 from zjffdu/ZEPPELIN-4996 and squashes the following commits:
    
    de0c0e283 [Jeff Zhang] [ZEPPELIN-4996]. Improve table streaming display
    
    (cherry picked from commit 51a23801b38eb76f4e72c21304136c6090d4b808)
    Signed-off-by: Jeff Zhang <zj...@apache.org>
---
 .../org/apache/zeppelin/interpreter/InterpreterOutput.java   | 12 ++++++++++++
 .../zeppelin/interpreter/InterpreterResultMessageOutput.java |  7 ++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutput.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutput.java
index aaf6eda..928dd41 100644
--- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutput.java
+++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutput.java
@@ -51,6 +51,10 @@ public class InterpreterOutput extends OutputStream {
   private int size = 0;
   private int lastCRIndex = -1;
 
+  // disable table append by default, because table append may cause frontend output shaking.
+  // so just refresh all output for streaming application, such as flink streaming sql output.
+  private boolean enableTableAppend = false;
+
   // change static var to set interpreter output limit
   // limit will be applied to all InterpreterOutput object.
   // so we can expect the consistent behavior
@@ -68,6 +72,13 @@ public class InterpreterOutput extends OutputStream {
     this.changeListener = listener;
   }
 
+  public void setEnableTableAppend(boolean enableTableAppend) {
+    this.enableTableAppend = enableTableAppend;
+    if (currentOut != null) {
+      currentOut.setEnableTableAppend(enableTableAppend);
+    }
+  }
+
   public void setType(InterpreterResult.Type type) throws IOException {
     InterpreterResultMessageOutput out = null;
 
@@ -81,6 +92,7 @@ public class InterpreterOutput extends OutputStream {
       } else {
         out = new InterpreterResultMessageOutput(type, listener, changeListener);
       }
+      out.setEnableTableAppend(enableTableAppend);
       out.setResourceSearchPaths(resourceSearchPaths);
 
       buffer.reset();
diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResultMessageOutput.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResultMessageOutput.java
index 85f476d..bf219fb 100644
--- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResultMessageOutput.java
+++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResultMessageOutput.java
@@ -44,6 +44,7 @@ public class InterpreterResultMessageOutput extends OutputStream {
   private final InterpreterResultMessageOutputListener flushListener;
   private InterpreterResult.Type type = InterpreterResult.Type.TEXT;
   private boolean firstWrite = true;
+  private boolean enableTableAppend = true;
 
   public InterpreterResultMessageOutput(
       InterpreterResult.Type type,
@@ -62,6 +63,10 @@ public class InterpreterResultMessageOutput extends OutputStream {
     watcher.start();
   }
 
+  public void setEnableTableAppend(boolean enableTableAppend) {
+    this.enableTableAppend = enableTableAppend;
+  }
+
   public InterpreterResult.Type getType() {
     return type;
   }
@@ -240,7 +245,7 @@ public class InterpreterResultMessageOutput extends OutputStream {
   }
 
   public boolean isAppendSupported() {
-    return type == InterpreterResult.Type.TEXT || type == InterpreterResult.Type.TABLE;
+    return type == InterpreterResult.Type.TEXT || (type == InterpreterResult.Type.TABLE && enableTableAppend);
   }
 
   private void copyStream(InputStream in, OutputStream out) throws IOException {