[Regression](java-udf) Move source code used by Java UDF test case (#13476)
This commit is contained in:
@ -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!")
|
||||
|
||||
78
regression-test/java-udf-src/pom.xml
Normal file
78
regression-test/java-udf-src/pom.xml
Normal file
@ -0,0 +1,78 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.apache.doris</groupId>
|
||||
<artifactId>java-udf-case</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>Java UDF Case</name>
|
||||
<url>https://doris.apache.org/</url>
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.hive/hive-exec -->
|
||||
<dependency>
|
||||
<groupId>org.apache.hive</groupId>
|
||||
<artifactId>hive-exec</artifactId>
|
||||
<version>2.3.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>java-udf-case</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.2.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>3.3.0</version>
|
||||
<configuration>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||
</descriptorRefs>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>8</source>
|
||||
<target>8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -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 {
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
0
tools/find_libjvm.sh
Normal file → Executable file
0
tools/find_libjvm.sh
Normal file → Executable file
Reference in New Issue
Block a user