zeppelin git commit: ZEPPELIN-3364. Followup of ZEPPELIN-3362, improve ZeppelinContext & add more test

2018-03-29 Thread zjffdu
Repository: zeppelin
Updated Branches:
  refs/heads/master fd27014b0 -> b9d6056b7


ZEPPELIN-3364. Followup of ZEPPELIN-3362, improve ZeppelinContext & add more 
test

### What is this PR for?

This PR address the remaining issue of ZEPPELIN-3362, and also add more test 
for ZeppelinContext.

### What type of PR is it?
[ Improvement ]

### Todos
* [ ] - Task

### What is the Jira issue?
* https://issues.apache.org/jira/browse/ZEPPELIN-3364

### How should this be tested?
* CI pass

### Screenshots (if appropriate)

### Questions:
* Does the licenses files need update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? No

Author: Jeff Zhang 

Closes #2894 from zjffdu/ZEPPELIN-3364 and squashes the following commits:

891f1e1 [Jeff Zhang] ZEPPELIN-3364. Followup of ZEPPELIN-3362, improve 
ZeppelinContext & add more test


Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/b9d6056b
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/b9d6056b
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/b9d6056b

Branch: refs/heads/master
Commit: b9d6056b7daa58d3021b70da2cfd8ad21c0ffb6e
Parents: fd27014
Author: Jeff Zhang 
Authored: Sun Mar 25 22:13:44 2018 +0800
Committer: Jeff Zhang 
Committed: Fri Mar 30 12:05:47 2018 +0800

--
 .../main/resources/python/zeppelin_context.py   | 26 -
 .../zeppelin/python/IPythonInterpreterTest.java | 24 -
 .../zeppelin/spark/IPySparkInterpreterTest.java |  2 +-
 .../zeppelin/rest/ZeppelinSparkClusterTest.java | 57 +++-
 4 files changed, 92 insertions(+), 17 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/b9d6056b/python/src/main/resources/python/zeppelin_context.py
--
diff --git a/python/src/main/resources/python/zeppelin_context.py 
b/python/src/main/resources/python/zeppelin_context.py
index d97a789..d29a16f 100644
--- a/python/src/main/resources/python/zeppelin_context.py
+++ b/python/src/main/resources/python/zeppelin_context.py
@@ -17,6 +17,7 @@
 
 import os, sys
 import warnings
+import base64
 
 from io import BytesIO
 
@@ -34,7 +35,7 @@ class PyZeppelinContext(object):
 self.gateway = gateway
 self.paramOption = 
gateway.jvm.org.apache.zeppelin.display.ui.OptionInput.ParamOption
 self.javaList = gateway.jvm.java.util.ArrayList
-self.max_result = 1000
+self.max_result = z.getMaxResult()
 self._displayhook = lambda *args: None
 self._setup_matplotlib()
 
@@ -129,13 +130,13 @@ class PyZeppelinContext(object):
 # `isinstance(p, DataFrame)` would req `import 
