mirror of
https://github.com/apache/doris.git
synced 2026-11-04 07:31:17 +00:00
[chore] move submodule to contrib (#53543)
Path of submodule should be located to `contrib` dir. Remove useless `contrib/udf`
This commit is contained in:
1 parent
c45d7f19ce
commit
d3735a17a2
15 files changed
+57
-440
No files matched your search
+6
-6
@@ -13,11 +13,11 @@
|
||||
[submodule ".github/actions/ccache-action"]
|
||||
path = .github/actions/ccache-action
|
||||
url = https://github.com/hendrikmuhs/ccache-action
|
||||
[submodule "be/src/apache-orc"]
|
||||
path = be/src/apache-orc
|
||||
url = https://github.com/apache/doris-thirdparty.git
|
||||
branch = orc
|
||||
[submodule "be/src/clucene"]
|
||||
path = be/src/clucene
|
||||
[submodule "contrib/clucene"]
|
||||
path = contrib/clucene
|
||||
url = https://github.com/apache/doris-thirdparty.git
|
||||
branch = clucene
|
||||
[submodule "contrib/apache-orc"]
|
||||
path = contrib/apache-orc
|
||||
url = https://github.com/apache/doris-thirdparty.git
|
||||
branch = orc
|
||||
+12
-9
@@ -199,8 +199,10 @@ SET(LZ4_INCLUDE_DIR "$ENV{DORIS_THIRDPARTY}/installed/include/lz4")
|
||||
SET(ZLIB_HOME "$ENV{DORIS_THIRDPARTY}/installed")
|
||||
SET(ZSTD_HOME "$ENV{DORIS_THIRDPARTY}/installed")
|
||||
SET(ZSTD_INCLUDE_DIR "$ENV{DORIS_THIRDPARTY}/installed/include/zstd")
|
||||
SET(CONTRIB_PATH "${PROJECT_SOURCE_DIR}/../contrib")
|
||||
|
||||
add_subdirectory(${SRC_DIR}/apache-orc EXCLUDE_FROM_ALL)
|
||||
# Out of source build need to set the binary dir
|
||||
add_subdirectory(${CONTRIB_PATH}/apache-orc ${PROJECT_BINARY_DIR}/apache-orc EXCLUDE_FROM_ALL)
|
||||
target_compile_options(orc PRIVATE -Wno-implicit-fallthrough -w)
|
||||
|
||||
option(BUILD_STATIC_LIBRARIES "Build static libraries" ON)
|
||||
@@ -215,7 +217,8 @@ set(USE_STAT64 0)
|
||||
# disable clucene bthread supported.
|
||||
set(USE_BTHREAD OFF)
|
||||
|
||||
add_subdirectory(${SRC_DIR}/clucene EXCLUDE_FROM_ALL)
|
||||
# Out of source build need to set the binary dir
|
||||
add_subdirectory(${CONTRIB_PATH}/clucene ${PROJECT_BINARY_DIR}/clucene EXCLUDE_FROM_ALL)
|
||||
|
||||
set(clucene_options -w -Wall)
|
||||
if (COMPILER_CLANG)
|
||||
@@ -230,7 +233,7 @@ target_compile_options(clucene-contribs-lib PRIVATE ${clucene_options})
|
||||
target_compile_options(ic PRIVATE ${clucene_options})
|
||||
|
||||
install(DIRECTORY
|
||||
${SRC_DIR}/clucene/src/contribs-lib/CLucene/analysis/jieba/dict
|
||||
${CONTRIB_PATH}/clucene/src/contribs-lib/CLucene/analysis/jieba/dict
|
||||
DESTINATION ${OUTPUT_DIR})
|
||||
|
||||
install(DIRECTORY
|
||||
@@ -439,15 +442,15 @@ set(CMAKE_C_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
|
||||
# Set include dirs
|
||||
include_directories(
|
||||
${SRC_DIR}/apache-orc/c++/include
|
||||
${CMAKE_CURRENT_BINARY_DIR}/src/apache-orc/c++/include
|
||||
${CONTRIB_PATH}/apache-orc/c++/include
|
||||
${CMAKE_CURRENT_BINARY_DIR}/apache-orc/c++/include
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/src/clucene/src/shared
|
||||
${SRC_DIR}/clucene/src/core
|
||||
${SRC_DIR}/clucene/src/shared
|
||||
${SRC_DIR}/clucene/src/contribs-lib
|
||||
${CMAKE_CURRENT_BINARY_DIR}/clucene/src/shared
|
||||
${CONTRIB_PATH}/clucene/src/core
|
||||
${CONTRIB_PATH}/clucene/src/shared
|
||||
${CONTRIB_PATH}/clucene/src/contribs-lib
|
||||
)
|
||||
|
||||
include_directories(
|
||||
|
||||
+34
-34
@@ -59,43 +59,43 @@ message(STATUS "Disable the metrics collection for orc")
|
||||
add_compile_definitions(ENABLE_METRICS=0)
|
||||
|
||||
list(APPEND UT_FILES
|
||||
${CMAKE_SOURCE_DIR}/src/apache-orc/c++/test/MemoryInputStream.cc
|
||||
${CMAKE_SOURCE_DIR}/src/apache-orc/c++/test/MemoryOutputStream.cc
|
||||
${CMAKE_SOURCE_DIR}/src/apache-orc/c++/test/TestAttributes.cc
|
||||
${CMAKE_SOURCE_DIR}/src/apache-orc/c++/test/TestBlockBuffer.cc
|
||||
${CMAKE_SOURCE_DIR}/src/apache-orc/c++/test/TestBufferedOutputStream.cc
|
||||
${CMAKE_SOURCE_DIR}/src/apache-orc/c++/test/TestBloomFilter.cc
|
||||
${CMAKE_SOURCE_DIR}/src/apache-orc/c++/test/TestByteRle.cc
|
||||
${CMAKE_SOURCE_DIR}/src/apache-orc/c++/test/TestByteRLEEncoder.cc
|
||||
${CMAKE_SOURCE_DIR}/src/apache-orc/c++/test/TestColumnPrinter.cc
|
||||
${CMAKE_SOURCE_DIR}/src/apache-orc/c++/test/TestColumnReader.cc
|
||||
${CMAKE_SOURCE_DIR}/src/apache-orc/c++/test/TestColumnStatistics.cc
|
||||
${CMAKE_SOURCE_DIR}/src/apache-orc/c++/test/TestCompression.cc
|
||||
${CMAKE_SOURCE_DIR}/src/apache-orc/c++/test/TestDecompression.cc
|
||||
${CMAKE_SOURCE_DIR}/src/apache-orc/c++/test/TestDecimal.cc
|
||||
${CMAKE_SOURCE_DIR}/src/apache-orc/c++/test/TestDictionaryEncoding.cc
|
||||
#${CMAKE_SOURCE_DIR}/src/apache-orc/c++/test/TestDriver.cc
|
||||
${CMAKE_SOURCE_DIR}/src/apache-orc/c++/test/TestInt128.cc
|
||||
${CMAKE_SOURCE_DIR}/src/apache-orc/c++/test/TestMurmur3.cc
|
||||
${CMAKE_SOURCE_DIR}/src/apache-orc/c++/test/TestPredicateLeaf.cc
|
||||
${CMAKE_SOURCE_DIR}/src/apache-orc/c++/test/TestPredicatePushdown.cc
|
||||
${CMAKE_SOURCE_DIR}/src/apache-orc/c++/test/TestReader.cc
|
||||
${CMAKE_SOURCE_DIR}/src/apache-orc/c++/test/TestRleDecoder.cc
|
||||
${CMAKE_SOURCE_DIR}/src/apache-orc/c++/test/TestRleEncoder.cc
|
||||
${CMAKE_SOURCE_DIR}/src/apache-orc/c++/test/TestRLEV2Util.cc
|
||||
${CMAKE_SOURCE_DIR}/src/apache-orc/c++/test/TestSargsApplier.cc
|
||||
${CMAKE_SOURCE_DIR}/src/apache-orc/c++/test/TestSearchArgument.cc
|
||||
${CMAKE_SOURCE_DIR}/src/apache-orc/c++/test/TestStripeIndexStatistics.cc
|
||||
${CMAKE_SOURCE_DIR}/src/apache-orc/c++/test/TestTimestampStatistics.cc
|
||||
${CMAKE_SOURCE_DIR}/src/apache-orc/c++/test/TestTimezone.cc
|
||||
${CMAKE_SOURCE_DIR}/src/apache-orc/c++/test/TestType.cc
|
||||
${CMAKE_SOURCE_DIR}/src/apache-orc/c++/test/TestWriter.cc
|
||||
${CONTRIB_PATH}/apache-orc/c++/test/MemoryInputStream.cc
|
||||
${CONTRIB_PATH}/apache-orc/c++/test/MemoryOutputStream.cc
|
||||
${CONTRIB_PATH}/apache-orc/c++/test/TestAttributes.cc
|
||||
${CONTRIB_PATH}/apache-orc/c++/test/TestBlockBuffer.cc
|
||||
${CONTRIB_PATH}/apache-orc/c++/test/TestBufferedOutputStream.cc
|
||||
${CONTRIB_PATH}/apache-orc/c++/test/TestBloomFilter.cc
|
||||
${CONTRIB_PATH}/apache-orc/c++/test/TestByteRle.cc
|
||||
${CONTRIB_PATH}/apache-orc/c++/test/TestByteRLEEncoder.cc
|
||||
${CONTRIB_PATH}/apache-orc/c++/test/TestColumnPrinter.cc
|
||||
${CONTRIB_PATH}/apache-orc/c++/test/TestColumnReader.cc
|
||||
${CONTRIB_PATH}/apache-orc/c++/test/TestColumnStatistics.cc
|
||||
${CONTRIB_PATH}/apache-orc/c++/test/TestCompression.cc
|
||||
${CONTRIB_PATH}/apache-orc/c++/test/TestDecompression.cc
|
||||
${CONTRIB_PATH}/apache-orc/c++/test/TestDecimal.cc
|
||||
${CONTRIB_PATH}/apache-orc/c++/test/TestDictionaryEncoding.cc
|
||||
#${CONTRIB_PATH}/apache-orc/c++/test/TestDriver.cc
|
||||
${CONTRIB_PATH}/apache-orc/c++/test/TestInt128.cc
|
||||
${CONTRIB_PATH}/apache-orc/c++/test/TestMurmur3.cc
|
||||
${CONTRIB_PATH}/apache-orc/c++/test/TestPredicateLeaf.cc
|
||||
${CONTRIB_PATH}/apache-orc/c++/test/TestPredicatePushdown.cc
|
||||
${CONTRIB_PATH}/apache-orc/c++/test/TestReader.cc
|
||||
${CONTRIB_PATH}/apache-orc/c++/test/TestRleDecoder.cc
|
||||
${CONTRIB_PATH}/apache-orc/c++/test/TestRleEncoder.cc
|
||||
${CONTRIB_PATH}/apache-orc/c++/test/TestRLEV2Util.cc
|
||||
${CONTRIB_PATH}/apache-orc/c++/test/TestSargsApplier.cc
|
||||
${CONTRIB_PATH}/apache-orc/c++/test/TestSearchArgument.cc
|
||||
${CONTRIB_PATH}/apache-orc/c++/test/TestStripeIndexStatistics.cc
|
||||
${CONTRIB_PATH}/apache-orc/c++/test/TestTimestampStatistics.cc
|
||||
${CONTRIB_PATH}/apache-orc/c++/test/TestTimezone.cc
|
||||
${CONTRIB_PATH}/apache-orc/c++/test/TestType.cc
|
||||
${CONTRIB_PATH}/apache-orc/c++/test/TestWriter.cc
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}/src/apache-orc/c++/src
|
||||
${CMAKE_BINARY_DIR}/src/apache-orc/c++/src
|
||||
${CMAKE_BINARY_DIR}/src/apache-orc/c++/include
|
||||
${CMAKE_SOURCE_DIR}/../contrib/apache-orc/c++/src
|
||||
${CMAKE_BINARY_DIR}/apache-orc/c++/src
|
||||
${CMAKE_BINARY_DIR}/apache-orc/c++/include
|
||||
)
|
||||
|
||||
add_executable(doris_be_test ${UT_FILES})
|
||||
|
||||
@@ -582,8 +582,8 @@ FE_MODULES="$(
|
||||
|
||||
# Clean and build Backend
|
||||
if [[ "${BUILD_BE}" -eq 1 ]]; then
|
||||
update_submodule "be/src/apache-orc" "apache-orc" "https://github.com/apache/doris-thirdparty/archive/refs/heads/orc.tar.gz"
|
||||
update_submodule "be/src/clucene" "clucene" "https://github.com/apache/doris-thirdparty/archive/refs/heads/clucene.tar.gz"
|
||||
update_submodule "contrib/apache-orc" "apache-orc" "https://github.com/apache/doris-thirdparty/archive/refs/heads/orc.tar.gz"
|
||||
update_submodule "contrib/clucene" "clucene" "https://github.com/apache/doris-thirdparty/archive/refs/heads/clucene.tar.gz"
|
||||
if [[ -e "${DORIS_HOME}/gensrc/build/gen_cpp/version.h" ]]; then
|
||||
rm -f "${DORIS_HOME}/gensrc/build/gen_cpp/version.h"
|
||||
fi
|
||||
|
||||
File renamed without changes.
File renamed without changes.
@@ -1,58 +0,0 @@
|
||||
# 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.
|
||||
|
||||
cmake_minimum_required(VERSION 3.19.2)
|
||||
|
||||
project(doris_udf)
|
||||
|
||||
# set CMAKE_BUILD_TYPE
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE RELEASE)
|
||||
endif()
|
||||
|
||||
string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE)
|
||||
message(STATUS "Build type is ${CMAKE_BUILD_TYPE}")
|
||||
|
||||
set(BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
set(ENV{DORIS_HOME} "${BASE_DIR}/../../")
|
||||
set(THIRDPARTY_DIR "$ENV{DORIS_THIRDPARTY}/installed/")
|
||||
set(BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
set(SRC_DIR "${BASE_DIR}/src/")
|
||||
set(OUTPUT_DIR "${BASE_DIR}/output")
|
||||
|
||||
# Just for clang-tidy: -Wno-expansion-to-defined -Wno-deprecated-declaration
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -g -ggdb -std=c++11 -Wall -Werror -Wno-unused-variable -Wno-expansion-to-defined -Wno-deprecated-declarations -O3")
|
||||
|
||||
if (CMAKE_GENERATOR STREQUAL "Ninja" AND NOT DISABLE_COLORED_BUILD)
|
||||
# Turn on colored output. https://github.com/ninja-build/ninja/wiki/FAQ
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always")
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdiagnostics-color=always")
|
||||
endif ()
|
||||
|
||||
message(STATUS "Compiler Flags: ${CMAKE_CXX_FLAGS}")
|
||||
|
||||
# Include udf
|
||||
include_directories($ENV{DORIS_HOME}/output/udf/include)
|
||||
|
||||
# Set all libraries
|
||||
add_library(udf STATIC IMPORTED)
|
||||
set_target_properties(udf PROPERTIES IMPORTED_LOCATION $ENV{DORIS_HOME}/output/udf/lib/libDorisUdf.a)
|
||||
|
||||
# Add the subdirector of new UDF in here
|
||||
add_subdirectory(${SRC_DIR}/udf_samples)
|
||||
|
||||
install(DIRECTORY DESTINATION ${OUTPUT_DIR})
|
||||
@@ -1,151 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# 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.
|
||||
|
||||
##############################################################
|
||||
# This script is used to compile UDF
|
||||
# Usage:
|
||||
# sh build-udf.sh build udf without clean.
|
||||
# sh build-udf.sh --clean clean previous output and build.
|
||||
#
|
||||
##############################################################
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
|
||||
|
||||
export UDF_HOME="${ROOT}"
|
||||
DORIS_HOME="$(
|
||||
cd ../..
|
||||
printf %s "${PWD}"
|
||||
)"
|
||||
export DORIS_HOME
|
||||
echo "${DORIS_HOME}"
|
||||
|
||||
. "${DORIS_HOME}/env.sh"
|
||||
|
||||
PARALLEL="$(($(nproc) / 4 + 1))"
|
||||
|
||||
# Check args
|
||||
usage() {
|
||||
echo "
|
||||
Usage: $0 <options>
|
||||
Optional options:
|
||||
--clean clean and build target
|
||||
|
||||
Eg.
|
||||
$0 build UDF without clean
|
||||
$0 --clean clean and build UDF
|
||||
"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if ! OPTS="$(getopt \
|
||||
-n "$0" \
|
||||
-o '' \
|
||||
-o 'h' \
|
||||
-l 'clean' \
|
||||
-l 'help' \
|
||||
-- "$@")"; then
|
||||
usage
|
||||
fi
|
||||
|
||||
eval set -- "${OPTS}"
|
||||
|
||||
BUILD_UDF=1
|
||||
CLEAN=0
|
||||
HELP=0
|
||||
if [[ "$#" == 1 ]]; then
|
||||
# default
|
||||
CLEAN=0
|
||||
else
|
||||
CLEAN=0
|
||||
while true; do
|
||||
case "$1" in
|
||||
--clean)
|
||||
CLEAN=1
|
||||
shift
|
||||
;;
|
||||
-h)
|
||||
HELP=1
|
||||
shift
|
||||
;;
|
||||
--help)
|
||||
HELP=1
|
||||
shift
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
*)
|
||||
echo "Internal error"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ "${HELP}" -eq 1 ]]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
echo "Get params:
|
||||
CLEAN -- ${CLEAN}
|
||||
"
|
||||
|
||||
cd "${UDF_HOME}"
|
||||
# Clean and build UDF
|
||||
if [[ "${BUILD_UDF}" -eq 1 ]]; then
|
||||
CMAKE_BUILD_TYPE="${BUILD_TYPE:-Release}"
|
||||
echo "Build UDF: ${CMAKE_BUILD_TYPE}"
|
||||
CMAKE_BUILD_DIR="${UDF_HOME}/build_${CMAKE_BUILD_TYPE}"
|
||||
if [[ "${CLEAN}" -eq 1 ]]; then
|
||||
rm -rf "${CMAKE_BUILD_DIR}"
|
||||
rm -rf "${UDF_HOME}/output"
|
||||
fi
|
||||
mkdir -p "${CMAKE_BUILD_DIR}"
|
||||
cd "${CMAKE_BUILD_DIR}"
|
||||
"${CMAKE_CMD}" -G "${GENERATOR}" -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" ../
|
||||
"${BUILD_SYSTEM}" -j "${PARALLEL}"
|
||||
"${BUILD_SYSTEM}" install
|
||||
cd "${UDF_HOME}"
|
||||
fi
|
||||
|
||||
# Clean and prepare output dir
|
||||
DORIS_OUTPUT="${DORIS_HOME}/output"
|
||||
mkdir -p "${DORIS_OUTPUT}"
|
||||
|
||||
#Copy UDF
|
||||
if [[ "${BUILD_UDF}" -eq 1 ]]; then
|
||||
install -d "${DORIS_OUTPUT}/contrib/udf/lib"
|
||||
for dir in "${CMAKE_BUILD_DIR}/src"/*; do
|
||||
dir="$(basename "${dir}")"
|
||||
mkdir -p "${DORIS_OUTPUT}/contrib/udf/lib/${dir}"
|
||||
cp -r -p "${CMAKE_BUILD_DIR}/src/${dir}"/*.so "${DORIS_OUTPUT}/contrib/udf/lib/${dir}"/
|
||||
done
|
||||
fi
|
||||
|
||||
echo "***************************************"
|
||||
echo "Successfully build Doris UDF"
|
||||
echo "***************************************"
|
||||
|
||||
if [[ -n "${DORIS_POST_BUILD_HOOK}" ]]; then
|
||||
eval "${DORIS_POST_BUILD_HOOK}"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@@ -1,33 +0,0 @@
|
||||
# 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.
|
||||
|
||||
# where to put generated libraries
|
||||
set(LIBRARY_OUTPUT_PATH "${BUILD_DIR}/src/udf_samples")
|
||||
|
||||
# where to put generated binaries
|
||||
set(EXECUTABLE_OUTPUT_PATH "${BUILD_DIR}/src/udf_samples")
|
||||
|
||||
add_library(udfsample SHARED udf_sample.cpp)
|
||||
target_link_libraries(udfsample
|
||||
-static-libstdc++
|
||||
-static-libgcc
|
||||
)
|
||||
add_library(udasample SHARED uda_sample.cpp)
|
||||
target_link_libraries(udasample
|
||||
-static-libstdc++
|
||||
-static-libgcc
|
||||
)
|
||||
@@ -1,43 +0,0 @@
|
||||
// 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.
|
||||
|
||||
#include "udf_sample.h"
|
||||
|
||||
namespace doris_udf {
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// This is a sample of implementing a COUNT aggregate function.
|
||||
// ---------------------------------------------------------------------------
|
||||
void CountInit(FunctionContext* context, BigIntVal* val) {
|
||||
val->is_null = false;
|
||||
val->val = 0;
|
||||
}
|
||||
|
||||
void CountUpdate(FunctionContext* context, const IntVal& input, BigIntVal* val) {
|
||||
if (input.is_null) return;
|
||||
++val->val;
|
||||
}
|
||||
|
||||
void CountMerge(FunctionContext* context, const BigIntVal& src, BigIntVal* dst) {
|
||||
dst->val += src.val;
|
||||
}
|
||||
|
||||
BigIntVal CountFinalize(FunctionContext* context, const BigIntVal& val) {
|
||||
return val;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
// 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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "udf.h"
|
||||
|
||||
namespace doris_udf {
|
||||
|
||||
/// This is an example of the COUNT aggregate function.
|
||||
void CountInit(FunctionContext* context, BigIntVal* val);
|
||||
void CountUpdate(FunctionContext* context, const IntVal& input, BigIntVal* val);
|
||||
void CountMerge(FunctionContext* context, const BigIntVal& src, BigIntVal* dst);
|
||||
BigIntVal CountFinalize(FunctionContext* context, const BigIntVal& val);
|
||||
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
// 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.
|
||||
|
||||
#include "udf_sample.h"
|
||||
|
||||
namespace doris_udf {
|
||||
|
||||
IntVal AddUdf(FunctionContext* context, const IntVal& arg1, const IntVal& arg2) {
|
||||
if (arg1.is_null || arg2.is_null) {
|
||||
return IntVal::null();
|
||||
}
|
||||
return {arg1.val + arg2.val};
|
||||
}
|
||||
|
||||
/// --- Prepare / Close Functions ---
|
||||
/// ---------------------------------
|
||||
void AddUdfPrepare(FunctionContext* context, FunctionContext::FunctionStateScope scope) {}
|
||||
void AddUdfClose(FunctionContext* context, FunctionContext::FunctionStateScope scope) {}
|
||||
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
// 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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "udf.h"
|
||||
|
||||
namespace doris_udf {
|
||||
|
||||
IntVal AddUdf(FunctionContext* context, const IntVal& arg1, const IntVal& arg2);
|
||||
|
||||
/// --- Prepare / Close Functions ---
|
||||
/// ---------------------------------
|
||||
|
||||
/// The UDF can optionally include a prepare function. The prepare function is called
|
||||
/// before any calls to the UDF to evaluate values.
|
||||
void AddUdfPrepare(FunctionContext* context, FunctionContext::FunctionStateScope scope);
|
||||
|
||||
/// The UDF can also optionally include a close function. The close function is called
|
||||
/// after all calls to the UDF have completed.
|
||||
void AddUdfClose(FunctionContext* context, FunctionContext::FunctionStateScope scope);
|
||||
|
||||
}
|
||||
@@ -31,7 +31,7 @@ all: ${GEN_OBJECTS} ${OBJECTS}
|
||||
|
||||
$(shell mkdir -p ${BUILD_DIR}/gen_java)
|
||||
|
||||
THRIFT_CPP_ARGS = -I ${CURDIR} -I ${BUILD_DIR}/thrift/ --gen cpp:moveable_types -out ${BUILD_DIR}/gen_cpp --allow-64bit-consts -strict
|
||||
THRIFT_CPP_ARGS = -I ${CURDIR} -I ${BUILD_DIR}/thrift/ --gen cpp:moveable_types,no_skeleton -out ${BUILD_DIR}/gen_cpp --allow-64bit-consts -strict
|
||||
THRIFT_JAVA_ARGS = -I ${CURDIR} -I ${BUILD_DIR}/thrift/ --gen java:fullcamel -out ${BUILD_DIR}/gen_java --allow-64bit-consts -strict
|
||||
|
||||
${BUILD_DIR}/gen_cpp:
|
||||
|
||||
+2
-2
@@ -164,8 +164,8 @@ update_submodule() {
|
||||
fi
|
||||
}
|
||||
|
||||
update_submodule "be/src/apache-orc" "apache-orc" "https://github.com/apache/doris-thirdparty/archive/refs/heads/orc.tar.gz"
|
||||
update_submodule "be/src/clucene" "clucene" "https://github.com/apache/doris-thirdparty/archive/refs/heads/clucene.tar.gz"
|
||||
update_submodule "contrib/apache-orc" "apache-orc" "https://github.com/apache/doris-thirdparty/archive/refs/heads/orc.tar.gz"
|
||||
update_submodule "contrib/clucene" "clucene" "https://github.com/apache/doris-thirdparty/archive/refs/heads/clucene.tar.gz"
|
||||
|
||||
if [[ "_${DENABLE_CLANG_COVERAGE}" == "_ON" ]]; then
|
||||
echo "export DORIS_TOOLCHAIN=clang" >>custom_env.sh
|
||||
|
||||
Reference in new issue
Block a user