Repository: zeppelin Updated Branches: refs/heads/master c45128e79 -> 6d590c40b
[HOTFIX] fix build spark and R interpreters ### What is this PR for? Fix build interpreters (apark and R) which broken after https://github.com/apache/zeppelin/pull/2592 and https://github.com/apache/zeppelin/pull/2596 ### What type of PR is it? [Hot Fix] ### How should this be tested? build interpreters ### Questions: * Does the licenses files need update? no * Is there breaking changes for older versions? no * Does this needs documentation? no Author: tinkoff-dwh <[email protected]> Closes #2630 from tinkoff-dwh/fix_r_interpretator and squashes the following commits: 0c9828bb [tinkoff-dwh] [HOTFIX] fix build spark and R interpreters Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/6d590c40 Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/6d590c40 Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/6d590c40 Branch: refs/heads/master Commit: 6d590c40bea2f9d898de089730488fc7ab8d2059 Parents: c45128e Author: tinkoff-dwh <[email protected]> Authored: Tue Oct 24 18:30:58 2017 +0500 Committer: Jongyoul Lee <[email protected]> Committed: Tue Oct 24 23:18:33 2017 +0900 ---------------------------------------------------------------------- .../org/apache/zeppelin/rinterpreter/KnitR.java | 35 ++++++++++---------- .../org/apache/zeppelin/rinterpreter/RRepl.java | 35 ++++++++++---------- .../rinterpreter/KnitRInterpreter.scala | 6 ++-- .../zeppelin/rinterpreter/RInterpreter.scala | 2 +- .../rinterpreter/RReplInterpreter.scala | 8 ++--- .../rinterpreter/RInterpreterTest.scala | 2 +- .../apache/zeppelin/spark/SparkInterpreter.java | 2 +- 7 files changed, 46 insertions(+), 44 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zeppelin/blob/6d590c40/r/src/main/java/org/apache/zeppelin/rinterpreter/KnitR.java ---------------------------------------------------------------------- diff --git a/r/src/main/java/org/apache/zeppelin/rinterpreter/KnitR.java b/r/src/main/java/org/apache/zeppelin/rinterpreter/KnitR.java index bdc5b86..ab29efe 100644 --- a/r/src/main/java/org/apache/zeppelin/rinterpreter/KnitR.java +++ b/r/src/main/java/org/apache/zeppelin/rinterpreter/KnitR.java @@ -34,12 +34,12 @@ import java.util.Properties; public class KnitR extends Interpreter implements WrappedInterpreter { KnitRInterpreter intp; - public KnitR(Properties property, Boolean startSpark) { - super(property); - intp = new KnitRInterpreter(property, startSpark); + public KnitR(Properties properties, Boolean startSpark) { + super(properties); + intp = new KnitRInterpreter(properties, startSpark); } - public KnitR(Properties property) { - this(property, true); + public KnitR(Properties properties) { + this(properties, true); } public KnitR() { @@ -47,38 +47,39 @@ public class KnitR extends Interpreter implements WrappedInterpreter { } @Override - public void open() { + public void open() throws InterpreterException { intp.open(); } @Override - public void close() { + public void close() throws InterpreterException { intp.close(); } @Override - public InterpreterResult interpret(String s, InterpreterContext interpreterContext) { + public InterpreterResult interpret(String s, InterpreterContext interpreterContext) + throws InterpreterException { return intp.interpret(s, interpreterContext); } @Override - public void cancel(InterpreterContext interpreterContext) { + public void cancel(InterpreterContext interpreterContext) throws InterpreterException { intp.cancel(interpreterContext); } @Override - public FormType getFormType() { + public FormType getFormType() throws InterpreterException { return intp.getFormType(); } @Override - public int getProgress(InterpreterContext interpreterContext) { + public int getProgress(InterpreterContext interpreterContext) throws InterpreterException { return intp.getProgress(interpreterContext); } @Override public List<InterpreterCompletion> completion(String s, int i, - InterpreterContext interpreterContext) { + InterpreterContext interpreterContext) throws InterpreterException { List completion = intp.completion(s, i, interpreterContext); return completion; } @@ -94,14 +95,14 @@ public class KnitR extends Interpreter implements WrappedInterpreter { } @Override - public void setProperty(Properties property) { - super.setProperty(property); - intp.setProperty(property); + public void setProperties(Properties properties) { + super.setProperties(properties); + intp.setProperties(properties); } @Override - public Properties getProperty() { - return intp.getProperty(); + public Properties getProperties() { + return intp.getProperties(); } @Override http://git-wip-us.apache.org/repos/asf/zeppelin/blob/6d590c40/r/src/main/java/org/apache/zeppelin/rinterpreter/RRepl.java ---------------------------------------------------------------------- diff --git a/r/src/main/java/org/apache/zeppelin/rinterpreter/RRepl.java b/r/src/main/java/org/apache/zeppelin/rinterpreter/RRepl.java index 81891f8..bdf7dae 100644 --- a/r/src/main/java/org/apache/zeppelin/rinterpreter/RRepl.java +++ b/r/src/main/java/org/apache/zeppelin/rinterpreter/RRepl.java @@ -34,12 +34,12 @@ import java.util.Properties; public class RRepl extends Interpreter implements WrappedInterpreter { RReplInterpreter intp; - public RRepl(Properties property, Boolean startSpark) { - super(property); - intp = new RReplInterpreter(property, startSpark); + public RRepl(Properties properties, Boolean startSpark) { + super(properties); + intp = new RReplInterpreter(properties, startSpark); } - public RRepl(Properties property) { - this(property, true); + public RRepl(Properties properties) { + this(properties, true); } public RRepl() { @@ -47,38 +47,39 @@ public class RRepl extends Interpreter implements WrappedInterpreter { } @Override - public void open() { + public void open() throws InterpreterException { intp.open(); } @Override - public void close() { + public void close() throws InterpreterException { intp.close(); } @Override - public InterpreterResult interpret(String s, InterpreterContext interpreterContext) { + public InterpreterResult interpret(String s, InterpreterContext interpreterContext) + throws InterpreterException { return intp.interpret(s, interpreterContext); } @Override - public void cancel(InterpreterContext interpreterContext) { + public void cancel(InterpreterContext interpreterContext) throws InterpreterException { intp.cancel(interpreterContext); } @Override - public FormType getFormType() { + public FormType getFormType() throws InterpreterException { return intp.getFormType(); } @Override - public int getProgress(InterpreterContext interpreterContext) { + public int getProgress(InterpreterContext interpreterContext) throws InterpreterException { return intp.getProgress(interpreterContext); } @Override public List<InterpreterCompletion> completion(String s, int i, - InterpreterContext interpreterContext) { + InterpreterContext interpreterContext) throws InterpreterException { List completion = intp.completion(s, i, interpreterContext); return completion; } @@ -94,14 +95,14 @@ public class RRepl extends Interpreter implements WrappedInterpreter { } @Override - public void setProperty(Properties property) { - super.setProperty(property); - intp.setProperty(property); + public void setProperties(Properties properties) { + super.setProperties(properties); + intp.setProperties(properties); } @Override - public Properties getProperty() { - return intp.getProperty(); + public Properties getProperties() { + return intp.getProperties(); } @Override http://git-wip-us.apache.org/repos/asf/zeppelin/blob/6d590c40/r/src/main/scala/org/apache/zeppelin/rinterpreter/KnitRInterpreter.scala ---------------------------------------------------------------------- diff --git a/r/src/main/scala/org/apache/zeppelin/rinterpreter/KnitRInterpreter.scala b/r/src/main/scala/org/apache/zeppelin/rinterpreter/KnitRInterpreter.scala index bc779c7..64b1d26 100644 --- a/r/src/main/scala/org/apache/zeppelin/rinterpreter/KnitRInterpreter.scala +++ b/r/src/main/scala/org/apache/zeppelin/rinterpreter/KnitRInterpreter.scala @@ -27,9 +27,9 @@ import org.apache.zeppelin.interpreter.InterpreterResult import org.apache.zeppelin.rinterpreter.rscala.RException -class KnitRInterpreter(property: Properties, startSpark : Boolean = true) extends RInterpreter(property, startSpark) { - def this(property : Properties) = { - this(property, true) +class KnitRInterpreter(properties: Properties, startSpark : Boolean = true) extends RInterpreter(properties, startSpark) { + def this(properties : Properties) = { + this(properties, true) } override def open: Unit = { http://git-wip-us.apache.org/repos/asf/zeppelin/blob/6d590c40/r/src/main/scala/org/apache/zeppelin/rinterpreter/RInterpreter.scala ---------------------------------------------------------------------- diff --git a/r/src/main/scala/org/apache/zeppelin/rinterpreter/RInterpreter.scala b/r/src/main/scala/org/apache/zeppelin/rinterpreter/RInterpreter.scala index 9f5181d..0783f6c 100644 --- a/r/src/main/scala/org/apache/zeppelin/rinterpreter/RInterpreter.scala +++ b/r/src/main/scala/org/apache/zeppelin/rinterpreter/RInterpreter.scala @@ -41,7 +41,7 @@ abstract class RInterpreter(properties : Properties, startSpark : Boolean = true def getrContext: RContext = rContext - protected lazy val rContext : RContext = synchronized{ RContext(property, this.getInterpreterGroup().getId()) } + protected lazy val rContext : RContext = synchronized{ RContext(properties, this.getInterpreterGroup().getId()) } def open: Unit = rContext.synchronized { logger.trace("RInterpreter opening") http://git-wip-us.apache.org/repos/asf/zeppelin/blob/6d590c40/r/src/main/scala/org/apache/zeppelin/rinterpreter/RReplInterpreter.scala ---------------------------------------------------------------------- diff --git a/r/src/main/scala/org/apache/zeppelin/rinterpreter/RReplInterpreter.scala b/r/src/main/scala/org/apache/zeppelin/rinterpreter/RReplInterpreter.scala index 63be302..013ccd8 100644 --- a/r/src/main/scala/org/apache/zeppelin/rinterpreter/RReplInterpreter.scala +++ b/r/src/main/scala/org/apache/zeppelin/rinterpreter/RReplInterpreter.scala @@ -26,12 +26,12 @@ import org.apache.zeppelin.interpreter.InterpreterContext import org.apache.zeppelin.interpreter.InterpreterResult import org.apache.zeppelin.rinterpreter.rscala.RException -class RReplInterpreter(property: Properties, startSpark : Boolean = true) extends RInterpreter(property, startSpark) { +class RReplInterpreter(properties: Properties, startSpark : Boolean = true) extends RInterpreter(properties, startSpark) { - // protected val rContext : RContext = RContext(property) + // protected val rContext : RContext = RContext(properties) - def this(property : Properties) = { - this(property, true) + def this(properties : Properties) = { + this(properties, true) } private var firstCell : Boolean = true def interpret(st: String, context: InterpreterContext): InterpreterResult = { http://git-wip-us.apache.org/repos/asf/zeppelin/blob/6d590c40/r/src/test/scala/org/apache/zeppelin/rinterpreter/RInterpreterTest.scala ---------------------------------------------------------------------- diff --git a/r/src/test/scala/org/apache/zeppelin/rinterpreter/RInterpreterTest.scala b/r/src/test/scala/org/apache/zeppelin/rinterpreter/RInterpreterTest.scala index 7208516..443394c 100644 --- a/r/src/test/scala/org/apache/zeppelin/rinterpreter/RInterpreterTest.scala +++ b/r/src/test/scala/org/apache/zeppelin/rinterpreter/RInterpreterTest.scala @@ -85,7 +85,7 @@ class RInterpreterTest extends FlatSpec { it should "have persistent properties" in { val props = new Properties() props.setProperty("hello", "world") - rint.setProperty(props) + rint.setProperties(props) assertResult("world") { rint.getProperty("hello") } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/6d590c40/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java ---------------------------------------------------------------------- diff --git a/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java b/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java index 0536825..71a439f 100644 --- a/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java +++ b/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java @@ -932,7 +932,7 @@ public class SparkInterpreter extends Interpreter { return sparkUrl; } - String sparkUrlProp = property.getProperty("zeppelin.spark.uiWebUrl", ""); + String sparkUrlProp = getProperty("zeppelin.spark.uiWebUrl", ""); if (!StringUtils.isBlank(sparkUrlProp)) { return sparkUrlProp; }
