Repository: zeppelin Updated Branches: refs/heads/branch-0.8 28dc47da2 -> 0211590ab
ZEPPELIN-3328. Add plotting test for LivyInterpreter ### What is this PR for? Add plotting for LivyInterpreter (Python & R) ### What type of PR is it? [Improvement] ### Todos * [ ] - Task ### What is the Jira issue? * https://issues.apache.org/jira/browse/ZEPPELIN-3328 ### 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 <zjf...@apache.org> Closes #2866 from zjffdu/ZEPPELIN-3328 and squashes the following commits: fd394e3 [Jeff Zhang] ZEPPELIN-3328. Add plotting test for LivyInterpreter (cherry picked from commit 9ec6eb5a4e422e4ac73a97e38e47512811d5b29d) Signed-off-by: Jeff Zhang <zjf...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/0211590a Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/0211590a Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/0211590a Branch: refs/heads/branch-0.8 Commit: 0211590ab5ea8fce2dbcc0de991fcf895170360e Parents: 28dc47d Author: Jeff Zhang <zjf...@apache.org> Authored: Wed Mar 14 13:27:09 2018 +0800 Committer: Jeff Zhang <zjf...@apache.org> Committed: Wed Mar 14 14:44:26 2018 +0800 ---------------------------------------------------------------------- .../apache/zeppelin/livy/LivyInterpreterIT.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0211590a/livy/src/test/java/org/apache/zeppelin/livy/LivyInterpreterIT.java ---------------------------------------------------------------------- diff --git a/livy/src/test/java/org/apache/zeppelin/livy/LivyInterpreterIT.java b/livy/src/test/java/org/apache/zeppelin/livy/LivyInterpreterIT.java index 0c8bea9..c7fbc8d 100644 --- a/livy/src/test/java/org/apache/zeppelin/livy/LivyInterpreterIT.java +++ b/livy/src/test/java/org/apache/zeppelin/livy/LivyInterpreterIT.java @@ -750,6 +750,26 @@ public class LivyInterpreterIT { assertEquals(1, result.message().size()); assertTrue(result.message().get(0).getData().contains("col_1 col_2\n1 hello 20")); } + + // test plotting of python + result = pysparkInterpreter.interpret( + "import matplotlib.pyplot as plt\n" + + "plt.switch_backend('agg')\n" + + "data=[1,2,3,4]\n" + + "plt.figure()\n" + + "plt.plot(data)\n" + + "%matplot plt", context); + assertEquals(InterpreterResult.Code.SUCCESS, result.code()); + assertEquals(1, result.message().size()); + assertEquals(InterpreterResult.Type.IMG, result.message().get(0).getType()); + + // test plotting of R + result = sparkRInterpreter.interpret( + "hist(mtcars$mpg)", context); + assertEquals(InterpreterResult.Code.SUCCESS, result.code()); + assertEquals(1, result.message().size()); + assertEquals(InterpreterResult.Type.IMG, result.message().get(0).getType()); + } finally { sparkInterpreter.close(); sqlInterpreter.close();