Update spark interpreter

This commit is contained in:
Lee moon soo 2016-02-07 10:12:14 +09:00
parent 366b651943
commit 58e5f917a4
3 changed files with 16 additions and 11 deletions

View file

@ -18,6 +18,7 @@
package org.apache.zeppelin.spark;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
@ -28,6 +29,7 @@ import java.util.*;
import com.google.common.base.Joiner;
import org.apache.commons.io.FileUtils;
import org.apache.spark.HttpServer;
import org.apache.spark.SparkConf;
import org.apache.spark.SparkContext;
@ -461,7 +463,10 @@ public class SparkInterpreter extends Interpreter {
b.v_$eq(true);
settings.scala$tools$nsc$settings$StandardScalaSettings$_setter_$usejavacp_$eq(b);
/* spark interpreter */
System.setProperty("scala.repl.name.line", "line" + this.hashCode() + "$");
/* create scala repl */
this.interpreter = new SparkILoop(null, new PrintWriter(out));
interpreter.settings_$eq(settings);

View file

@ -26,10 +26,7 @@ import java.util.Properties;
import org.apache.zeppelin.display.AngularObjectRegistry;
import org.apache.zeppelin.display.GUI;
import org.apache.zeppelin.interpreter.InterpreterContext;
import org.apache.zeppelin.interpreter.InterpreterContextRunner;
import org.apache.zeppelin.interpreter.InterpreterGroup;
import org.apache.zeppelin.interpreter.InterpreterResult;
import org.apache.zeppelin.interpreter.*;
import org.apache.zeppelin.interpreter.InterpreterResult.Code;
import org.junit.After;
import org.junit.Before;
@ -54,8 +51,9 @@ public class DepInterpreterTest {
dep.open();
InterpreterGroup intpGroup = new InterpreterGroup();
intpGroup.add(new SparkInterpreter(p));
intpGroup.add(dep);
intpGroup.put("note", new LinkedList<Interpreter>());
intpGroup.get("note").add(new SparkInterpreter(p));
intpGroup.get("note").add(dep);
dep.setInterpreterGroup(intpGroup);
context = new InterpreterContext("note", "id", "title", "text", new HashMap<String, Object>(), new GUI(),

View file

@ -57,14 +57,16 @@ public class SparkSqlInterpreterTest {
repl = SparkInterpreterTest.repl;
}
sql = new SparkSqlInterpreter(p);
sql = new SparkSqlInterpreter(p);
intpGroup = new InterpreterGroup();
intpGroup.add(repl);
intpGroup.add(sql);
intpGroup = new InterpreterGroup();
intpGroup.put("note", new LinkedList<Interpreter>());
intpGroup.get("note").add(repl);
intpGroup.get("note").add(sql);
sql.setInterpreterGroup(intpGroup);
sql.open();
}
context = new InterpreterContext("note", "id", "title", "text", new HashMap<String, Object>(), new GUI(),
new AngularObjectRegistry(intpGroup.getId(), null),
null,