Skip to content

Commit 36191a4

Browse files
committed
root cause - empty line execution
Root Cause Analysis: Livy Scala 2.13 Statement Execution Failure Prophecy's Scala init code (DetectSparkProvider) contains blank lines (\n\n) between statements — e.g., between the closing } of the object definition and the DetectSparkProvider.detectSparkProvider() call. Livy's AbstractSparkInterpreter.executeLines() splits submitted code by \n and interprets each line individually via IMain.interpret(). When it encounters an empty line (""), the Scala 2.13 REPL (rewritten with JLine 3 in scala/scala#8036) returns Results.Error for the empty input, whereas the Scala 2.12 REPL silently accepted it. This caused executeLines to immediately return ExecuteError("Error", "", []) — the exact empty-error response observed. Manual curl tests passed because they used single \n (no blank lines). The fix skips blank/empty lines in executeLine(), treating them as no-ops, consistent with standard REPL :paste mode semantics.
1 parent df978da commit 36191a4

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

repl/src/main/scala/org/apache/livy/repl/AbstractSparkInterpreter.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,9 @@ abstract class AbstractSparkInterpreter extends Interpreter with Logging {
297297
}
298298

299299
private def executeLine(code: String): Interpreter.ExecuteResponse = {
300-
if (code.trim.isEmpty) {
300+
val trimmed = code.trim
301+
if (trimmed.isEmpty || trimmed.startsWith("//") ||
302+
(trimmed.startsWith("/*") && trimmed.endsWith("*/"))) {
301303
return Interpreter.ExecuteSuccess(TEXT_PLAIN -> "")
302304
}
303305
code match {

0 commit comments

Comments
 (0)