You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zeppelin.apache.org by GitBox <gi...@apache.org> on 2020/03/27 06:47:28 UTC

[GitHub] [zeppelin] zjffdu commented on a change in pull request #3696: [ZEPPELIN-4692]. zeppelin pyspark doesn't print java output

zjffdu 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_r399064011
 
 

 ##########
 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:
   They are here https://github.com/apache/zeppelin/blob/master/spark/interpreter/src/main/java/org/apache/zeppelin/spark/PySparkInterpreter.java#L133

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services