pandas.core.frame.DataFrame`
 # and so a dependency on pandas
 self.show_dataframe(p, **kwargs)
-elif hasattr(p, '__call__'):
-p() #error reporting
-
+else:
+print(str(p))
+
 def show_dataframe(self, df, show_index=False, **kwargs):
 """Pretty prints DF using Table Display System
 """
-limit = len(df) > self.max_result
+exceed_limit = len(df) > self.max_result
 header_buf = StringIO("")
 if show_index:
 idx_name = str(df.index.name) if df.index.name is not None else ""
@@ -147,7 +148,7 @@ class PyZeppelinContext(object):
 header_buf.write("\n")
 
 body_buf = StringIO("")
-rows = df.head(self.max_result).values if limit else df.values
+rows = df.head(self.max_result).values if exceed_limit else df.values
 index = df.index.values
 for idx, row in zip(index, rows):
 if show_index:
@@ -158,13 +159,12 @@ class PyZeppelinContext(object):
 body_buf.write("\t")
 body_buf.write(str(cell))
 body_buf.write("\n")
-body_buf.seek(0); header_buf.seek(0)
-#TODO(bzz): fix it, so it shows red notice, as in Spark
-print("%table " + header_buf.read() + body_buf.read()) # +
-#  ("\nResults are limited by {}." \
-#  .format(self.max_result) if limit else "")
-#)
+body_buf.seek(0)
+header_buf.seek(0)
+print("%table " + header_buf.read() + body_buf.read())
 body_buf.close(); header_buf.close()
+if exceed_limit:
+print("%html Results are limited by 
{}.".format(self.max_result))
 
 def show_matplotlib(self, p, fmt="png", width="auto", height="auto",
 **kwargs):
@@ -176,7 +176,7 @@ class PyZeppelinContext(object):
 img_str = b"data:image/png;base64,"
 img_str += base64.b64encode(img.getvalue().strip())
 img_tag = ""
-# Decoding 

zeppelin git commit: ZEPPELIN-3313 z.getInterpreterContext().out().clear() fails to clear table data

2018-03-29 Thread rkamath
Repository: zeppelin
Updated Branches:
  refs/heads/branch-0.8 726f82670 -> da277b9fb


ZEPPELIN-3313 z.getInterpreterContext().out().clear() fails to clear table data

### What is this PR for?
z.getInterpreterContext().out().clear() fails to clear table data

### What type of PR is it?
Bug Fix

### Todos
* [ ] - Fix visualizations in a separate ticket

### What is the Jira issue?
[ZEPPELIN-3313](https://issues.apache.org/jira/browse/ZEPPELIN-3313)

### How should this be tested?
see jira description

### Screenshots (if appropriate)

 before
![before](https://user-images.githubusercontent.com/2031306/37593485-2585fb74-2b98-11e8-9a21-8dd81a0c4c7d.gif)

 after
![after](https://user-images.githubusercontent.com/2031306/37593495-2e106ba8-2b98-11e8-9dab-80985b82ccec.gif)

### Questions:
* Does the licenses files need update? no
* Is there breaking changes for older versions? no
* Does this needs documentation? no

Author: Renjith Kamath 

Closes #2881 from r-kamath/ZEPPELIN-3313 and squashes the following commits:

d67974e2b [Renjith Kamath] ZEPPELIN-3313 
z.getInterpreterContext().out().clear() fails to clear table data

(cherry picked from commit fd27014b02aa9635190b2c4bb76d34589b16792c)
Signed-off-by: Renjith Kamath 


Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/da277b9f
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/da277b9f
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/da277b9f

Branch: refs/heads/branch-0.8
Commit: da277b9fbef076071e80fcb3c01e78c341b7cbf4
Parents: 726f826
Author: Renjith Kamath 
Authored: Mon Mar 19 17:04:12 2018 +0530
Committer: Renjith Kamath 
Committed: Thu Mar 29 16:35:41 2018 +0530

--
 .../builtins/visualization-table.js | 95 ++--
 1 file changed, 46 insertions(+), 49 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/da277b9f/zeppelin-web/src/app/visualization/builtins/visualization-table.js
--
diff --git a/zeppelin-web/src/app/visualization/builtins/visualization-table.js 
b/zeppelin-web/src/app/visualization/builtins/visualization-table.js
index 5837575..3eb0886 100644
--- a/zeppelin-web/src/app/visualization/builtins/visualization-table.js
+++ b/zeppelin-web/src/app/visualization/builtins/visualization-table.js
@@ -288,6 +288,51 @@ export default class TableVisualization extends 
Visualization {
 
 const config = this.config;
 const self = this; // for closure
+const scope = this.getScope();
+// set gridApi for this elem
+const gridApiId = this.getGridApiId();
+const gridOptions = this.createGridOptions(tableData, 
onRegisterApiCallback, config);
+
+const onRegisterApiCallback = (gridApi) => {
+  scope[gridApiId] = gridApi;
+  // should restore state before registering APIs
+
+  // register callbacks for change evens
+  // should persist `self.config` instead `config` (closure issue)
+  gridApi.core.on.columnVisibilityChanged(scope, () => {
+self.persistConfigWithGridState(self.config);
+  });
+  gridApi.colMovable.on.columnPositionChanged(scope, () => {
+self.persistConfigWithGridState(self.config);
+  });
+  gridApi.core.on.sortChanged(scope, () => {
+self.persistConfigWithGridState(self.config);
+  });
+  gridApi.core.on.filterChanged(scope, () => {
+self.persistConfigWithGridState(self.config);
+  });
+  gridApi.grouping.on.aggregationChanged(scope, () => {
+self.persistConfigWithGridState(self.config);
+  });
+  gridApi.grouping.on.groupingChanged(scope, () => {
+self.persistConfigWithGridState(self.config);
+  });
+  gridApi.treeBase.on.rowCollapsed(scope, () => {
+self.persistConfigWithGridState(self.config);
+  });
+  gridApi.treeBase.on.rowExpanded(scope, () => {
+self.persistConfigWithGridState(self.config);
+  });
+  gridApi.colResizable.on.columnSizeChanged(scope, () => {
+self.persistConfigWithGridState(self.config);
+  });
+
+  // pagination doesn't follow usual life-cycle in ui-grid v4.0.4
+  // gridApi.pagination.on.paginationChanged(scope, () => { 
self.persistConfigWithGridState(self.config) })
+  // TBD: do we need to propagate row selection?
+  // gridApi.selection.on.rowSelectionChanged(scope, () => { 
self.persistConfigWithGridState(self.config) })
+  // gridApi.selection.on.rowSelectionChangedBatch(scope, () => { 
self.persistConfigWithGridState(self.config) })
+};
 
 if (!gridElem) {
   // create, compile and append grid elem
@@ -305,62 +350,14 @@ export default class TableVisualization 

zeppelin git commit: ZEPPELIN-3160. Fixed Checkstyle issues in kylin module

2018-03-29 Thread felixcheung
Repository: zeppelin
Updated Branches:
  refs/heads/master 930907959 -> d19b35abe


ZEPPELIN-3160. Fixed Checkstyle issues in kylin module

### What is this PR for?
Fixed the Checkstyle issues in the kylin module.

### What type of PR is it?
Improvement

### Todos
* [ ] - Task

### What is the Jira issue?
* https://issues.apache.org/jira/browse/ZEPPELIN-3160

### How should this be tested?
* CI pass

### Screenshots (if appropriate)

### Questions:
* Does the licenses files need update? no
* Is there breaking changes for older versions? no
* Does this needs documentation? no

Author: Jan Hentschel 

Closes #2895 from HorizonNet/ZEPPELIN-3160 and squashes the following commits:

d01830b [Jan Hentschel] ZEPPELIN-3160. Reverted package-lock.json
455c54d [Jan Hentschel] ZEPPELIN-3160. Fixed Checkstyle issues in kylin module


Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/d19b35ab
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/d19b35ab
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/d19b35ab

Branch: refs/heads/master
Commit: d19b35abe256513a07ebae1e63cc1e17b8091dd3
Parents: 9309079
Author: Jan Hentschel 
Authored: Tue Mar 27 12:22:44 2018 +0200
Committer: Felix Cheung 
Committed: Wed Mar 28 23:39:33 2018 -0700

--
 kylin/pom.xml   |  10 +-
 .../zeppelin/kylin/KylinErrorResponse.java  |   3 +-
 .../apache/zeppelin/kylin/KylinInterpreter.java |  10 +-
 .../zeppelin/kylin/KylinInterpreterTest.java| 160 ++-
 4 files changed, 95 insertions(+), 88 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/d19b35ab/kylin/pom.xml
--
diff --git a/kylin/pom.xml b/kylin/pom.xml
index 6d78fdf..b70bfb2 100644
--- a/kylin/pom.xml
+++ b/kylin/pom.xml
@@ -73,7 +73,13 @@
 
 maven-resources-plugin
 
+
+org.apache.maven.plugins
+maven-checkstyle-plugin
+
+false
+
+
 
 
-
-
+
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/d19b35ab/kylin/src/main/java/org/apache/zeppelin/kylin/KylinErrorResponse.java
--
diff --git 
a/kylin/src/main/java/org/apache/zeppelin/kylin/KylinErrorResponse.java 
b/kylin/src/main/java/org/apache/zeppelin/kylin/KylinErrorResponse.java
index 00439e8..04d0479 100644
--- a/kylin/src/main/java/org/apache/zeppelin/kylin/KylinErrorResponse.java
+++ b/kylin/src/main/java/org/apache/zeppelin/kylin/KylinErrorResponse.java
@@ -34,7 +34,7 @@ class KylinErrorResponse implements JsonSerializable {
   private Object data;
   private String msg;
 
-  public KylinErrorResponse(String stacktrace, String exception, String url,
+  KylinErrorResponse(String stacktrace, String exception, String url,
   String code, Object data, String msg) {
 this.stacktrace = stacktrace;
 this.exception = exception;
@@ -59,5 +59,4 @@ class KylinErrorResponse implements JsonSerializable {
   return null;
 }
   }
-
 }

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/d19b35ab/kylin/src/main/java/org/apache/zeppelin/kylin/KylinInterpreter.java
--
diff --git 
a/kylin/src/main/java/org/apache/zeppelin/kylin/KylinInterpreter.java 
b/kylin/src/main/java/org/apache/zeppelin/kylin/KylinInterpreter.java
index c7cd689..444f5cb 100755
--- a/kylin/src/main/java/org/apache/zeppelin/kylin/KylinInterpreter.java
+++ b/kylin/src/main/java/org/apache/zeppelin/kylin/KylinInterpreter.java
@@ -24,10 +24,6 @@ import org.apache.http.client.HttpClient;
 import org.apache.http.client.methods.HttpPost;
 import org.apache.http.entity.StringEntity;
 import org.apache.http.impl.client.HttpClientBuilder;
-import org.apache.zeppelin.interpreter.Interpreter;
-import org.apache.zeppelin.interpreter.InterpreterContext;
-import org.apache.zeppelin.interpreter.InterpreterResult;
-import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -37,6 +33,11 @@ import java.util.Properties;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import org.apache.zeppelin.interpreter.Interpreter;
+import org.apache.zeppelin.interpreter.InterpreterContext;
+import org.apache.zeppelin.interpreter.InterpreterResult;
+import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
+
 /**
  * Kylin interpreter for Zeppelin. (http://kylin.apache.org)
  */
@@ -233,5 +234,4 @@ public class