Skip to content

Commit 2aaf1fb

Browse files
authored
Merge branch 'main' into fix_some_ut
2 parents df46f95 + 4f519ce commit 2aaf1fb

File tree

220 files changed

+3659
-2123
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

220 files changed

+3659
-2123
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Copyright 2025-present Alibaba Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Build Release
16+
17+
on:
18+
push:
19+
branches:
20+
- '**'
21+
tags:
22+
- '**'
23+
pull_request:
24+
25+
concurrency:
26+
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
27+
cancel-in-progress: true
28+
29+
permissions:
30+
contents: read
31+
32+
jobs:
33+
clang-release:
34+
runs-on: ubuntu-24.04
35+
timeout-minutes: 120
36+
strategy:
37+
fail-fast: false
38+
steps:
39+
- name: Checkout paimon-cpp
40+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
41+
with:
42+
lfs: true
43+
- name: Build Paimon
44+
shell: bash
45+
env:
46+
CC: clang
47+
CXX: clang++
48+
run: ci/scripts/build_paimon.sh $(pwd) false false Release
49+
gcc-release:
50+
runs-on: ubuntu-24.04
51+
timeout-minutes: 120
52+
strategy:
53+
fail-fast: false
54+
steps:
55+
- name: Checkout paimon-cpp
56+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
57+
with:
58+
lfs: true
59+
- name: Build Paimon
60+
shell: bash
61+
env:
62+
CC: gcc-14
63+
CXX: g++-14
64+
run: ci/scripts/build_paimon.sh $(pwd) false false Release

