Skip to content

Commit

Permalink
ZEPPELIN-3328. Add plotting test for LivyInterpreter
Browse files Browse the repository at this point in the history
### 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 <zjffdu@apache.org>

Closes apache#2866 from zjffdu/ZEPPELIN-3328 and squashes the following commits:

fd394e3 [Jeff Zhang] ZEPPELIN-3328. Add plotting test for LivyInterpreter
  • Loading branch information
zjffdu committed Mar 14, 2018
1 parent 514ba65 commit 9ec6eb5
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions livy/src/test/java/org/apache/zeppelin/livy/LivyInterpreterIT.java
Expand Up @@ -750,6 +750,26 @@ public void testSharedInterpreter() throws InterpreterException {
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();
Expand Down

0 comments on commit 9ec6eb5

Please sign in to comment.