wolfboys commented on code in PR #73:
URL:
https://github.com/apache/doris-spark-connector/pull/73#discussion_r1129147063
##########
spark-doris-connector/build.sh:
##########
@@ -78,42 +121,90 @@ if [[ -f ${DORIS_HOME}/custom_env.sh ]]; then
. "${DORIS_HOME}"/custom_env.sh
fi
-BUILD_FROM_TAG=0
-SPARK_VERSION=0
-SCALA_VERSION=0
-MVN_ARGS=""
-while true; do
- case "$1" in
- --spark) SPARK_VERSION=$2 ; shift 2 ;;
- --scala) SCALA_VERSION=$2 ; shift 2 ;;
- --mvn-args) MVN_ARGS=$2 ; shift 2 ;;
- --tag) BUILD_FROM_TAG=1 ; shift ;;
- --) shift ; break ;;
- *) echo "Internal error" ; exit 1 ;;
+selectScala() {
+ echo 'Spark-Doris-Connector supports Scala 2.11 and 2.12. Which version do
you need ?'
+ select scala in "2.11" "2.12"
+ do
+ case $scala in
+ "2.11")
+ return 1
+ ;;
+ "2.12")
+ return 2
+ ;;
+ *)
+ echo "invalid selected, exit.."
+ exit 1
+ ;;
esac
-done
+ done
+}
-# extract minor version:
-# eg: 3.1.2 -> 3
-SPARK_MINOR_VERSION=0
-if [ ${SPARK_VERSION} != 0 ]; then
- SPARK_MINOR_VERSION=${SPARK_VERSION%.*}
- echo "SPARK_MINOR_VERSION: ${SPARK_MINOR_VERSION}"
-fi
+selectSpark() {
+ echo 'Spark-Doris-Connector supports multiple versions of spark. Which
version do you need ?'
+ select spark in "2.3.x" "3.1.x" "3.2.x" "other"
+ do
+ case $spark in
+ "2.3.x")
+ return 1
+ ;;
+ "3.1.x")
+ return 2
+ ;;
+ "3.2.x")
+ return 3
+ ;;
+ "other")
+ return 4
+ ;;
+ esac
+ done
+}
-if [[ ${BUILD_FROM_TAG} -eq 1 ]]; then
- rm -rf ${ROOT}/output/
- ${MVN_BIN} clean package
-else
- rm -rf ${ROOT}/output/
- ${MVN_BIN} clean package -Dspark.version=${SPARK_VERSION}
-Dscala.version=${SCALA_VERSION} -Dspark.minor.version=${SPARK_MINOR_VERSION}
$MVN_ARGS
-fi
+selectScala
+ScalaVer=$?
+SCALA_VERSION="2.1${ScalaVer}"
-mkdir ${ROOT}/output/
-cp ${ROOT}/target/spark-doris-*.jar ${ROOT}/output/
+SPARK_VERSION=0
+selectSpark
+SparkVer=$?
+if [ ${SparkVer} -eq 1 ]; then
+ SPARK_VERSION="2.3.4"
+elif [ ${SparkVer} -eq 2 ]; then
+ SPARK_VERSION="3.1.2"
+elif [ ${SparkVer} -eq 3 ]; then
+ SPARK_VERSION="3.2.0"
+elif [ ${SparkVer} -eq 4 ]; then
+ # shellcheck disable=SC2162
+ read -p 'Which spark version do you need? please input
+ :' ver
+ SPARK_VERSION=$ver
+fi
-echo "*****************************************"
-echo "Successfully build Spark-Doris-Connector"
-echo "*****************************************"
+# extract minor version:
+# eg: 3.1.2 -> 3
+SPARK_MINOR_VERSION=0
+[ ${SPARK_VERSION} != 0 ] && SPARK_MINOR_VERSION=${SPARK_VERSION%.*}
+
+echo_g " scala version: ${SCALA_VERSION}"
+echo_g " spark version: ${SPARK_VERSION}, minor version:
${SPARK_MINOR_VERSION}"
+echo_g " build starting..."
+
+${MVN_BIN} clean package \
+ -Dspark.version=${SPARK_VERSION} \
+ -Dscala.version=${SCALA_VERSION} \
+ -Dthrift.binary=${THRIFT_BIN} \
+ -Dspark.minor.version=${SPARK_MINOR_VERSION} $@
+
Review Comment:
> It is recommended to add a judgment, otherwise if mvn fails, the following
success will still be printed
updated, PTAL again. thx
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]