Skip to content

Commit f304337

Browse files
authored
Merge branch 'main' into support_avro_read
2 parents 30e67a2 + 775bc8c commit f304337

24 files changed

Lines changed: 1405 additions & 121 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
build
1717
build-release
1818
build-debug
19+
output
1920

2021
# IDE settings
2122
.idea

CMakeLists.txt

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ option(PAIMON_BUILD_SHARED "Build shared library" ON)
4747
option(PAIMON_BUILD_TESTS "Build tests" OFF)
4848
option(PAIMON_USE_ASAN "Use Address Sanitizer" OFF)
4949
option(PAIMON_USE_UBSAN "Use Undefined Behavior Sanitizer" OFF)
50+
option(PAIMON_USE_CXX11_ABI "Use C++11 ABI" ON)
5051
option(PAIMON_ENABLE_AVRO "Whether to enable avro file format" ON)
5152
option(PAIMON_ENABLE_ORC "Whether to enable orc file format" ON)
5253
option(PAIMON_ENABLE_LANCE "Whether to enable lance file format" OFF)
@@ -59,13 +60,24 @@ endif()
5960
if(PAIMON_ENABLE_AVRO)
6061
add_definitions(-DPAIMON_ENABLE_AVRO)
6162
endif()
62-
if(PAIMON_ENABLE_LANCE)
63-
add_definitions(-DPAIMON_ENABLE_LANCE)
64-
endif()
6563
if(PAIMON_ENABLE_JINDO)
6664
add_definitions(-DPAIMON_ENABLE_JINDO)
6765
endif()
68-
66+
if(PAIMON_USE_CXX11_ABI)
67+
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=1)
68+
else()
69+
# lance and lumina are provided in so file, cannot be recompiled with C++11 ABI off.
70+
if(PAIMON_ENABLE_LANCE)
71+
message(FATAL_ERROR "Lance cannot be enabled with C++11 ABI off")
72+
endif()
73+
if(PAIMON_ENABLE_LUMINA)
74+
message(FATAL_ERROR "Lumina cannot be enabled with C++11 ABI off")
75+
endif()
76+
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
77+
endif()
78+
if(PAIMON_ENABLE_LANCE)
79+
add_definitions(-DPAIMON_ENABLE_LANCE)
80+
endif()
6981
if(PAIMON_ENABLE_LUMINA)
7082
add_definitions(-DPAIMON_ENABLE_LUMINA)
7183
endif()
@@ -202,6 +214,8 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}")
202214
set(LIBRARY_OUTPUT_DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}")
203215
204216
# where to put generated binaries
217+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}")
218+
set(RUNTIME_OUTPUT_DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}")
205219
set(EXECUTABLE_OUTPUT_PATH "${BUILD_OUTPUT_ROOT_DIRECTORY}")
206220
207221
include(BuildUtils)

LICENSE

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,20 @@ This product includes code from Apache Arrow.
239239
Copyright: 2016-2024 The Apache Software Foundation.
240240
Home page: https://arrow.apache.org/
241241
License: https://www.apache.org/licenses/LICENSE-2.0
242+
--------------------------------------------------------------------------------
243+
244+
This product includes code from Apache ORC.
245+
246+
* Core utilities:
247+
* basic utilities in
248+
- include/paimon/utils/read_ahead_cache.h
249+
- include/paimon/utils/byte_range_combiner.h
250+
- src/paimon/common/utils/read_ahead_cache.cpp
251+
- src/paimon/common/utils/byte_range_combiner.cpp
252+
253+
Copyright: 2013 and onwards The Apache Software Foundation.
254+
Home page: https://orc.apache.org/
255+
License: https://www.apache.org/licenses/LICENSE-2.0
242256

243257
--------------------------------------------------------------------------------
244258

NOTICE

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ Copyright 2016-2024 The Apache Software Foundation
1010
Apache Iceberg C++
1111
Copyright 2024-2025 The Apache Software Foundation
1212

13+
Apache ORC
14+
Copyright 2013 and onwards The Apache Software Foundation.
15+
1316
This product includes software from Havenask project (Apache 2.0)
1417
Copyright 2014-present Alibaba Inc.
1518

