alexott commented on a change in pull request #3696: [ZEPPELIN-4692]. zeppelin 
pyspark doesn't print java output
URL: https://github.com/apache/zeppelin/pull/3696#discussion_r398582974
 
 

 ##########
 File path: 
spark/interpreter/src/main/java/org/apache/zeppelin/spark/PySparkInterpreter.java
 ##########
 @@ -125,8 +127,18 @@ protected ZeppelinContext createZeppelinContext() {
   @Override
   public InterpreterResult interpret(String st, InterpreterContext context)
       throws InterpreterException {
-    Utils.printDeprecateMessage(sparkInterpreter.getSparkVersion(), context, 
properties);
-    return super.interpret(st, context);
+    // redirect java stdout/stdout to interpreter output. Because pyspark may 
call java code.
+    PrintStream originalStdout = System.out;
+    PrintStream originalStderr = System.err;
+    try {
+      System.setOut(new PrintStream(context.out));
+      System.setErr(new PrintStream(context.out));
+      Utils.printDeprecateMessage(sparkInterpreter.getSparkVersion(), context, 
properties);
+      return super.interpret(st, context);
 
 Review comment:
   Shouldn't we set pool, job group, etc., like in IPython interpreter?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to