diff --git a/bin/load-spark-env.cmd b/bin/load-spark-env.cmd index 6cb8bf7fc7a2..fe725a4e1a36 100644 --- a/bin/load-spark-env.cmd +++ b/bin/load-spark-env.cmd @@ -21,7 +21,6 @@ rem This script loads spark-env.cmd if it exists, and ensures it is only loaded rem spark-env.cmd is loaded from SPARK_CONF_DIR if set, or within the current directory's rem conf\ subdirectory. -set SPARK_ENV_CMD=spark-env.cmd if not defined SPARK_ENV_LOADED ( set SPARK_ENV_LOADED=1 @@ -29,10 +28,7 @@ if not defined SPARK_ENV_LOADED ( set SPARK_CONF_DIR=%~dp0..\conf ) - set SPARK_ENV_CMD=%SPARK_CONF_DIR%\%SPARK_ENV_CMD% - if exist %SPARK_ENV_CMD% ( - call %SPARK_ENV_CMD% - ) + call :LoadSparkEnv ) rem Setting SPARK_SCALA_VERSION if not already set. @@ -59,3 +55,8 @@ if not defined SPARK_SCALA_VERSION ( ) ) exit /b 0 + +:LoadSparkEnv +if exist "%SPARK_CONF_DIR%\spark-env.cmd" ( + call "%SPARK_CONF_DIR%\spark-env.cmd" +)