build_and_package.sh

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Copyright 2026-present Alibaba Inc.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -euo pipefail
18+
19+
SOURCE_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
20+
OUTPUT_DIR="$SOURCE_ROOT/output"
21+
BUILD_TYPE="release"
22+
BUILD_NAME="paimon-cpp"
23+
MAKE_CLEAN=false
24+
PACKAGE=false
25+
CMAKE_OPTIONS=""
26+
27+
show_help() {
28+
cat << EOF
29+
Usage: $0 [options] [cmake_options...]
30+
31+
Options:
32+
-r, --release Build release version (default)
33+
-d, --debug Build debug version
34+
-c, --clean Clean build directory before building
35+
-p, --package Package creation
36+
-h, --help Show this help message
37+
38+
CMake Options:
39+
Any unrecognized options will be passed directly to CMake.
40+
You can specify multiple CMake options.
41+
42+
Examples:
43+
$0 -r -p -DPAIMON_BUILD_SHARED=ON -DPAIMON_BUILD_STATIC=OFF
44+
$0 --debug --clean --package
45+
46+
EOF
47+
}
48+
49+
while [[ $# -gt 0 ]]; do
50+
case "$1" in
51+
-r|--release)
52+
BUILD_TYPE="Release"
53+
shift
54+
;;
55+
-d|--debug)
56+
BUILD_TYPE="Debug"
57+
BUILD_NAME=$BUILD_NAME"-debug"
58+
shift
59+
;;
60+
-c|--clean)
61+
MAKE_CLEAN=true
62+
shift
63+
;;
64+
-p|--package)
65+
PACKAGE=true
66+
shift
67+
;;
68+
-h|--help)
69+
show_help
70+
exit 0
71+
;;
72+
*)
73+
# All remaining parameters are CMake options
74+
CMAKE_OPTIONS="$CMAKE_OPTIONS $1"
75+
shift
76+
;;
77+
esac
78+
done
79+
80+
CMAKE_OPTIONS=$(echo "$CMAKE_OPTIONS" | xargs)
81+
82+
echo "========== Build Configuration =========="
83+
echo "Build Type: $BUILD_TYPE"
84+
echo "Package Name: $BUILD_NAME"
85+
echo "Clean Build: $MAKE_CLEAN"
86+
echo "Package: $PACKAGE"
87+
if [ -n "$CMAKE_OPTIONS" ]; then
88+
echo "CMake Options: $CMAKE_OPTIONS"
89+
else
90+
echo "CMake Options: None"
91+
fi
92+
echo "========================================="
93+
94+
echo "Step 1: Downloading dependencies..."
95+
"$SOURCE_ROOT"/third_party/download_dependencies.sh
96+
97+
echo "Step 2: Building Paimon..."
98+
BUILD_DIR="$SOURCE_ROOT/build-$BUILD_TYPE"
99+
PACKAGE_DIR="$OUTPUT_DIR/$BUILD_NAME"
100+
101+
if [ "$MAKE_CLEAN" = true ]; then
102+
rm -rf "$BUILD_DIR"
103+
fi
104+
mkdir -p "$BUILD_DIR"
105+
cd "$BUILD_DIR"
106+
CMAKE_ARGS=(
107+
-DCMAKE_BUILD_TYPE="$BUILD_TYPE"
108+
-DCMAKE_INSTALL_PREFIX="$PACKAGE_DIR"
109+
)
110+
111+
if [ -n "$CMAKE_OPTIONS" ]; then
112+
CMAKE_ARGS+=("$CMAKE_OPTIONS")
113+
fi
114+
115+
cmake "${CMAKE_ARGS[@]}" ..
116+
117+
JOBS=$(nproc 2>/dev/null || echo 4)
118+
make -j"$JOBS"
119+
120+
if [ "$PACKAGE" = true ]; then
121+
echo "Step 3: Packaging..."
122+
mkdir -p "$OUTPUT_DIR"
123+
cd "$BUILD_DIR"
124+
make install
125+
tar -czvf "$OUTPUT_DIR/$BUILD_NAME.tar.gz" -C "$OUTPUT_DIR" "$BUILD_NAME"
126+
echo "Package created: $OUTPUT_DIR/$BUILD_NAME.tar.gz"
127+
else
128+
echo "Step 3: Packaging skipped."
129+
fi

cmake_modules/BuildUtils.cmake

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,12 @@ function(add_paimon_lib LIB_NAME)
8686
endif()
8787

8888
set_target_properties(${LIB_NAME}_shared
89-
PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${OUTPUT_PATH}"
90-
RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_PATH}"
91-
PDB_OUTPUT_DIRECTORY "${OUTPUT_PATH}"
89+
PROPERTIES LIBRARY_OUTPUT_DIRECTORY
90+
"${CMAKE_LIBRARY_OUTPUT_DIRECTORY}"
91+
RUNTIME_OUTPUT_DIRECTORY
92+
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
93+
PDB_OUTPUT_DIRECTORY
94+
"${CMAKE_LIBRARY_OUTPUT_DIRECTORY}"
9295
LINK_FLAGS "${ARG_SHARED_LINK_FLAGS}"
9396
OUTPUT_NAME ${LIB_NAME})
9497

@@ -137,7 +140,8 @@ function(add_paimon_lib LIB_NAME)
137140
set(LIB_NAME_STATIC ${LIB_NAME})
138141

139142
set_target_properties(${LIB_NAME}_static
140-
PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${OUTPUT_PATH}"
143+
PROPERTIES ARCHIVE_OUTPUT_DIRECTORY
144+
"${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}"
141145
OUTPUT_NAME ${LIB_NAME_STATIC})
142146

143147
if(ARG_STATIC_INSTALL_INTERFACE_LIBS)

0 commit comments

Comments
 (0)