mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
Now seem to be getting the console out, but only for last line. Will need some debugging.
This commit is contained in:
parent
35fc032d7e
commit
e13576fcfe
2 changed files with 14 additions and 2 deletions
|
|
@ -35,6 +35,7 @@
|
|||
|
||||
<properties>
|
||||
<scala.version>2.10.5</scala.version>
|
||||
<hadoop.version>2.5.0</hadoop.version>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
|
|
@ -104,6 +105,12 @@
|
|||
<artifactId>scala-reflect</artifactId>
|
||||
<version>${scala.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.hadoop</groupId>
|
||||
<artifactId>hadoop-client</artifactId>
|
||||
<version>${hadoop.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import com.twitter.scalding.ScaldingILoop;
|
||||
|
||||
import scala.Console;
|
||||
import scala.Some;
|
||||
import scala.tools.nsc.Settings;
|
||||
import scala.tools.nsc.settings.MutableSettings.BooleanSetting;
|
||||
|
|
@ -56,9 +57,11 @@ public class ScaldingInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
private ScaldingILoop interpreter;
|
||||
private ByteArrayOutputStream out;
|
||||
|
||||
public ScaldingInterpreter(Properties property) {
|
||||
super(property);
|
||||
out = new ByteArrayOutputStream();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -177,6 +180,8 @@ public class ScaldingInterpreter extends Interpreter {
|
|||
}
|
||||
linesToRun[lines.length] = "print(\"\")";
|
||||
|
||||
Console.setOut(new PrintStream(out));
|
||||
out.reset();
|
||||
Code r = null;
|
||||
String incomplete = "";
|
||||
|
||||
|
|
@ -203,7 +208,7 @@ public class ScaldingInterpreter extends Interpreter {
|
|||
r = getResultCode(res);
|
||||
|
||||
if (r == Code.ERROR) {
|
||||
return new InterpreterResult(r);
|
||||
return new InterpreterResult(r, out.toString());
|
||||
} else if (r == Code.INCOMPLETE) {
|
||||
incomplete += s + "\n";
|
||||
} else {
|
||||
|
|
@ -214,7 +219,7 @@ public class ScaldingInterpreter extends Interpreter {
|
|||
if (r == Code.INCOMPLETE) {
|
||||
return new InterpreterResult(r, "Incomplete expression");
|
||||
} else {
|
||||
return new InterpreterResult(r);
|
||||
return new InterpreterResult(r, out.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue