Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,39 @@ public class FlinkInterpreter extends Interpreter {

public FlinkInterpreter(Properties properties) {
super(properties);
this.innerIntp = new FlinkScalaInterpreter(getProperties());
}

private String extractScalaVersion() throws InterpreterException {
String scalaVersionString = scala.util.Properties.versionString();
LOGGER.info("Using Scala: " + scalaVersionString);
if (scalaVersionString.contains("version 2.10")) {
return "2.10";
} else if (scalaVersionString.contains("version 2.11")) {
return "2.11";
} else if (scalaVersionString.contains("version 2.12")) {
return "2.12";
} else {
throw new InterpreterException("Unsupported scala version: " + scalaVersionString);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we plan to support multiple Scala versions in the future, and have some functionality depending on it?
Otherwise I would maybe just implement something like "isSupportedScalaVersion" with one check for Scala 2.11 as of now.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed

}

@Override
public void open() throws InterpreterException {
String scalaVersion = extractScalaVersion();
if (!scalaVersion.equals("2.11")) {
throw new InterpreterException("Only scala 2.11 is supported for flink, " +
"but the current scala version is: " + scalaVersion);
}
this.innerIntp = new FlinkScalaInterpreter(getProperties());
this.innerIntp.open();
this.z = this.innerIntp.getZeppelinContext();
}

@Override
public void close() throws InterpreterException {
this.innerIntp.close();
if (this.innerIntp != null) {
this.innerIntp.close();
}
}

@Override
Expand Down