Github user shivaram commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21278#discussion_r187169358
  
    --- Diff: R/pkg/R/client.R ---
    @@ -60,13 +60,39 @@ generateSparkSubmitArgs <- function(args, sparkHome, 
jars, sparkSubmitOpts, pack
       combinedArgs
     }
     
    +checkJavaVersion <- function() {
    +  javaBin <- "java"
    +  javaHome <- Sys.getenv("JAVA_HOME")
    +  if (javaHome != "") {
    +    javaBin <- file.path(javaHome, javaBin)
    +  }
    +
    +  # If java is missing from PATH, we get an error in Unix and a warning in 
Windows
    +  javaVersionOut <- tryCatch(
    +      launchScript(javaBin, "-version", wait = TRUE, stdout = TRUE, stderr 
= TRUE),
    +                   error = function(e) {
    +                     stop("Java version check failed. Please make sure 
Java is installed",
    +                          " and set JAVA_HOME to point to the installation 
directory.")
    +                   },
    +                   warning = function(w) {
    +                     stop("Java version check failed. Please make sure 
Java is installed",
    +                          " and set JAVA_HOME to point to the installation 
directory.")
    +                   })
    +  javaVersionStr <- strsplit(javaVersionOut[[1]], "[\"]")[[1L]][2]
    +  javaVersionNum <- as.numeric(paste0(strsplit(javaVersionStr, 
"[.]")[[1L]][1:2], collapse = "."))
    +  if(javaVersionNum < 1.8) {
    +    stop(paste("Java 8, or greater, is required for this package; found 
version:", javaVersionNum))
    --- End diff --
    
    I changed this to javaVersionStr. In addition I parsed the requirements 
field -- more details on this below


---

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

Reply via email to