felixcheung commented on a change in pull request #3375: ZEPPELIN-4176. Remove 
old spark interpreter
URL: https://github.com/apache/zeppelin/pull/3375#discussion_r291825774
 
 

 ##########
 File path: 
spark/interpreter/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java
 ##########
 @@ -50,46 +71,103 @@ public SparkInterpreter(Properties properties) {
     if 
(Boolean.parseBoolean(properties.getProperty("zeppelin.spark.scala.color", 
"true"))) {
       System.setProperty("scala.color", "true");
     }
-    if (Boolean.parseBoolean(properties.getProperty("zeppelin.spark.useNew", 
"false"))) {
-      delegation = new NewSparkInterpreter(properties);
-    } else {
-      delegation = new OldSparkInterpreter(properties);
-    }
-    delegation.setParentSparkInterpreter(this);
+    this.enableSupportedVersionCheck = java.lang.Boolean.parseBoolean(
+        properties.getProperty("zeppelin.spark.enableSupportedVersionCheck", 
"true"));
+    innerInterpreterClassMap.put("2.10", 
"org.apache.zeppelin.spark.SparkScala210Interpreter");
+    innerInterpreterClassMap.put("2.11", 
"org.apache.zeppelin.spark.SparkScala211Interpreter");
   }
 
   @Override
   public void open() throws InterpreterException {
-    delegation.setInterpreterGroup(getInterpreterGroup());
-    delegation.setUserName(getUserName());
-    delegation.setClassloaderUrls(getClassloaderUrls());
-
-    delegation.open();
+    try {
+      String scalaVersion = extractScalaVersion();
+      LOGGER.info("Using Scala Version: " + scalaVersion);
+      SparkConf conf = new SparkConf();
+      for (Map.Entry<Object, Object> entry : getProperties().entrySet()) {
+        if (!StringUtils.isBlank(entry.getValue().toString())) {
+          conf.set(entry.getKey().toString(), entry.getValue().toString());
+        }
+        // zeppelin.spark.useHiveContext & zeppelin.spark.concurrentSQL are 
legacy zeppelin
+        // properties, convert them to spark properties here.
+        if (entry.getKey().toString().equals("zeppelin.spark.useHiveContext")) 
{
+          conf.set("spark.useHiveContext", entry.getValue().toString());
+        }
+        if (entry.getKey().toString().equals("zeppelin.spark.concurrentSQL")
 
 Review comment:
   then maybe we should rename and deprecate this one in the next release. 
IIRC, people has complained about paragraph execution order changing and 
breaking stuff, so if this affects all spark interpreter and not just sql, it 
has a higher risk of that

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to