mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
ZEPPELIN-2407. Livy Interpreter always return plain text result
This commit is contained in:
parent
540ceb87d8
commit
ba59a77721
2 changed files with 16 additions and 2 deletions
|
|
@ -371,7 +371,7 @@ public abstract class BaseLivyInterprereter extends Interpreter {
|
|||
|
||||
if (displayAppInfo) {
|
||||
InterpreterResult interpreterResult = new InterpreterResult(InterpreterResult.Code.SUCCESS);
|
||||
interpreterResult.add(InterpreterResult.Type.TEXT, result);
|
||||
interpreterResult.add(result);
|
||||
String appInfoHtml = "<hr/>Spark Application Id: " + sessionInfo.appId + "<br/>"
|
||||
+ "Spark WebUI: <a href=\"" + sessionInfo.webUIAddress + "\">"
|
||||
+ sessionInfo.webUIAddress + "</a>";
|
||||
|
|
|
|||
|
|
@ -145,6 +145,13 @@ public class LivyInterpreterIT {
|
|||
assertTrue(result.message().get(0).getData().contains("defined object Person"));
|
||||
}
|
||||
|
||||
// html output
|
||||
String htmlCode = "println(\"%html <h1> hello </h1>\")";
|
||||
result = sparkInterpreter.interpret(htmlCode, context);
|
||||
assertEquals(InterpreterResult.Code.SUCCESS, result.code());
|
||||
assertEquals(1, result.message().size());
|
||||
assertEquals(InterpreterResult.Type.HTML, result.message().get(0).getType());
|
||||
|
||||
// error
|
||||
result = sparkInterpreter.interpret("println(a)", context);
|
||||
assertEquals(InterpreterResult.Code.ERROR, result.code());
|
||||
|
|
@ -544,8 +551,15 @@ public class LivyInterpreterIT {
|
|||
InterpreterResult result = sparkInterpreter.interpret("sc.version", context);
|
||||
assertEquals(InterpreterResult.Code.SUCCESS, result.code());
|
||||
assertEquals(2, result.message().size());
|
||||
|
||||
assertTrue(result.message().get(1).getData().contains("Spark Application Id"));
|
||||
|
||||
// html output
|
||||
String htmlCode = "println(\"%html <h1> hello </h1>\")";
|
||||
result = sparkInterpreter.interpret(htmlCode, context);
|
||||
assertEquals(InterpreterResult.Code.SUCCESS, result.code());
|
||||
assertEquals(2, result.message().size());
|
||||
assertEquals(InterpreterResult.Type.HTML, result.message().get(0).getType());
|
||||
|
||||
} finally {
|
||||
sparkInterpreter.close();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue