@@ -25,31 +25,49 @@ SCALA_VERSION=2.10
2525# Figure out where Spark is installed
2626FWDIR=" $( cd ` dirname $0 ` /..; pwd) "
2727
28- # Load environment variables from conf/spark-env.sh, if it exists
29- if [ -e " $FWDIR /conf/spark-env.sh" ] ; then
30- . $FWDIR /conf/spark-env.sh
31- fi
28+ . $FWDIR /bin/load-spark-env.sh
3229
3330# Build up classpath
3431CLASSPATH=" $SPARK_CLASSPATH :$FWDIR /conf"
3532
33+ # Support for interacting with Hive. Since hive pulls in a lot of dependencies that might break
34+ # existing Spark applications, it is not included in the standard spark assembly. Instead, we only
35+ # include it in the classpath if the user has explicitly requested it by running "sbt hive/assembly"
36+ # Hopefully we will find a way to avoid uber-jars entirely and deploy only the needed packages in
37+ # the future.
38+ if [ -f " $FWDIR " /sql/hive/target/scala-$SCALA_VERSION /spark-hive-assembly-* .jar ]; then
39+ echo " Hive assembly found, including hive support. If this isn't desired run sbt hive/clean."
40+
41+ # Datanucleus jars do not work if only included in the uberjar as plugin.xml metadata is lost.
42+ DATANUCLEUSJARS=$( JARS=(" $FWDIR /lib_managed/jars" /datanucleus-* .jar); IFS=:; echo " ${JARS[*]} " )
43+ CLASSPATH=$CLASSPATH :$DATANUCLEUSJARS
44+
45+ ASSEMBLY_DIR=" $FWDIR /sql/hive/target/scala-$SCALA_VERSION /"
46+ else
47+ ASSEMBLY_DIR=" $FWDIR /assembly/target/scala-$SCALA_VERSION /"
48+ fi
49+
3650# First check if we have a dependencies jar. If so, include binary classes with the deps jar
37- if [ -f " $FWDIR " /assembly/target/scala- $SCALA_VERSION /spark-assembly* hadoop* -deps.jar ]; then
51+ if [ -f " $ASSEMBLY_DIR " /spark-assembly* hadoop* -deps.jar ]; then
3852 CLASSPATH=" $CLASSPATH :$FWDIR /core/target/scala-$SCALA_VERSION /classes"
3953 CLASSPATH=" $CLASSPATH :$FWDIR /repl/target/scala-$SCALA_VERSION /classes"
4054 CLASSPATH=" $CLASSPATH :$FWDIR /mllib/target/scala-$SCALA_VERSION /classes"
4155 CLASSPATH=" $CLASSPATH :$FWDIR /bagel/target/scala-$SCALA_VERSION /classes"
4256 CLASSPATH=" $CLASSPATH :$FWDIR /graphx/target/scala-$SCALA_VERSION /classes"
4357 CLASSPATH=" $CLASSPATH :$FWDIR /streaming/target/scala-$SCALA_VERSION /classes"
58+ CLASSPATH=" $CLASSPATH :$FWDIR /tools/target/scala-$SCALA_VERSION /classes"
59+ CLASSPATH=" $CLASSPATH :$FWDIR /sql/catalyst/target/scala-$SCALA_VERSION /classes"
60+ CLASSPATH=" $CLASSPATH :$FWDIR /sql/core/target/scala-$SCALA_VERSION /classes"
61+ CLASSPATH=" $CLASSPATH :$FWDIR /sql/hive/target/scala-$SCALA_VERSION /classes"
4462
45- DEPS_ASSEMBLY_JAR=` ls " $FWDIR " /assembly/target/scala- $SCALA_VERSION / spark-assembly* hadoop* -deps.jar`
63+ DEPS_ASSEMBLY_JAR=` ls " $ASSEMBLY_DIR " / spark* -assembly* hadoop* -deps.jar`
4664 CLASSPATH=" $CLASSPATH :$DEPS_ASSEMBLY_JAR "
4765else
4866 # Else use spark-assembly jar from either RELEASE or assembly directory
4967 if [ -f " $FWDIR /RELEASE" ]; then
50- ASSEMBLY_JAR=` ls " $FWDIR " /jars/spark-assembly* .jar`
68+ ASSEMBLY_JAR=` ls " $FWDIR " /jars/spark* -assembly* .jar`
5169 else
52- ASSEMBLY_JAR=` ls " $FWDIR " /assembly/target/scala- $SCALA_VERSION / spark-assembly* hadoop* .jar`
70+ ASSEMBLY_JAR=` ls " $ASSEMBLY_DIR " / spark* -assembly* hadoop* .jar`
5371 fi
5472 CLASSPATH=" $CLASSPATH :$ASSEMBLY_JAR "
5573fi
@@ -62,6 +80,9 @@ if [[ $SPARK_TESTING == 1 ]]; then
6280 CLASSPATH=" $CLASSPATH :$FWDIR /bagel/target/scala-$SCALA_VERSION /test-classes"
6381 CLASSPATH=" $CLASSPATH :$FWDIR /graphx/target/scala-$SCALA_VERSION /test-classes"
6482 CLASSPATH=" $CLASSPATH :$FWDIR /streaming/target/scala-$SCALA_VERSION /test-classes"
83+ CLASSPATH=" $CLASSPATH :$FWDIR /sql/catalyst/target/scala-$SCALA_VERSION /test-classes"
84+ CLASSPATH=" $CLASSPATH :$FWDIR /sql/core/target/scala-$SCALA_VERSION /test-classes"
85+ CLASSPATH=" $CLASSPATH :$FWDIR /sql/hive/target/scala-$SCALA_VERSION /test-classes"
6586fi
6687
6788# Add hadoop conf dir if given -- otherwise FileSystem.*, etc fail !
0 commit comments