You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/08/16 09:41:40 UTC

[GitHub] [spark] HyukjinKwon commented on a change in pull request #25472: [SPARK-28756][R] Fix checkJavaVersion to accept JDK8+

HyukjinKwon commented on a change in pull request #25472: [SPARK-28756][R] Fix checkJavaVersion to accept JDK8+
URL: https://github.com/apache/spark/pull/25472#discussion_r314652011
 
 

 ##########
 File path: R/pkg/R/client.R
 ##########
 @@ -91,10 +91,15 @@ checkJavaVersion <- function() {
       }, javaVersionOut)
 
   javaVersionStr <- strsplit(javaVersionFilter[[1]], "[\"]")[[1L]][2]
-  # javaVersionStr is of the form 1.8.0_92.
-  # Extract 8 from it to compare to sparkJavaVersion
-  javaVersionNum <- as.integer(strsplit(javaVersionStr, "[.]")[[1L]][2])
-  if (javaVersionNum != sparkJavaVersion) {
+  # javaVersionStr is of the form 1.8.0_92/9.0.x/11.0.x.
+  # We are using 8, 9, 10, 11 for sparkJavaVersion.
+  versions = strsplit(javaVersionStr, "[.]")[[1L]]
+  if ("1" == versions[1]) {
+      javaVersionNum <- as.integer(versions[2])
+  } else {
+      javaVersionNum <- as.integer(versions[1])
+  }
+  if (javaVersionNum < sparkJavaVersion) {
     stop(paste("Java version", sparkJavaVersion, "is required for this package; found version:",
 
 Review comment:
   nit: `stop(paste("Java version", sparkJavaVersion, ", or greater, is required for this package; found version:",`

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org