[KYUUBI #2035] Hive Backend Engine - build/dist support

### _Why are the changes needed?_
`build/dist` supports hive.
close https://github.com/apache/incubator-kyuubi/issues/2035

### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible

- [x] Add screenshots for manual tests if appropriate

- [x] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request

Closes #2169 from cxzl25/KYUUBI-2035.

Closes #2035

69558bb6 [sychen] build/dist supports hive

Authored-by: sychen <sychen@trip.com>
Signed-off-by: Cheng Pan <chengpan@apache.org>
This commit is contained in:
sychen 2022-03-21 15:34:04 +08:00 committed by Cheng Pan
parent 0025505ae9
commit 048962338f
No known key found for this signature in database
GPG Key ID: 8001952629BCC75D

View File

@ -32,6 +32,7 @@ DISTDIR="$KYUUBI_HOME/dist"
MAKE_TGZ=false
FLINK_PROVIDED=false
SPARK_PROVIDED=false
HIVE_PROVIDED=false
NAME=none
MVN="$KYUUBI_HOME/build/mvn"
@ -48,6 +49,7 @@ function usage {
echo "tgz: - whether to make a whole bundled package"
echo "flink-provided: - whether to make a package without Flink binary"
echo "spark-provided: - whether to make a package without Spark binary"
echo "hive-provided: - whether to make a package without Hive binary"
echo "mvn: - external maven executable location"
echo ""
}
@ -70,6 +72,9 @@ while (( "$#" )); do
--spark-provided)
SPARK_PROVIDED=true
;;
--hive-provided)
HIVE_PROVIDED=true
;;
--mvn)
MVN="$2"
shift
@ -190,6 +195,10 @@ if [[ "$FLINK_PROVIDED" == "true" ]]; then
MVN_DIST_OPT="$MVN_DIST_OPT -Pflink-provided"
fi
if [[ "$HIVE_PROVIDED" == "true" ]]; then
MVN_DIST_OPT="$MVN_DIST_OPT -Phive-provided"
fi
export MAVEN_OPTS="${MAVEN_OPTS:--Xmx2g}"
BUILD_COMMAND=("$MVN" clean install $MVN_DIST_OPT $@)
@ -208,6 +217,8 @@ mkdir -p "$DISTDIR/externals/engines/flink"
mkdir -p "$DISTDIR/externals/engines/flink/lib"
mkdir -p "$DISTDIR/externals/engines/spark"
mkdir -p "$DISTDIR/externals/engines/trino"
mkdir -p "$DISTDIR/externals/engines/hive"
mkdir -p "$DISTDIR/externals/engines/hive/jars"
mkdir -p "$DISTDIR/beeline-jars"
echo "Kyuubi $VERSION $GITREVSTRING built for" > "$DISTDIR/RELEASE"
echo "Java $JAVA_VERSION" >> "$DISTDIR/RELEASE"
@ -250,6 +261,11 @@ cp -r "$KYUUBI_HOME/externals/kyuubi-trino-engine/bin/" "$DISTDIR/externals/engi
chmod a+x "$DISTDIR/externals/engines/trino/bin/trino-engine.sh"
cp "$KYUUBI_HOME/externals/kyuubi-trino-engine/target/kyuubi-trino-engine_${SCALA_VERSION}-${VERSION}.jar" "$DISTDIR/externals/engines/trino/jars"
# Copy hive engines
cp -r "$KYUUBI_HOME/externals/kyuubi-hive-sql-engine/bin/" "$DISTDIR/externals/engines/hive/bin/"
chmod a+x "$DISTDIR/externals/engines/hive/bin/hive-sql-engine.sh"
cp "$KYUUBI_HOME/externals/kyuubi-hive-sql-engine/target/kyuubi-hive-sql-engine_${SCALA_VERSION}-${VERSION}.jar" "$DISTDIR/externals/engines/hive/jars"
# Copy kyuubi tools
if [[ -f "$KYUUBI_HOME/tools/spark-block-cleaner/target/spark-block-cleaner_${SCALA_VERSION}-${VERSION}.jar" ]]; then
mkdir -p "$DISTDIR/tools/spark-block-cleaner/kubernetes"
@ -279,6 +295,12 @@ if [[ "$SPARK_PROVIDED" != "true" ]]; then
cp -r "$SPARK_BUILTIN" "$DISTDIR/externals/"
fi
if [[ "$HIVE_PROVIDED" != "true" ]]; then
# Copy hive binary dist
HIVE_BUILTIN="$(find "$KYUUBI_HOME/externals/kyuubi-download/target" -name 'apache-hive-*' -type d)"
cp -r "$HIVE_BUILTIN" "$DISTDIR/externals/"
fi
# Copy license files
cp "$KYUUBI_HOME/DISCLAIMER" "$DISTDIR/DISCLAIMER"
if [[ -f $"$KYUUBI_HOME/LICENSE-binary" ]]; then