.github/workflows/clang_test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ jobs:
4040
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
4141
with:
4242
lfs: true
43+
fetch-depth: 0 # fetch all history for git diff in clang-tidy
4344
- name: Build Paimon
4445
shell: bash
4546
env:

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,6 @@ if(PAIMON_BUILD_TESTS)
323323
-L
324324
unittest
325325
--output-on-failure)
326-
add_compile_options(-fno-access-control)
327326
add_dependencies(unittest paimon-tests)
328327
329328
include_directories(SYSTEM ${GTEST_INCLUDE_DIR})

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ The writing is divided into two stages:
6666
.AddOption(Options::FILE_SYSTEM, "local")
6767
.IgnoreEmptyCommit(false)
6868
.Finish());
69-
PAIMON_ASSIGN_OR_RAISE(std::unique_ptr<FileStoreCommit> commit, FileStoreCommit::Create(std::move(commit_context));
69+
PAIMON_ASSIGN_OR_RAISE(std::unique_ptr<FileStoreCommit> commit, FileStoreCommit::Create(std::move(commit_context)));
7070
PAIMON_RETURN_NOT_OK(commit->Commit(commit_messages));
7171

7272
```
@@ -100,7 +100,7 @@ The reading is divided into two stages:
100100
.AddOption(Options::FILE_SYSTEM, "local")
101101
.EnablePrefetch(true)
102102
.Finish());
103-
PAIMON_ASSIGN_OR_RAISE(std::unique_ptr<TableRead> table_read, TableRead::Create(std::move(read_context));
103+
PAIMON_ASSIGN_OR_RAISE(std::unique_ptr<TableRead> table_read, TableRead::Create(std::move(read_context)));
104104
PAIMON_ASSIGN_OR_RAISE(std::unique_ptr<BatchReader> batch_reader, table_read->CreateReader(plan->Splits()));
105105
106106
while (true) {

ci/scripts/build_paimon.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@ set -eux
1919
source_dir=${1}
2020
enable_sanitizer=${2:-false}
2121
check_clang_tidy=${3:-false}
22+
build_type=${4:-Debug}
2223
build_dir=${1}/build
2324

2425
mkdir ${build_dir}
2526
pushd ${build_dir}
2627

2728
CMAKE_ARGS=(
2829
"-G Ninja"
29-
"-DCMAKE_BUILD_TYPE=Debug"
30+
"-DCMAKE_BUILD_TYPE=${build_type}"
3031
"-DPAIMON_BUILD_TESTS=ON"
3132
"-DPAIMON_ENABLE_LANCE=ON"
3233
"-DPAIMON_ENABLE_JINDO=ON"

cmake_modules/BuildUtils.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ function(add_test_case REL_TEST_NAME)
256256
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
257257
target_compile_options(${TEST_NAME} PRIVATE -Wno-global-constructors)
258258
endif()
259+
target_compile_options(${TEST_NAME} PRIVATE -fno-access-control)
259260

260261
add_test(${TEST_NAME}
261262
${BUILD_SUPPORT_DIR}/run-test.sh

cmake_modules/DefineOptions.cmake

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
9999
set_option_category("Test")
100100

101101
define_option(PAIMON_BUILD_TESTS "Build the Paimon googletest unit tests" OFF)
102-
define_option(PAIMON_BUILD_EXAMPLE "Build the Paimon example" OFF)
103102

104103
if(PAIMON_BUILD_SHARED)
105104
set(PAIMON_TEST_LINKAGE_DEFAULT "shared")
@@ -117,7 +116,7 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
117116
"If on, only git-diff files will be passed to linting tools" ON)
118117

119118
define_option_string(PAIMON_LINT_GIT_TARGET_COMMIT
120-
"target commit/branch for comparison in git diff" "HEAD")
119+
"target commit/branch for comparison in git diff" "origin/main")
121120

122121
define_option(PAIMON_GENERATE_COVERAGE "Build with C++ code coverage enabled" OFF)
123122

cmake_modules/ThirdpartyToolchain.cmake

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,12 @@ macro(build_fmt)
249249
string(REPLACE "-Werror" "" FMT_CMAKE_CXX_FLAGS ${FMT_CMAKE_CXX_FLAGS})
250250

251251
set(FMT_CMAKE_ARGS
252-
${EP_COMMON_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX=${FMT_PREFIX}
253-
"-DCMAKE_CXX_FLAGS=${FMT_CMAKE_CXX_FLAGS}" "-DCMAKE_C_FLAGS=${FMT_CMAKE_C_FLAGS}")
252+
${EP_COMMON_CMAKE_ARGS}
253+
-DCMAKE_INSTALL_PREFIX=${FMT_PREFIX}
254+
"-DCMAKE_CXX_FLAGS=${FMT_CMAKE_CXX_FLAGS}"
255+
"-DCMAKE_C_FLAGS=${FMT_CMAKE_C_FLAGS}"
256+
-DFMT_TEST=OFF
257+
-DFMT_DOC=OFF)
254258
set(FMT_CONFIGURE CMAKE_ARGS ${FMT_CMAKE_ARGS})
255259
externalproject_add(fmt_ep
256260
URL ${FMT_SOURCE_URL}
@@ -337,7 +341,8 @@ macro(build_zstd)
337341
-DCMAKE_INSTALL_PREFIX=${ZSTD_PREFIX}
338342
"-DCMAKE_CXX_FLAGS=${ZSTD_CMAKE_CXX_FLAGS}"
339343
"-DCMAKE_C_FLAGS=${ZSTD_CMAKE_C_FLAGS}"
340-
-DZSTD_BUILD_SHARED=OFF)
344+
-DZSTD_BUILD_SHARED=OFF
345+
-DZSTD_BUILD_PROGRAMS=OFF)
341346

342347
set(ZSTD_CONFIGURE SOURCE_SUBDIR "build/cmake" CMAKE_ARGS ${ZSTD_CMAKE_ARGS})
343348
externalproject_add(zstd_ep
@@ -363,7 +368,8 @@ macro(build_lz4)
363368
"${LZ4_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}lz4${CMAKE_STATIC_LIBRARY_SUFFIX}"
364369
)
365370
set(LZ4_LIBRARIES ${LZ4_STATIC_LIB})
366-
set(LZ4_CMAKE_ARGS ${EP_COMMON_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX=${LZ4_PREFIX})
371+
set(LZ4_CMAKE_ARGS ${EP_COMMON_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX=${LZ4_PREFIX}
372+
-DLZ4_BUILD_CLI=OFF -DLZ4_BUILD_LEGACY_LZ4C=OFF)
367373

368374
set(LZ4_CONFIGURE SOURCE_SUBDIR "build/cmake" CMAKE_ARGS ${LZ4_CMAKE_ARGS})
369375
externalproject_add(lz4_ep
@@ -548,6 +554,13 @@ macro(build_avro)
548554

549555
get_target_property(AVRO_ZSTD_INCLUDE_DIR zstd INTERFACE_INCLUDE_DIRECTORIES)
550556
get_filename_component(AVRO_ZSTD_ROOT "${AVRO_ZSTD_INCLUDE_DIR}" DIRECTORY)
557+
558+
get_target_property(AVRO_ZLIB_INCLUDE_DIR zlib INTERFACE_INCLUDE_DIRECTORIES)
559+
get_filename_component(AVRO_ZLIB_ROOT "${AVRO_ZLIB_INCLUDE_DIR}" DIRECTORY)
560+
561+
get_target_property(AVRO_FMT_INCLUDE_DIR fmt INTERFACE_INCLUDE_DIRECTORIES)
562+
get_filename_component(AVRO_FMT_ROOT "${AVRO_FMT_INCLUDE_DIR}" DIRECTORY)
563+
551564
set(AVRO_CMAKE_CXX_FLAGS "${EP_CXX_FLAGS} -Wno-error")
552565
set(AVRO_CMAKE_C_FLAGS "${EP_C_FLAGS} -Wno-error")
553566

@@ -558,7 +571,8 @@ macro(build_avro)
558571
"-DCMAKE_C_FLAGS=${AVRO_CMAKE_C_FLAGS}"
559572
"-DAVRO_BUILD_TESTS=OFF"
560573
"-DAVRO_BUILD_EXECUTABLES=OFF"
561-
"-DZLIB_ROOT=${THIRDPARTY_ZLIB_ROOT}"
574+
"-DZLIB_ROOT=${AVRO_ZLIB_ROOT}"
575+
"-Dfmt_ROOT=${AVRO_FMT_ROOT}"
562576
"-Dzstd_ROOT=${AVRO_ZSTD_ROOT}"
563577
"-DSnappy_ROOT=${AVRO_SNAPPY_ROOT}")
564578
externalproject_add(avro_ep
@@ -567,7 +581,7 @@ macro(build_avro)
567581
SOURCE_SUBDIR "lang/c++"
568582
CMAKE_ARGS ${AVRO_CMAKE_ARGS}
569583
BUILD_BYPRODUCTS "${AVRO_STATIC_LIB}"
570-
DEPENDS zlib zstd snappy)
584+
DEPENDS fmt zlib zstd snappy)
571585

572586
file(MAKE_DIRECTORY "${AVRO_INCLUDE_DIR}")
573587

@@ -693,6 +707,9 @@ macro(build_arrow)
693707
set(ARROW_CMAKE_CXX_FLAGS "${EP_CXX_FLAGS} -Wno-error")
694708
set(ARROW_CMAKE_C_FLAGS "${EP_C_FLAGS} -Wno-error")
695709
string(REPLACE "-Werror" "" ARROW_CMAKE_CXX_FLAGS ${ARROW_CMAKE_CXX_FLAGS})
710+
# Fix for thrift Mutex.h missing #include <cstdint> (GCC 15 strictness)
711+
# Use -include to force include cstdint for all C++ files
712+
string(APPEND ARROW_CMAKE_CXX_FLAGS " -include cstdint")
696713

697714
set(ARROW_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/arrow_ep-install")
698715
set(ARROW_HOME "${ARROW_PREFIX}")
@@ -730,6 +747,9 @@ macro(build_arrow)
730747
-DARROW_DEPENDENCY_USE_SHARED=OFF
731748
-DARROW_BUILD_SHARED=OFF
732749
-DARROW_BUILD_STATIC=ON
750+
-DARROW_BUILD_TESTS=OFF
751+
-DARROW_BUILD_BENCHMARKS=OFF
752+
-DARROW_BUILD_EXAMPLES=OFF
733753
-DARROW_JEMALLOC=OFF
734754
-DARROW_WITH_RE2=OFF
735755
-DARROW_WITH_UTF8PROC=OFF
@@ -988,6 +1008,11 @@ macro(build_glog)
9881008
INTERFACE_COMPILE_DEFINITIONS "GLOG_USE_GLOG_EXPORT")
9891009

9901010
add_dependencies(glog glog_ep)
1011+
1012+
find_library(LIBUNWIND_LIBRARY NAMES unwind)
1013+
if(LIBUNWIND_LIBRARY)
1014+
target_link_libraries(glog INTERFACE ${LIBUNWIND_LIBRARY})
1015+
endif()
9911016
endmacro()
9921017

9931018
build_fmt()

docs/source/api/global_index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
.. limitations under the License.
1414
1515
============
16-
GLobal Index
16+
Global Index
1717
============
1818

1919
.. _cpp-api-global-index:

include/paimon/catalog/catalog.h

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,26 @@ class PAIMON_EXPORT Catalog {
9595
/// status.
9696
virtual Result<std::vector<std::string>> ListTables(const std::string& db_name) const = 0;
9797

98+
/// Checks whether a database with the specified name exists in the catalog.
99+
///
100+
/// @param db_name The name of the database to check for existence.
101+
/// @return A result containing true if the database exists, false otherwise, or an error
102+
/// status.
103+
virtual Result<bool> DatabaseExists(const std::string& db_name) const = 0;
104+
105+
/// Checks whether a table with the specified identifier exists in the catalog.
106+
///
107+
/// @param identifier The identifier of the table to check for existence.
108+
/// @return A result containing true if the table exists, false otherwise, or an error status.
109+
virtual Result<bool> TableExists(const Identifier& identifier) const = 0;
110+
98111
/// Loads the latest schema of a specified table.
99112
///
100113
/// @note System tables will not be supported.
101114
///
102115
/// @param identifier The identifier (database and table name) of the table to load.
103-
/// @return A result containing table schema if the table exists, or std::nullopt if it
104-
/// doesn't, or an error status on failure.
105-
virtual Result<std::optional<std::shared_ptr<Schema>>> LoadTableSchema(
106-
const Identifier& identifier) const = 0;
116+
/// @return A result containing table schema if the table exists, or an error status on failure.
117+
virtual Result<std::shared_ptr<Schema>> LoadTableSchema(const Identifier& identifier) const = 0;
107118
};
108119

109120
} // namespace paimon

0 commit comments

Comments
 (0)