aboutsummaryrefslogtreecommitdiff
path: root/R/pkg/R/sparkR.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/pkg/R/sparkR.R')
-rw-r--r--R/pkg/R/sparkR.R17
1 files changed, 17 insertions, 0 deletions
diff --git a/R/pkg/R/sparkR.R b/R/pkg/R/sparkR.R
index 524f7c4a26..f8bdee739e 100644
--- a/R/pkg/R/sparkR.R
+++ b/R/pkg/R/sparkR.R
@@ -365,6 +365,23 @@ sparkR.session <- function(
}
overrideEnvs(sparkConfigMap, paramMap)
}
+ # do not download if it is run in the sparkR shell
+ if (!nzchar(master) || is_master_local(master)) {
+ if (!is_sparkR_shell()) {
+ if (is.na(file.info(sparkHome)$isdir)) {
+ msg <- paste0("Spark not found in SPARK_HOME: ",
+ sparkHome,
+ " .\nTo search in the cache directory. ",
+ "Installation will start if not found.")
+ message(msg)
+ packageLocalDir <- install.spark()
+ sparkHome <- packageLocalDir
+ } else {
+ msg <- paste0("Spark package is found in SPARK_HOME: ", sparkHome)
+ message(msg)
+ }
+ }
+ }
if (!exists(".sparkRjsc", envir = .sparkREnv)) {
sparkExecutorEnvMap <- new.env()