From ae0bd0e8fb45c3e23557db8d03460dec79fbe4a8 Mon Sep 17 00:00:00 2001 From: HyukjinKwon Date: Mon, 27 Jul 2020 17:23:52 +0900 Subject: [PATCH] Fix load-spark-env.cmd to be able to run in Windows properly --- bin/load-spark-env.cmd | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/bin/load-spark-env.cmd b/bin/load-spark-env.cmd index ebbde66153e14..6cb8bf7fc7a21 100644 --- a/bin/load-spark-env.cmd +++ b/bin/load-spark-env.cmd @@ -22,7 +22,7 @@ rem spark-env.cmd is loaded from SPARK_CONF_DIR if set, or within the current di rem conf\ subdirectory. set SPARK_ENV_CMD=spark-env.cmd -if [%SPARK_ENV_LOADED%] == [] ( +if not defined SPARK_ENV_LOADED ( set SPARK_ENV_LOADED=1 if [%SPARK_CONF_DIR%] == [] ( @@ -37,18 +37,19 @@ if [%SPARK_ENV_LOADED%] == [] ( rem Setting SPARK_SCALA_VERSION if not already set. -if [%SPARK_SCALA_VERSION%] == [] ( - set SCALA_VERSION_1=2.13 - set SCALA_VERSION_2=2.12 +set SCALA_VERSION_1=2.13 +set SCALA_VERSION_2=2.12 - set ASSEMBLY_DIR1=%SPARK_HOME%\assembly\target\scala-%SCALA_VERSION_1% - set ASSEMBLY_DIR2=%SPARK_HOME%\assembly\target\scala-%SCALA_VERSION_2% - set ENV_VARIABLE_DOC=https://spark.apache.org/docs/latest/configuration.html#environment-variables +set ASSEMBLY_DIR1=%SPARK_HOME%\assembly\target\scala-%SCALA_VERSION_1% +set ASSEMBLY_DIR2=%SPARK_HOME%\assembly\target\scala-%SCALA_VERSION_2% +set ENV_VARIABLE_DOC=https://spark.apache.org/docs/latest/configuration.html#environment-variables + +if not defined SPARK_SCALA_VERSION ( if exist %ASSEMBLY_DIR2% if exist %ASSEMBLY_DIR1% ( - echo "Presence of build for multiple Scala versions detected (%ASSEMBLY_DIR1% and %ASSEMBLY_DIR2%)." - echo "Remove one of them or, set SPARK_SCALA_VERSION=%SCALA_VERSION_1% in %SPARK_ENV_CMD%." - echo "Visit %ENV_VARIABLE_DOC% for more details about setting environment variables in spark-env.cmd." - echo "Either clean one of them or, set SPARK_SCALA_VERSION in spark-env.cmd." + echo Presence of build for multiple Scala versions detected ^(%ASSEMBLY_DIR1% and %ASSEMBLY_DIR2%^). + echo Remove one of them or, set SPARK_SCALA_VERSION=%SCALA_VERSION_1% in spark-env.cmd. + echo Visit %ENV_VARIABLE_DOC% for more details about setting environment variables in spark-env.cmd. + echo Either clean one of them or, set SPARK_SCALA_VERSION in spark-env.cmd. exit 1 ) if exist %ASSEMBLY_DIR1% (