Skip to content

Commit 551d557

Browse files
authored
Merge branch 'main' into codex/ubsan-fixes
2 parents 09854b3 + 9f490a6 commit 551d557

44 files changed

Lines changed: 2662 additions & 261 deletions

Some content is hidden

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

CMakeLists.txt

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
4545
option(PAIMON_BUILD_STATIC "Build static library" ON)
4646
option(PAIMON_BUILD_SHARED "Build shared library" ON)
4747
option(PAIMON_BUILD_TESTS "Build tests" OFF)
48+
option(PAIMON_BUILD_BENCHMARKS "Build benchmarks" OFF)
4849
option(PAIMON_USE_ASAN "Use Address Sanitizer" OFF)
4950
option(PAIMON_USE_UBSAN "Use Undefined Behavior Sanitizer" OFF)
5051
option(PAIMON_USE_CXX11_ABI "Use C++11 ABI" ON)
@@ -354,6 +355,29 @@ endif()
354355
355356
set(ENV{PAIMON_TEST_DATA} "${CMAKE_SOURCE_DIR}/test/test_data")
356357
358+
if(PAIMON_BUILD_TESTS OR PAIMON_BUILD_BENCHMARKS)
359+
resolve_dependency(GTest)
360+
include_directories(SYSTEM ${GTEST_INCLUDE_DIR})
361+
362+
paimon_link_libraries_whole_archive(PAIMON_LOCAL_FILE_SYSTEM_STATIC_LINK_LIBS
363+
paimon_local_file_system_static)
364+
paimon_link_libraries_no_as_needed(PAIMON_LOCAL_FILE_SYSTEM_SHARED_LINK_LIBS
365+
paimon_local_file_system_shared)
366+
paimon_link_libraries_whole_archive(PAIMON_BLOB_FILE_FORMAT_STATIC_LINK_LIBS
367+
paimon_blob_file_format_static)
368+
paimon_link_libraries_whole_archive(PAIMON_PARQUET_FILE_FORMAT_STATIC_LINK_LIBS
369+
paimon_parquet_file_format_static)
370+
371+
if(PAIMON_ENABLE_ORC)
372+
paimon_link_libraries_whole_archive(PAIMON_ORC_FILE_FORMAT_STATIC_LINK_LIBS
373+
paimon_orc_file_format_static)
374+
endif()
375+
if(PAIMON_ENABLE_AVRO)
376+
paimon_link_libraries_whole_archive(PAIMON_AVRO_FILE_FORMAT_STATIC_LINK_LIBS
377+
paimon_avro_file_format_static)
378+
endif()
379+
endif()
380+
357381
if(PAIMON_BUILD_TESTS)
358382
if(NOT PAIMON_ENABLE_ORC)
359383
message(FATAL_ERROR "PAIMON_ENABLE_ORC must be enabled if PAIMON_BUILD_TESTS is enable"
@@ -365,7 +389,6 @@ if(PAIMON_BUILD_TESTS)
365389
endif()
366390
# Adding unit tests part of the "paimon" portion of the test suite
367391
add_custom_target(paimon-tests)
368-
resolve_dependency(GTest)
369392
370393
add_custom_target(unittest
371394
ctest
@@ -375,7 +398,6 @@ if(PAIMON_BUILD_TESTS)
375398
--output-on-failure)
376399
add_dependencies(unittest paimon-tests)
377400
378-
include_directories(SYSTEM ${GTEST_INCLUDE_DIR})
379401
include_directories("${CMAKE_SOURCE_DIR}/test/")
380402
381403
paimon_link_libraries_whole_archive(
@@ -388,15 +410,6 @@ if(PAIMON_BUILD_TESTS)
388410
TEST_PLUGIN_LINK_LIBS paimon_parquet_file_format_shared
389411
paimon_blob_file_format_shared)
390412
set(TEST_STATIC_LINK_LIBS ${TEST_WHOLE_ARCHIVE_LINK_LIBS} ${TEST_PLUGIN_LINK_LIBS})
391-
paimon_link_libraries_whole_archive(PAIMON_LOCAL_FILE_SYSTEM_STATIC_LINK_LIBS
392-
paimon_local_file_system_static)
393-
paimon_link_libraries_no_as_needed(PAIMON_LOCAL_FILE_SYSTEM_SHARED_LINK_LIBS
394-
paimon_local_file_system_shared)
395-
paimon_link_libraries_whole_archive(PAIMON_BLOB_FILE_FORMAT_STATIC_LINK_LIBS
396-
paimon_blob_file_format_static)
397-
paimon_link_libraries_whole_archive(PAIMON_PARQUET_FILE_FORMAT_STATIC_LINK_LIBS
398-
paimon_parquet_file_format_static)
399-
400413
if(PAIMON_ENABLE_LANCE)
401414
paimon_link_libraries_whole_archive(PAIMON_LANCE_FILE_FORMAT_STATIC_LINK_LIBS
402415
paimon_lance_file_format_static)
@@ -405,15 +418,11 @@ if(PAIMON_BUILD_TESTS)
405418
list(APPEND TEST_STATIC_LINK_LIBS ${TEST_PLUGIN_LINK_LIBS})
406419
endif()
407420
if(PAIMON_ENABLE_ORC)
408-
paimon_link_libraries_whole_archive(PAIMON_ORC_FILE_FORMAT_STATIC_LINK_LIBS
409-
paimon_orc_file_format_static)
410421
paimon_link_libraries_no_as_needed(TEST_PLUGIN_LINK_LIBS
411422
paimon_orc_file_format_shared)
412423
list(APPEND TEST_STATIC_LINK_LIBS ${TEST_PLUGIN_LINK_LIBS})
413424
endif()
414425
if(PAIMON_ENABLE_AVRO)
415-
paimon_link_libraries_whole_archive(PAIMON_AVRO_FILE_FORMAT_STATIC_LINK_LIBS
416-
paimon_avro_file_format_static)
417426
paimon_link_libraries_no_as_needed(TEST_PLUGIN_LINK_LIBS
418427
paimon_avro_file_format_shared)
419428
list(APPEND TEST_STATIC_LINK_LIBS ${TEST_PLUGIN_LINK_LIBS})
@@ -441,6 +450,19 @@ if(PAIMON_BUILD_TESTS)
441450
endif()
442451
endif()
443452
453+
if(PAIMON_BUILD_BENCHMARKS)
454+
add_custom_target(paimon-benchmarks)
455+
add_custom_target(benchmark
456+
ctest
457+
-j4
458+
-L
459+
benchmark
460+
--output-on-failure)
461+
add_dependencies(benchmark paimon-benchmarks)
462+
463+
set(PAIMON_BENCHMARK_LINK_TOOLCHAIN benchmark::benchmark)
464+
endif()
465+
444466
paimon_print_dependency_resolution_summary()
445467
446468
include(CMakePackageConfigHelpers)
@@ -472,3 +494,6 @@ add_subdirectory(src/paimon/global_index/lucene)
472494
add_subdirectory(src/paimon/testing/mock)
473495
add_subdirectory(src/paimon/testing/utils)
474496
add_subdirectory(test/inte)
497+
if(PAIMON_BUILD_BENCHMARKS)
498+
add_subdirectory(benchmark)
499+
endif()

benchmark/CMakeLists.txt

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Copyright 2026-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+
if(NOT PAIMON_BUILD_BENCHMARKS AND NOT PAIMON_BUILD_TESTS)
16+
return()
17+
endif()
18+
19+
find_package(Threads REQUIRED)
20+
21+
set(PAIMON_BENCHMARK_STATIC_LINK_LIBS
22+
paimon_shared ${PAIMON_LOCAL_FILE_SYSTEM_SHARED_LINK_LIBS}
23+
${PAIMON_PARQUET_FILE_FORMAT_STATIC_LINK_LIBS}
24+
${PAIMON_BLOB_FILE_FORMAT_STATIC_LINK_LIBS})
25+
26+
if(PAIMON_ENABLE_ORC)
27+
list(APPEND PAIMON_BENCHMARK_STATIC_LINK_LIBS
28+
${PAIMON_ORC_FILE_FORMAT_STATIC_LINK_LIBS})
29+
endif()
30+
31+
if(PAIMON_ENABLE_AVRO)
32+
list(APPEND PAIMON_BENCHMARK_STATIC_LINK_LIBS
33+
${PAIMON_AVRO_FILE_FORMAT_STATIC_LINK_LIBS})
34+
endif()
35+
36+
set(PAIMON_BENCHMARK_PLATFORM_LINK_LIBS)
37+
if(UNIX AND NOT APPLE)
38+
find_library(PAIMON_BENCHMARK_RT_LIBRARY rt)
39+
if(PAIMON_BENCHMARK_RT_LIBRARY)
40+
list(APPEND PAIMON_BENCHMARK_PLATFORM_LINK_LIBS ${PAIMON_BENCHMARK_RT_LIBRARY})
41+
endif()
42+
endif()
43+
44+
if(PAIMON_BUILD_BENCHMARKS)
45+
add_paimon_benchmark(read_write_benchmark
46+
SOURCES
47+
benchmark_helpers.cpp
48+
benchmark_suite.cpp
49+
benchmark_case_write.cpp
50+
benchmark_case_read.cpp
51+
benchmark_case_pk_write.cpp
52+
benchmark_case_mor_read.cpp
53+
read_write_benchmark.cpp
54+
STATIC_LINK_LIBS
55+
arrow
56+
parquet
57+
${PAIMON_BENCHMARK_STATIC_LINK_LIBS}
58+
test_utils_static
59+
Threads::Threads
60+
${CMAKE_DL_LIBS}
61+
${PAIMON_BENCHMARK_PLATFORM_LINK_LIBS}
62+
${PAIMON_BENCHMARK_LINK_TOOLCHAIN}
63+
EXTRA_INCLUDES
64+
${CMAKE_SOURCE_DIR})
65+
endif()
66+
67+
if(PAIMON_BUILD_TESTS)
68+
add_paimon_test(cli_option_parsing_test
69+
SOURCES
70+
cli_option_parsing_test.cpp
71+
EXTRA_INCLUDES
72+
${CMAKE_SOURCE_DIR}
73+
STATIC_LINK_LIBS
74+
paimon_shared
75+
${GTEST_LINK_TOOLCHAIN})
76+
endif()
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright 2026-present Alibaba Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#include "benchmark/benchmark_suite.h"
18+
19+
namespace {
20+
21+
void BM_MOR_Read(::benchmark::State& state) {
22+
paimon::benchmark::RunBMMorRead(state);
23+
}
24+
25+
} // namespace
26+
27+
BENCHMARK(BM_MOR_Read)
28+
->ArgNames({"prefetch_parallel"})
29+
->Unit(benchmark::kMillisecond)
30+
->UseRealTime()
31+
->Args({1})
32+
->Args({2})
33+
->Args({4});
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright 2026-present Alibaba Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#include "benchmark/benchmark_suite.h"
18+
19+
namespace {
20+
21+
void BM_PK_Write(::benchmark::State& state) {
22+
paimon::benchmark::RunBMPkWrite(state);
23+
}
24+
25+
} // namespace
26+
27+
BENCHMARK(BM_PK_Write)->Unit(benchmark::kMillisecond)->UseRealTime();

benchmark/benchmark_case_read.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright 2026-present Alibaba Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#include "benchmark/benchmark_suite.h"
18+
19+
namespace {
20+
21+
void BM_Read(::benchmark::State& state) {
22+
paimon::benchmark::RunBMRead(state);
23+
}
24+
25+
} // namespace
26+
27+
BENCHMARK(BM_Read)
28+
->ArgNames({"prefetch_parallel"})
29+
->Unit(benchmark::kMillisecond)
30+
->UseRealTime()
31+
->Args({1})
32+
->Args({2})
33+
->Args({4});

benchmark/benchmark_case_write.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright 2026-present Alibaba Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#include "benchmark/benchmark_suite.h"
18+
19+
namespace {
20+
21+
void BM_Write(::benchmark::State& state) {
22+
paimon::benchmark::RunBMWrite(state);
23+
}
24+
25+
} // namespace
26+
27+
BENCHMARK(BM_Write)->Unit(benchmark::kMillisecond)->UseRealTime();

0 commit comments

Comments
 (0)