pan3793 commented on code in PR #4668:
URL: https://github.com/apache/zeppelin/pull/4668#discussion_r1352304028


##########
zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/launcher/SparkInterpreterLauncher.java:
##########
@@ -294,37 +292,17 @@ private String detectSparkScalaVersion(String sparkHome, 
Map<String, String> env
   }
 
   private String detectSparkScalaVersionByReplClass(String sparkHome) throws 
Exception {
-    File sparkLibFolder = new File(sparkHome + "/lib");
-    if (sparkLibFolder.exists()) {
-      // spark 1.6 if spark/lib exists
-      File[] sparkAssemblyJars = new File(sparkHome + "/lib").listFiles(new 
FilenameFilter() {
-        @Override
-        public boolean accept(File dir, String name) {
-          return name.contains("spark-assembly");
-        }
-      });
-      if (sparkAssemblyJars.length == 0) {
-        throw new Exception("No spark assembly file found in SPARK_HOME: " + 
sparkHome);
-      }
-      if (sparkAssemblyJars.length > 1) {
-        throw new Exception("Multiple spark assembly file found in SPARK_HOME: 
" + sparkHome);
-      }
-      try (URLClassLoader urlClassLoader = new URLClassLoader(new 
URL[]{sparkAssemblyJars[0].toURI().toURL()});){
-        urlClassLoader.loadClass("org.apache.spark.repl.SparkCommandLine");
-        return "2.10";
-      } catch (ClassNotFoundException e) {
-        return "2.11";
-      }
+    File sparkJarsFolder = new File(sparkHome + "/jars");
+    boolean sparkRepl212Exists =
+            Stream.of(sparkJarsFolder.listFiles()).anyMatch(file -> 
file.getName().contains("spark-repl_2.12"));
+    boolean sparkRepl213Exists =
+            Stream.of(sparkJarsFolder.listFiles()).anyMatch(file -> 
file.getName().contains("spark-repl_2.13"));
+    if (sparkRepl212Exists) {

Review Comment:
   added check code in 
https://github.com/apache/zeppelin/pull/4668/commits/0c30040a2766221542b9363abbd53974666bb2c0



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to