Skip to content

Commit c19cd28

Browse files
committed
make right version info for beeline
1 parent 5b3b6f6 commit c19cd28

File tree

4 files changed

+52
-10
lines changed

4 files changed

+52
-10
lines changed

assembly/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@
119119
<artifact>*:*</artifact>
120120
<excludes>
121121
<exclude>org/datanucleus/**</exclude>
122+
<exclude>org/apache/hive/beeline/**</exclude>
122123
<exclude>META-INF/*.SF</exclude>
123124
<exclude>META-INF/*.DSA</exclude>
124125
<exclude>META-INF/*.RSA</exclude>

bin/compute-classpath.cmd

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,30 @@ if exist "%FWDIR%RELEASE" (
5656

5757
set CLASSPATH=%CLASSPATH%;%ASSEMBLY_JAR%
5858

59-
rem When Hive support is needed, Datanucleus jars must be included on the classpath.
60-
rem Datanucleus jars do not work if only included in the uber jar as plugin.xml metadata is lost.
61-
rem Both sbt and maven will populate "lib_managed/jars/" with the datanucleus jars when Spark is
62-
rem built with Hive, so look for them there.
6359
if exist "%FWDIR%RELEASE" (
6460
set datanucleus_dir=%FWDIR%lib
6561
) else (
6662
set datanucleus_dir=%FWDIR%lib_managed\jars
6763
)
64+
65+
rem When Hive support is needed, Datanucleus jars must be included on the classpath.
66+
rem Datanucleus jars do not work if only included in the uber jar as plugin.xml metadata is lost.
67+
rem Both sbt and maven will populate "lib_managed/jars/" with the datanucleus jars when Spark is
68+
rem built with Hive, so look for them there.
6869
set "datanucleus_jars="
6970
for %%d in ("%datanucleus_dir%\datanucleus-*.jar") do (
7071
set datanucleus_jars=!datanucleus_jars!;%%d
7172
)
7273
set CLASSPATH=%CLASSPATH%;%datanucleus_jars%
7374

75+
rem Exclude hive-beeline*.jar from uber jar, since beeline need the Implementation-Version
76+
rem from MANIFEST.MF.
77+
for %%d in ("%datanucleus_dir%\hive-beeline*.jar") do (
78+
set hivebeeline_jar=!hivebeeline_jar!;%%d
79+
)
80+
set CLASSPATH=%CLASSPATH%;%hivebeeline_jar%
81+
82+
7483
set SPARK_CLASSES=%FWDIR%core\target\scala-%SCALA_VERSION%\classes
7584
set SPARK_CLASSES=%SPARK_CLASSES%;%FWDIR%repl\target\scala-%SCALA_VERSION%\classes
7685
set SPARK_CLASSES=%SPARK_CLASSES%;%FWDIR%mllib\target\scala-%SCALA_VERSION%\classes

bin/compute-classpath.sh

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,21 +98,25 @@ fi
9898

9999
CLASSPATH="$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.
107101
if [ -f "$FWDIR/RELEASE" ]; then
108102
datanucleus_dir="$FWDIR"/lib
109103
else
110104
datanucleus_dir="$FWDIR"/lib_managed/jars
111105
fi
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.
113113
datanucleus_jars="$(find "$datanucleus_dir" 2>/dev/null | grep "datanucleus-.*\\.jar")"
114114
datanucleus_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+
116120
if [ -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
122126
fi
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
125133
if [[ $SPARK_TESTING == 1 ]]; then
126134
CLASSPATH="$CLASSPATH:$FWDIR/core/target/scala-$SCALA_VERSION/test-classes"

sql/hive-thriftserver/pom.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,30 @@
9595
<skip>true</skip>
9696
</configuration>
9797
</plugin>
98+
<!-- Deploy datanucleus jars to the spark/lib_managed/jars directory -->
99+
<plugin>
100+
<groupId>org.apache.maven.plugins</groupId>
101+
<artifactId>maven-dependency-plugin</artifactId>
102+
<version>2.4</version>
103+
<executions>
104+
<execution>
105+
<id>copy-dependencies</id>
106+
<phase>package</phase>
107+
<goals>
108+
<goal>copy-dependencies</goal>
109+
</goals>
110+
<configuration>
111+
<!-- basedir is spark/sql/hive/ -->
112+
<outputDirectory>${basedir}/../../lib_managed/jars</outputDirectory>
113+
<overWriteReleases>false</overWriteReleases>
114+
<overWriteSnapshots>false</overWriteSnapshots>
115+
<overWriteIfNewer>true</overWriteIfNewer>
116+
<includeGroupIds>org.spark-project.hive</includeGroupIds>
117+
<includeClassifiers>hive-beeline</includeClassifiers>
118+
</configuration>
119+
</execution>
120+
</executions>
121+
</plugin>
98122
</plugins>
99123
</build>
100124
</project>

0 commit comments

Comments
 (0)