Skip to content

Commit 2121071

Browse files
pwendellScrapCodes
authored andcommitted
Migrating version detection to PySpark
1 parent b1ed44d commit 2121071

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

bin/pyspark

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,23 @@ export SPARK_HOME="$FWDIR"
2525

2626
source "$FWDIR/bin/utils.sh"
2727

28-
SPARK_SCALA_VERSION=2.10
28+
if [ -z "$SPARK_SCALA_VERSION" ]; then
29+
30+
ASSEMBLY_DIR2="$FWDIR/assembly/target/scala-2.11"
31+
ASSEMBLY_DIR1="$FWDIR/assembly/target/scala-2.10"
32+
33+
if [[ -d "$ASSEMBLY_DIR2" && -d "$ASSEMBLY_DIR1" ]]; then
34+
echo -e "Presence of build for both scala versions(SCALA 2.10 and SCALA 2.11) detected." 1>&2
35+
echo -e 'Either clean one of them or, export SPARK_SCALA_VERSION=2.11 in spark-env.sh.' 1>&2
36+
exit 1
37+
fi
38+
39+
if [ -d "$ASSEMBLY_DIR2" ]; then
40+
SPARK_SCALA_VERSION="2.11"
41+
else
42+
SPARK_SCALA_VERSION="2.10"
43+
fi
44+
fi
2945

3046
function usage() {
3147
echo "Usage: ./bin/pyspark [options]" 1>&2

0 commit comments

Comments
 (0)