This is an automated email from the ASF dual-hosted git repository. zjffdu pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/zeppelin.git
The following commit(s) were added to refs/heads/master by this push: new 28187a6 [ZEPPELIN-4408] Return exception message when Interpreter code is incomplete 28187a6 is described below commit 28187a6ae3da6052651c11636eb95316ee62a215 Author: amakaur <amandeep.k...@applovin.com> AuthorDate: Mon Nov 11 12:08:31 2019 -0800 [ZEPPELIN-4408] Return exception message when Interpreter code is incomplete ### What is this PR for? When there's a syntax error in your code such as missing a closing parentheses etc. an exception message "Incomplete expression" will be returned to make it easier to debug. Currently paragraph simply goes into finish state and makes it harder to know if the code is complete or not. ### What type of PR is it? Improvement ### What is the Jira issue? https://issues.apache.org/jira/browse/ZEPPELIN-4408 ### How should this be tested? - On Spark interpreter run (println("Hello World") ### Screenshots (if appropriate) ### Questions: * Does the licenses files need update? No * Is there breaking changes for older versions? No * Does this needs documentation? No Author: amakaur <amandeep.k...@applovin.com> Closes #3497 from amakaur/incomplete_expression_message and squashes the following commits: 210d0a0d8 [amakaur] Added unit test for incomplete expression 728bb1b5f [amakaur] Return Incomplete expression message when Interpreter Resut code is Incomplete to make it easier to debug vs simply finishing paragraph without any message --- .../test/java/org/apache/zeppelin/spark/SparkInterpreterTest.java | 1 + .../scala/org/apache/zeppelin/spark/BaseSparkScalaInterpreter.scala | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/spark/interpreter/src/test/java/org/apache/zeppelin/spark/SparkInterpreterTest.java b/spark/interpreter/src/test/java/org/apache/zeppelin/spark/SparkInterpreterTest.java index 1feb002..6a03b69 100644 --- a/spark/interpreter/src/test/java/org/apache/zeppelin/spark/SparkInterpreterTest.java +++ b/spark/interpreter/src/test/java/org/apache/zeppelin/spark/SparkInterpreterTest.java @@ -105,6 +105,7 @@ public class SparkInterpreterTest { // incomplete result = interpreter.interpret("println(a", getInterpreterContext()); assertEquals(InterpreterResult.Code.INCOMPLETE, result.code()); + assertEquals("Incomplete expression", result.message()); // syntax error result = interpreter.interpret("println(b)", getInterpreterContext()); diff --git a/spark/spark-scala-parent/src/main/scala/org/apache/zeppelin/spark/BaseSparkScalaInterpreter.scala b/spark/spark-scala-parent/src/main/scala/org/apache/zeppelin/spark/BaseSparkScalaInterpreter.scala index bed2ee4..11ae461 100644 --- a/spark/spark-scala-parent/src/main/scala/org/apache/zeppelin/spark/BaseSparkScalaInterpreter.scala +++ b/spark/spark-scala-parent/src/main/scala/org/apache/zeppelin/spark/BaseSparkScalaInterpreter.scala @@ -138,7 +138,10 @@ abstract class BaseSparkScalaInterpreter(val conf: SparkConf, InterpreterResult.Code.INCOMPLETE } - new InterpreterResult(lastStatus) + lastStatus match { + case InterpreterResult.Code.INCOMPLETE => new InterpreterResult( lastStatus, "Incomplete expression" ) + case _ => new InterpreterResult(lastStatus) + } } protected def interpret(code: String): InterpreterResult =