diff --git a/be/CMakeLists.txt b/be/CMakeLists.txt index df22953202..aad4989319 100644 --- a/be/CMakeLists.txt +++ b/be/CMakeLists.txt @@ -603,7 +603,8 @@ include_directories( ) if (BUILD_JAVA_UDF) - execute_process(COMMAND sh ${BASE_DIR}/../tools/find_libjvm.sh OUTPUT_VARIABLE LIBJVM_PATH OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND chmod 755 ${BASE_DIR}/../tools/find_libjvm.sh) + execute_process(COMMAND ${BASE_DIR}/../tools/find_libjvm.sh OUTPUT_VARIABLE LIBJVM_PATH OUTPUT_STRIP_TRAILING_WHITESPACE) FILE(GLOB_RECURSE LIB_JVM ${LIBJVM_PATH}) if(${LIB_JVM} STREQUAL "") message(STATUS "Disable JAVA UDF because there is no libjvm found!") diff --git a/regression-test/java-udf-src/pom.xml b/regression-test/java-udf-src/pom.xml new file mode 100644 index 0000000000..d0cd56f498 --- /dev/null +++ b/regression-test/java-udf-src/pom.xml @@ -0,0 +1,78 @@ + + + + 4.0.0 + org.apache.doris + java-udf-case + 1.0-SNAPSHOT + Java UDF Case + https://doris.apache.org/ + + 8 + 8 + + + + + + org.apache.hive + hive-exec + 2.3.5 + + + + + java-udf-case + + + org.apache.maven.plugins + maven-jar-plugin + 3.2.2 + + + org.apache.maven.plugins + maven-assembly-plugin + 3.3.0 + + + jar-with-dependencies + + + + + package + + single + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 8 + 8 + + + + + diff --git a/regression-test/java-udf-src/src/main/java/org/apache/doris/udf/AddOne.java b/regression-test/java-udf-src/src/main/java/org/apache/doris/udf/AddOne.java new file mode 100644 index 0000000000..d468925d75 --- /dev/null +++ b/regression-test/java-udf-src/src/main/java/org/apache/doris/udf/AddOne.java @@ -0,0 +1,26 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package org.apache.doris.udf; + +import org.apache.hadoop.hive.ql.exec.UDF; + +public class AddOne extends UDF { + public Integer evaluate(Integer value) { + return value == null? null: value + 1; + } +} diff --git a/regression-test/suites/javaudf_p0/test_javaudf_addone.groovy b/regression-test/suites/javaudf_p0/test_javaudf_addone.groovy index d53741410b..2c89814842 100644 --- a/regression-test/suites/javaudf_p0/test_javaudf_addone.groovy +++ b/regression-test/suites/javaudf_p0/test_javaudf_addone.groovy @@ -23,7 +23,7 @@ import java.nio.file.Paths suite("test_javaudf_addone") { def tableName = "test_javaudf_addone" - def jarPath = """${context.file.parent}/jars/java-udf-demo-jar-with-dependencies.jar""" + def jarPath = """${context.file.parent}/jars/java-udf-case-jar-with-dependencies.jar""" log.info("Jar path: ${jarPath}".toString()) try { diff --git a/run-regression-test.sh b/run-regression-test.sh index f1b43fc91d..7c72b49967 100755 --- a/run-regression-test.sh +++ b/run-regression-test.sh @@ -152,12 +152,12 @@ if ! test -f ${RUN_JAR:+${RUN_JAR}}; then fi # build jar needed by java-udf case -JAVAUDF_JAR="${DORIS_HOME}/samples/doris-demo/java-udf-demo/target/java-udf-demo-jar-with-dependencies.jar" +JAVAUDF_JAR="${DORIS_HOME}/regression-test/java-udf-src/target/java-udf-case-jar-with-dependencies.jar" if ! test -f ${JAVAUDF_JAR:+${JAVAUDF_JAR}}; then mkdir -p "${DORIS_HOME}"/regression-test/suites/javaudf_p0/jars - cd "${DORIS_HOME}"/samples/doris-demo/java-udf-demo + cd "${DORIS_HOME}"/regression-test/java-udf-src "${MVN_CMD}" package - cp target/java-udf-demo-jar-with-dependencies.jar "${DORIS_HOME}"/regression-test/suites/javaudf_p0/jars/ + cp target/java-udf-case-jar-with-dependencies.jar "${DORIS_HOME}"/regression-test/suites/javaudf_p0/jars/ cd "${DORIS_HOME}" fi diff --git a/tools/find_libjvm.sh b/tools/find_libjvm.sh old mode 100644 new mode 100755