Skip to content

Commit

Permalink
Merge pull request apache#103 from shivaram/rlibdir-fix
Browse files Browse the repository at this point in the history
[SPARKR-115] Allow users to set where SparkR is installed
  • Loading branch information
concretevitamin committed Nov 11, 2014
2 parents a21f146 + 18b9be1 commit e6fb999
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/R/sparkR.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,22 @@ sparkR.init <- function(
sparkHome = Sys.getenv("SPARK_HOME"),
sparkEnvir = list(),
sparkExecutorEnv = list(),
sparkJars = "") {
sparkJars = "",
sparkRLibDir = "") {

if (exists(".sparkRjsc", envir=.sparkREnv)) {
cat("Re-using existing Spark Context. Please restart R to create a new Spark Context\n")
return(get(".sparkRjsc", envir=.sparkREnv))
}

if (nchar(sparkHome) != 0) {
sparkHome <- normalizePath(sparkHome)
}

if (nchar(sparkRLibDir) != 0) {
.sparkREnv$libname <- sparkRLibDir
}

sparkEnvirMap <- .jnew("java/util/HashMap")
for (varname in names(sparkEnvir)) {
sparkEnvirMap$put(varname, sparkEnvir[[varname]])
Expand Down

0 comments on commit e6fb999

Please sign in to comment.