Repository: zeppelin Updated Branches: refs/heads/master 50356437d -> cf3127561
[zeppelin-3625] Pandasql interpreter fails to query over python interpreter dataframe ### What is this PR for? fix pandasql query over dataframe for `master`. the reason is that it can't load `bootstrap_sql.py` from resources because path of path ### What type of PR is it? [Bug Fix] ### Todos * [x] - fix path to use relative * [x] - enable tests ### What is the Jira issue? https://issues.apache.org/jira/browse/ZEPPELIN-3625 ### How should this be tested? follow the steps in issue ### Screenshots (if appropriate) before: <img width="1268" alt="screen shot 2018-07-15 at 7 08 24 pm" src="https://user-images.githubusercontent.com/1642088/42732816-822682f0-8862-11e8-9d55-dd7d00b09b48.png"> after: <img width="1239" alt="screen shot 2018-07-15 at 7 03 59 pm" src="https://user-images.githubusercontent.com/1642088/42732771-e712f848-8861-11e8-9ab9-eeb479082d1d.png"> ### Questions: * Does the licenses files need update? * Is there breaking changes for older versions? * Does this needs documentation? Author: Khalid Huseynov <[email protected]> Closes #3071 from khalidhuseynov/fix-master/ZEPPELIN-3625 and squashes the following commits: 33aad7589 [Khalid Huseynov] fix matplotlib test f94139b33 [Khalid Huseynov] enable all python tests fd5685552 [Khalid Huseynov] remove unnecessary test bde2316c7 [Khalid Huseynov] add test 8f9541411 [Khalid Huseynov] fix test setup not to interpret empty line 3a561d247 [Khalid Huseynov] fix from absolute to relative path in resources Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/cf312756 Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/cf312756 Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/cf312756 Branch: refs/heads/master Commit: cf3127561c4212e9299ffcaffc95b37cd7fe9781 Parents: 5035643 Author: Khalid Huseynov <[email protected]> Authored: Mon Jul 16 16:46:57 2018 +0900 Committer: Jongyoul Lee <[email protected]> Committed: Fri Jul 20 08:00:59 2018 +0900 ---------------------------------------------------------------------- python/pom.xml | 5 ----- .../org/apache/zeppelin/python/PythonInterpreterPandasSql.java | 2 +- .../apache/zeppelin/python/PythonInterpreterMatplotlibTest.java | 4 ++++ .../apache/zeppelin/python/PythonInterpreterPandasSqlTest.java | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zeppelin/blob/cf312756/python/pom.xml ---------------------------------------------------------------------- diff --git a/python/pom.xml b/python/pom.xml index 06c1a78..9f56d80 100644 --- a/python/pom.xml +++ b/python/pom.xml @@ -35,11 +35,6 @@ <properties> <interpreter.name>python</interpreter.name> <python.py4j.version>0.10.7</python.py4j.version> - <python.test.exclude> - **/PythonInterpreterWithPythonInstalledTest.java, - **/PythonInterpreterPandasSqlTest.java, - **/PythonInterpreterMatplotlibTest.java - </python.test.exclude> <grpc.version>1.4.0</grpc.version> <plugin.shade.version>2.4.1</plugin.shade.version> </properties> http://git-wip-us.apache.org/repos/asf/zeppelin/blob/cf312756/python/src/main/java/org/apache/zeppelin/python/PythonInterpreterPandasSql.java ---------------------------------------------------------------------- diff --git a/python/src/main/java/org/apache/zeppelin/python/PythonInterpreterPandasSql.java b/python/src/main/java/org/apache/zeppelin/python/PythonInterpreterPandasSql.java index 644a193..85783ce 100644 --- a/python/src/main/java/org/apache/zeppelin/python/PythonInterpreterPandasSql.java +++ b/python/src/main/java/org/apache/zeppelin/python/PythonInterpreterPandasSql.java @@ -37,7 +37,7 @@ import java.util.Properties; public class PythonInterpreterPandasSql extends Interpreter { private static final Logger LOG = LoggerFactory.getLogger(PythonInterpreterPandasSql.class); - private String SQL_BOOTSTRAP_FILE_PY = "/python/bootstrap_sql.py"; + private String SQL_BOOTSTRAP_FILE_PY = "python/bootstrap_sql.py"; public PythonInterpreterPandasSql(Properties property) { super(property); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/cf312756/python/src/test/java/org/apache/zeppelin/python/PythonInterpreterMatplotlibTest.java ---------------------------------------------------------------------- diff --git a/python/src/test/java/org/apache/zeppelin/python/PythonInterpreterMatplotlibTest.java b/python/src/test/java/org/apache/zeppelin/python/PythonInterpreterMatplotlibTest.java index b6e1a44..8326612 100644 --- a/python/src/test/java/org/apache/zeppelin/python/PythonInterpreterMatplotlibTest.java +++ b/python/src/test/java/org/apache/zeppelin/python/PythonInterpreterMatplotlibTest.java @@ -17,6 +17,7 @@ package org.apache.zeppelin.python; +import org.apache.zeppelin.display.AngularObjectRegistry; import org.apache.zeppelin.interpreter.Interpreter; import org.apache.zeppelin.interpreter.InterpreterContext; import org.apache.zeppelin.interpreter.InterpreterException; @@ -65,7 +66,10 @@ public class PythonInterpreterMatplotlibTest implements InterpreterOutputListene context = InterpreterContext.builder() .setInterpreterOut(out) + .setAngularObjectRegistry(new AngularObjectRegistry(intpGroup.getId(), null)) .build(); + InterpreterContext.set(context); + python.open(); } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/cf312756/python/src/test/java/org/apache/zeppelin/python/PythonInterpreterPandasSqlTest.java ---------------------------------------------------------------------- diff --git a/python/src/test/java/org/apache/zeppelin/python/PythonInterpreterPandasSqlTest.java b/python/src/test/java/org/apache/zeppelin/python/PythonInterpreterPandasSqlTest.java index 9255ad9..8f6cab2 100644 --- a/python/src/test/java/org/apache/zeppelin/python/PythonInterpreterPandasSqlTest.java +++ b/python/src/test/java/org/apache/zeppelin/python/PythonInterpreterPandasSqlTest.java @@ -86,7 +86,7 @@ public class PythonInterpreterPandasSqlTest implements InterpreterOutputListener // to make sure python is running. - InterpreterResult ret = python.interpret("\n", context); + InterpreterResult ret = python.interpret("print(\"python initialized\")\n", context); assertEquals(ret.message().toString(), InterpreterResult.Code.SUCCESS, ret.code()); sql.open();
