9898
9999CLASSPATH=" $CLASSPATH :$ASSEMBLY_JAR "
100100
101- # When Hive support is needed, Datanucleus jars must be included on the classpath.
102- # Datanucleus jars do not work if only included in the uber jar as plugin.xml metadata is lost.
103- # Both sbt and maven will populate "lib_managed/jars/" with the datanucleus jars when Spark is
104- # built with Hive, so first check if the datanucleus jars exist, and then ensure the current Spark
105- # assembly is built for Hive, before actually populating the CLASSPATH with the jars.
106- # Note that this check order is faster (by up to half a second) in the case where Hive is not used.
107101if [ -f " $FWDIR /RELEASE" ]; then
108102 datanucleus_dir=" $FWDIR " /lib
109103else
110104 datanucleus_dir=" $FWDIR " /lib_managed/jars
111105fi
112106
107+ # When Hive support is needed, Datanucleus jars must be included on the classpath.
108+ # Datanucleus jars do not work if only included in the uber jar as plugin.xml metadata is lost.
109+ # Both sbt and maven will populate "lib_managed/jars/" with the datanucleus jars when Spark is
110+ # built with Hive, so first check if the datanucleus jars exist, and then ensure the current Spark
111+ # assembly is built for Hive, before actually populating the CLASSPATH with the jars.
112+ # Note that this check order is faster (by up to half a second) in the case where Hive is not used.
113113datanucleus_jars=" $( find " $datanucleus_dir " 2> /dev/null | grep " datanucleus-.*\\ .jar" ) "
114114datanucleus_jars=" $( echo " $datanucleus_jars " | tr " \n" : | sed s/:$//g) "
115115
116+ # Exclude hive-beeline*.jar from uber jar, since beeline need the Implementation-Version
117+ # from MANIFEST.MF.
118+ hivebeeline_jar=" $( find " $datanucleus_dir " 2> /dev/null | grep " hive-beeline*\\ .jar" ) "
119+
116120if [ -n " $datanucleus_jars " ]; then
117121 hive_files=$( " $JAR_CMD " -tf " $ASSEMBLY_JAR " org/apache/hadoop/hive/ql/exec 2> /dev/null)
118122 if [ -n " $hive_files " ]; then
@@ -121,6 +125,10 @@ if [ -n "$datanucleus_jars" ]; then
121125 fi
122126fi
123127
128+ if [ -n " $hivebeeline_jar " ]; then
129+ CLASSPATH=" $CLASSPATH :$hivebeeline_jar "
130+ fi
131+
124132# Add test classes if we're running from SBT or Maven with SPARK_TESTING set to 1
125133if [[ $SPARK_TESTING == 1 ]]; then
126134 CLASSPATH=" $CLASSPATH :$FWDIR /core/target/scala-$SCALA_VERSION /test-classes"
0 commit comments