diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..c3116ce --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,463 @@ +# 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.16) +message(STATUS "Building using CMake version: ${CMAKE_VERSION}") + +# https://cmake.org/cmake/help/latest/policy/CMP0135.html +# +# CMP0135 is for solving re-building and re-downloading. +# We don't have a real problem with the OLD behavior for now +# but we use the NEW behavior explicitly to suppress CMP0135 +# warnings. +if(POLICY CMP0135) + cmake_policy(SET CMP0135 NEW) +endif() + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE + Release + CACHE STRING "Choose the type of build.") +endif() + +project(paimon + VERSION 0.2.0 + DESCRIPTION "Paimon C++ Project") + +string(TOUPPER "${CMAKE_BUILD_TYPE}" UPPERCASE_BUILD_TYPE) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + +option(PAIMON_BUILD_STATIC "Build static library" ON) +option(PAIMON_BUILD_SHARED "Build shared library" ON) +option(PAIMON_BUILD_TESTS "Build tests" OFF) +option(PAIMON_USE_ASAN "Use Address Sanitizer" OFF) +option(PAIMON_USE_UBSAN "Use Undefined Behavior Sanitizer" OFF) +option(PAIMON_USE_CXX11_ABI "Use C++11 ABI" ON) +option(PAIMON_ENABLE_AVRO "Whether to enable avro file format" ON) +option(PAIMON_ENABLE_ORC "Whether to enable orc file format" ON) +option(PAIMON_ENABLE_LANCE "Whether to enable lance file format" OFF) +option(PAIMON_ENABLE_JINDO "Whether to enable jindo file system" OFF) +option(PAIMON_ENABLE_LUMINA "Whether to enable lumina vector index" OFF) +option(PAIMON_ENABLE_LUCENE "Whether to enable lucene index" OFF) + +if(PAIMON_ENABLE_ORC) + add_definitions(-DPAIMON_ENABLE_ORC) +endif() +if(PAIMON_ENABLE_AVRO) + add_definitions(-DPAIMON_ENABLE_AVRO) +endif() +if(PAIMON_ENABLE_JINDO) + add_definitions(-DPAIMON_ENABLE_JINDO) +endif() +if(PAIMON_USE_CXX11_ABI) + add_definitions(-D_GLIBCXX_USE_CXX11_ABI=1) +else() + # lance and lumina are provided in so file, cannot be recompiled with C++11 ABI off. + if(PAIMON_ENABLE_LANCE) + message(FATAL_ERROR "Lance cannot be enabled with C++11 ABI off") + endif() + if(PAIMON_ENABLE_LUMINA) + message(FATAL_ERROR "Lumina cannot be enabled with C++11 ABI off") + endif() + add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0) +endif() +if(PAIMON_ENABLE_LANCE) + add_definitions(-DPAIMON_ENABLE_LANCE) +endif() +if(PAIMON_ENABLE_LUMINA) + add_definitions(-DPAIMON_ENABLE_LUMINA) +endif() + +if(PAIMON_ENABLE_LUCENE) + add_definitions(-DPAIMON_ENABLE_LUCENE) +endif() + +add_definitions(-DSNAPPY_CODEC_AVAILABLE) +add_definitions(-DZSTD_CODEC_AVAILABLE) +add_definitions(-DRAPIDJSON_HAS_STDSTRING) + +set(CLANG_TIDY_BIN "clang-tidy") + +set(PAIMON_SOURCE_DIR ${PROJECT_SOURCE_DIR}) +set(PAIMON_BINARY_DIR ${PROJECT_BINARY_DIR}) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules") +set(BUILD_SUPPORT_DIR "${CMAKE_SOURCE_DIR}/build_support") +set(PAIMON_CMAKE_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") + +include(GNUInstallDirs) +include(DefineOptions) + +if(PAIMON_OPTIONAL_INSTALL) + # Don't make the "install" target depend on the "all" target + set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY true) + set(INSTALL_IS_OPTIONAL OPTIONAL) +endif() + +if(PAIMON_EXTRA_ERROR_CONTEXT) + add_definitions(-DPAIMON_EXTRA_ERROR_CONTEXT) +endif() + +if(NOT PAIMON_VERBOSE_LINT) + set(PAIMON_LINT_QUIET "--quiet") +endif() + +set(LINT_EXCLUSIONS_FILE ${BUILD_SUPPORT_DIR}/lint_exclusions.txt) + +set(LINT_SOURCE_DIRS ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src + ${CMAKE_SOURCE_DIR}/test ${CMAKE_SOURCE_DIR}/examples) + +set(CLANG_TIDY_OPTIONS + ${PAIMON_LINT_QUIET} + --compile_commands + ${CMAKE_BINARY_DIR}/compile_commands.json + --exclude_globs + ${LINT_EXCLUSIONS_FILE}) + +if(PAIMON_LINT_GIT_DIFF_MODE) + list(JOIN LINT_SOURCE_DIRS "|" _lint_dir_union) + set(LINT_DIR_REGEX "^(${_lint_dir_union}\/?)") + + set(GIT_DIFF_FILE_PATH ${CMAKE_BINARY_DIR}/git_diff_files.txt) + add_custom_target(update_diff_files + # get git-diff file list + COMMAND git diff-index --name-only --diff-filter=d --cached + ${PAIMON_LINT_GIT_TARGET_COMMIT} > ${GIT_DIFF_FILE_PATH} + # convert to absolute path + COMMAND sed -i \"s|^|${CMAKE_SOURCE_DIR}/|\" ${GIT_DIFF_FILE_PATH} + # filter with ${LINT_SOURCE_DIRS} dirs + COMMAND sed -nE -i '\\@${LINT_DIR_REGEX}@p' ${GIT_DIFF_FILE_PATH} + COMMENT "Generate git_diff_files.txt for git-diff lint" + BYPRODUCTS ${GIT_DIFF_FILE_PATH}) + + list(APPEND CLANG_TIDY_OPTIONS --source_file @${GIT_DIFF_FILE_PATH}) +else() + list(APPEND CLANG_TIDY_OPTIONS --source_dir ${LINT_SOURCE_DIRS}) +endif() + +# runs clang-tidy and attempts to fix any warning automatically +add_custom_target(clang-tidy + ${PYTHON_EXECUTABLE} + ${BUILD_SUPPORT_DIR}/run_clang_tidy.py + --clang_tidy_binary + ${CLANG_TIDY_BIN} + ${CLANG_TIDY_OPTIONS} + --fix) + +# runs clang-tidy and exits with a non-zero exit code if any errors are found. +add_custom_target(check-clang-tidy + ${PYTHON_EXECUTABLE} + ${BUILD_SUPPORT_DIR}/run_clang_tidy.py + --clang_tidy_binary + ${CLANG_TIDY_BIN} + ${CLANG_TIDY_OPTIONS}) + +if(PAIMON_LINT_GIT_DIFF_MODE) + add_dependencies(clang-tidy update_diff_files) + add_dependencies(check-clang-tidy update_diff_files) +endif() + +if(UNIX) + add_custom_target(iwyu + ${CMAKE_COMMAND} + -E + env + "PYTHON=${PYTHON_EXECUTABLE}" + ${BUILD_SUPPORT_DIR}/iwyu/iwyu.sh) + add_custom_target(iwyu-all + ${CMAKE_COMMAND} + -E + env + "PYTHON=${PYTHON_EXECUTABLE}" + ${BUILD_SUPPORT_DIR}/iwyu/iwyu.sh + all) +endif(UNIX) + +# Setup ccache to accelerate compilation if available +if(PAIMON_USE_CCACHE + AND NOT CMAKE_C_COMPILER_LAUNCHER + AND NOT CMAKE_CXX_COMPILER_LAUNCHER) + + find_program(CCACHE_PROGRAM ccache) + if(CCACHE_PROGRAM) + message(STATUS "Found ccache: ${CCACHE_PROGRAM}") + set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}") + set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}") + else() + message(STATUS "ccache not found, compiling without cache acceleration") + endif() +endif() + +include(SetupCxxFlags) + +# set compile output directory +string(TOLOWER ${CMAKE_BUILD_TYPE} BUILD_SUBDIR_NAME) + +# If build in-source, create the latest symlink. If build out-of-source, which +# is preferred, simply output the binaries in the build folder +if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR}) + set(BUILD_OUTPUT_ROOT_DIRECTORY + "${CMAKE_CURRENT_BINARY_DIR}/build/${BUILD_SUBDIR_NAME}/") + # Link build/latest to the current build directory, to avoid developers + # accidentally running the latest debug build when in fact they're building + # release builds. + file(MAKE_DIRECTORY ${BUILD_OUTPUT_ROOT_DIRECTORY}) + if(NOT APPLE) + set(MORE_ARGS "-T") + endif() + execute_process(COMMAND ln ${MORE_ARGS} -sf ${BUILD_OUTPUT_ROOT_DIRECTORY} + ${CMAKE_CURRENT_BINARY_DIR}/build/latest) +else() + set(BUILD_OUTPUT_ROOT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${BUILD_SUBDIR_NAME}/") +endif() + +# where to put generated archives (.a files) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}") +set(ARCHIVE_OUTPUT_DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}") + +# where to put generated libraries (.so files) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}") +set(LIBRARY_OUTPUT_DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}") + +# where to put generated binaries +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}") +set(RUNTIME_OUTPUT_DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}") +set(EXECUTABLE_OUTPUT_PATH "${BUILD_OUTPUT_ROOT_DIRECTORY}") + +include(BuildUtils) +enable_testing() + +# Add common flags +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_COMMON_FLAGS}") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PAIMON_CXXFLAGS}") + +# For any C code, use the same flags. These flags don't contain C++ specific +# flags. +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CXX_COMMON_FLAGS} ${PAIMON_CXXFLAGS}") + +# Remove --std=c++17 to avoid errors from C compilers +string(REPLACE "-std=c++17" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS}) + +# Add C++-only flags, like -std=c++11 +set(CMAKE_CXX_FLAGS "${CXX_ONLY_FLAGS} ${CMAKE_CXX_FLAGS}") + +include(san-config) + +# Code coverage +if("${PAIMON_GENERATE_COVERAGE}") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage -DCOVERAGE_BUILD") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -DCOVERAGE_BUILD") +endif() + +# CMAKE_CXX_FLAGS now fully assembled +message(STATUS "CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}") +message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") + +include_directories(${CMAKE_CURRENT_BINARY_DIR}/src) +include_directories(src) + +# +# Visibility +# +# For generate_export_header() and add_compiler_export_flags(). +include(GenerateExportHeader) +include(ExternalProject) +include(ThirdpartyToolchain) + +add_custom_target(paimon_dependencies) + +if(PAIMON_STATIC_LINK_LIBS) + add_dependencies(paimon_dependencies ${PAIMON_STATIC_LINK_LIBS}) +endif() + +set(PAIMON_SHARED_PRIVATE_LINK_LIBS ${PAIMON_STATIC_LINK_LIBS}) + +add_subdirectory(third_party/roaring_bitmap EXCLUDE_FROM_ALL) +add_subdirectory(third_party/xxhash EXCLUDE_FROM_ALL) + +if(PAIMON_ENABLE_LANCE) + add_subdirectory(third_party/lance EXCLUDE_FROM_ALL) + link_directories(third_party/lance/lance_lib/target/release) + install(FILES ${PROJECT_SOURCE_DIR}/third_party/lance/lance_lib/target/release/liblance_lib_rc.so + DESTINATION ${CMAKE_INSTALL_LIBDIR}) +endif() + +list(APPEND PAIMON_LINK_LIBS ${CMAKE_DL_LIBS}) +list(APPEND PAIMON_SHARED_INSTALL_INTERFACE_LIBS ${CMAKE_DL_LIBS}) +if(PAIMON_ENABLE_LUMINA) + add_subdirectory(third_party/lumina EXCLUDE_FROM_ALL) + link_directories(third_party/lumina/lib) + install(FILES ${PROJECT_SOURCE_DIR}/third_party/lumina/lib/liblumina.so + DESTINATION ${CMAKE_INSTALL_LIBDIR}) +endif() + +if(PAIMON_ENABLE_LUCENE) + set(PAIMON_DICT_DEST "share/paimon/dict") + + install(DIRECTORY ${JIEBA_DICT_DIR}/ + DESTINATION ${PAIMON_DICT_DEST} + FILES_MATCHING + PATTERN "jieba.dict.utf8" + PATTERN "hmm_model.utf8" + PATTERN "idf.utf8" + PATTERN "stop_words.utf8" + PATTERN "user.dict.utf8" + PATTERN "pos_dict" + PATTERN ".git*" EXCLUDE + PATTERN "*.md" EXCLUDE) +endif() + +install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/ + DESTINATION "include" + FILES_MATCHING + PATTERN "*.h") + +set(CMAKE_CXX_VISIBILITY_PRESET hidden) +set(CMAKE_C_VISIBILITY_PRESET hidden) + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) +include_directories("${CMAKE_SOURCE_DIR}/third_party/roaring_bitmap") +include_directories("${CMAKE_SOURCE_DIR}/third_party/xxhash") + +if(PAIMON_ENABLE_LANCE) + include_directories("${CMAKE_SOURCE_DIR}/third_party/lance") +endif() + +if(PAIMON_ENABLE_LUMINA) + include_directories("${CMAKE_SOURCE_DIR}/third_party/lumina/include") +endif() + +include_directories(SYSTEM ${ARROW_INCLUDE_DIR}) +include_directories(SYSTEM ${TBB_INCLUDE_DIR}) + +include_directories(SYSTEM ${GLOG_INCLUDE_DIR}) +add_compile_definitions("GLOG_USE_GLOG_EXPORT") + +set(THREADS_PREFER_PTHREAD_FLAG ON) +find_package(Threads REQUIRED) +set(PAIMON_VERSION_SCRIPT_FLAGS + "-Wl,--version-script=${CMAKE_SOURCE_DIR}/src/paimon/symbols.map") + +set(ENV{PAIMON_TEST_DATA} "${CMAKE_SOURCE_DIR}/test/test_data") + +if(PAIMON_BUILD_TESTS) + if(NOT PAIMON_ENABLE_ORC) + message(FATAL_ERROR "PAIMON_ENABLE_ORC must be enabled if PAIMON_BUILD_TESTS is enable" + ) + endif() + if(NOT PAIMON_ENABLE_AVRO) + message(FATAL_ERROR "PAIMON_ENABLE_AVRO must be enabled if PAIMON_BUILD_TESTS is enable" + ) + endif() + # Adding unit tests part of the "paimon" portion of the test suite + add_custom_target(paimon-tests) + resolve_dependency(GTest) + + add_custom_target(unittest + ctest + -j4 + -L + unittest + --output-on-failure) + add_dependencies(unittest paimon-tests) + + include_directories(SYSTEM ${GTEST_INCLUDE_DIR}) + include_directories("${CMAKE_SOURCE_DIR}/test/") + + set(TEST_STATIC_LINK_LIBS + "-Wl,--whole-archive" + paimon_file_index_static + paimon_global_index_static + paimon_local_file_system_static + paimon_mock_file_format_static + "-Wl,--no-whole-archive" + "-Wl,--no-as-needed" + paimon_parquet_file_format_shared + paimon_blob_file_format_shared + "-Wl,--as-needed") + + if(PAIMON_ENABLE_LANCE) + list(APPEND TEST_STATIC_LINK_LIBS "-Wl,--no-as-needed") + list(APPEND TEST_STATIC_LINK_LIBS paimon_lance_file_format_shared) + list(APPEND TEST_STATIC_LINK_LIBS "-Wl,--as-needed") + endif() + if(PAIMON_ENABLE_ORC) + list(APPEND TEST_STATIC_LINK_LIBS "-Wl,--no-as-needed") + list(APPEND TEST_STATIC_LINK_LIBS paimon_orc_file_format_shared) + list(APPEND TEST_STATIC_LINK_LIBS "-Wl,--as-needed") + endif() + if(PAIMON_ENABLE_AVRO) + list(APPEND TEST_STATIC_LINK_LIBS "-Wl,--no-as-needed") + list(APPEND TEST_STATIC_LINK_LIBS paimon_avro_file_format_shared) + list(APPEND TEST_STATIC_LINK_LIBS "-Wl,--as-needed") + endif() + if(PAIMON_ENABLE_JINDO) + list(APPEND TEST_STATIC_LINK_LIBS "-Wl,--no-as-needed") + list(APPEND TEST_STATIC_LINK_LIBS paimon_jindo_file_system_shared) + list(APPEND TEST_STATIC_LINK_LIBS "-Wl,--as-needed") + endif() + if(PAIMON_ENABLE_LUMINA) + list(APPEND TEST_STATIC_LINK_LIBS "-Wl,--no-as-needed") + list(APPEND TEST_STATIC_LINK_LIBS paimon_lumina_index_shared) + list(APPEND TEST_STATIC_LINK_LIBS "-Wl,--as-needed") + endif() + if(PAIMON_ENABLE_LUCENE) + list(APPEND TEST_STATIC_LINK_LIBS "-Wl,--no-as-needed") + list(APPEND TEST_STATIC_LINK_LIBS paimon_lucene_index_shared) + list(APPEND TEST_STATIC_LINK_LIBS "-Wl,--as-needed") + endif() +endif() + +paimon_print_dependency_resolution_summary() + +include(CMakePackageConfigHelpers) +write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/PaimonConfigVersion.cmake" + VERSION ${PROJECT_VERSION} + COMPATIBILITY AnyNewerVersion) + +configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/PaimonConfig.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/PaimonConfig.cmake" + INSTALL_DESTINATION lib/cmake/Paimon) + +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/PaimonConfig.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/PaimonConfigVersion.cmake" + DESTINATION lib/cmake/Paimon) + +config_summary_message() + +add_subdirectory(src/paimon) +add_subdirectory(src/paimon/fs/local) +if(PAIMON_ENABLE_JINDO) + add_subdirectory(src/paimon/fs/jindo) +endif() +add_subdirectory(src/paimon/format/blob) +add_subdirectory(src/paimon/format/orc) +add_subdirectory(src/paimon/format/parquet) +add_subdirectory(src/paimon/format/avro) +if(PAIMON_ENABLE_LANCE) + add_subdirectory(src/paimon/format/lance) +endif() +if(PAIMON_ENABLE_LUMINA) + add_subdirectory(src/paimon/global_index/lumina) +endif() +add_subdirectory(src/paimon/global_index/lucene) +add_subdirectory(src/paimon/testing/mock) +add_subdirectory(src/paimon/testing/utils) +add_subdirectory(test/inte) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt new file mode 100644 index 0000000..082cf04 --- /dev/null +++ b/examples/CMakeLists.txt @@ -0,0 +1,45 @@ +# 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.16) + +project(example) + +set(CMAKE_CXX_STANDARD 17) + +find_package(Arrow CONFIG REQUIRED) +find_package(Paimon CONFIG REQUIRED) + +add_executable(read_write_demo read_write_demo.cpp) +add_executable(clean_demo clean_demo.cpp) + +include_directories(${PAIMON_INCLUDE_DIRS}) + +set(CMAKE_EXE_LINKER_FLAGS "-Wl,--no-as-needed ${CMAKE_EXE_LINKER_FLAGS}") + +target_link_libraries(read_write_demo + PRIVATE arrow_shared + paimon_shared + paimon_parquet_file_format_shared + paimon_orc_file_format_shared + paimon_local_file_system_shared) + +target_link_libraries(clean_demo + PRIVATE arrow_shared + paimon_shared + paimon_parquet_file_format_shared + paimon_orc_file_format_shared + paimon_local_file_system_shared) diff --git a/src/paimon/CMakeLists.txt b/src/paimon/CMakeLists.txt new file mode 100644 index 0000000..1c62938 --- /dev/null +++ b/src/paimon/CMakeLists.txt @@ -0,0 +1,744 @@ +# 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. + +set(PAIMON_COMMON_SRCS + common/compression/block_compression_factory.cpp + common/compression/block_compressor.cpp + common/compression/block_decompressor.cpp + common/data/abstract_binary_writer.cpp + common/data/binary_array.cpp + common/data/binary_array_writer.cpp + common/data/binary_row.cpp + common/data/binary_row_writer.cpp + common/data/binary_section.cpp + common/data/binary_string.cpp + common/data/blob.cpp + common/data/blob_descriptor.cpp + common/data/blob_utils.cpp + common/data/columnar/columnar_array.cpp + common/data/columnar/columnar_map.cpp + common/data/columnar/columnar_row.cpp + common/data/columnar/columnar_row_ref.cpp + common/data/decimal.cpp + common/data/internal_row.cpp + common/data/record_batch.cpp + common/data/serializer/binary_row_serializer.cpp + common/data/serializer/row_compacted_serializer.cpp + common/data/serializer/binary_serializer_utils.cpp + common/data/timestamp.cpp + common/defs.cpp + common/executor/executor.cpp + common/factories/singleton.cpp + common/factories/io_hook.cpp + common/factories/factory_creator.cpp + common/file_index/bitmap/bitmap_index_result.cpp + common/file_index/file_indexer_factory.cpp + common/file_index/file_index_format.cpp + common/file_index/file_index_reader.cpp + common/file_index/file_index_result.cpp + common/format/column_stats.cpp + common/format/file_format_factory.cpp + common/fs/file_system.cpp + common/fs/resolving_file_system.cpp + common/fs/file_system_factory.cpp + common/global_index/union_global_index_reader.cpp + common/global_index/offset_global_index_reader.cpp + common/global_index/complete_index_score_batch_reader.cpp + common/global_index/bitmap_scored_global_index_result.cpp + common/global_index/bitmap_global_index_result.cpp + common/global_index/global_index_result.cpp + common/global_index/global_indexer_factory.cpp + common/io/buffered_input_stream.cpp + common/io/byte_array_input_stream.cpp + common/io/data_input_stream.cpp + common/io/data_output_stream.cpp + common/io/memory_segment_output_stream.cpp + common/io/offset_input_stream.cpp + common/io/cache/cache_key.cpp + common/io/cache/cache_manager.cpp + common/io/cache/lru_cache.cpp + common/logging/logging.cpp + common/lookup/sort/sort_lookup_store_factory.cpp + common/lookup/sort/sort_lookup_store_footer.cpp + common/lookup/lookup_store_factory.cpp + common/memory/bytes.cpp + common/memory/memory_pool.cpp + common/memory/memory_segment.cpp + common/memory/memory_segment_utils.cpp + common/memory/memory_slice.cpp + common/memory/memory_slice_output.cpp + common/metrics/metrics_impl.cpp + common/metrics/histogram.cpp + common/metrics/histogram_windowing.cpp + common/options/memory_size.cpp + common/options/time_duration.cpp + common/predicate/and.cpp + common/predicate/compound_predicate.cpp + common/predicate/contains.cpp + common/predicate/ends_with.cpp + common/predicate/equal.cpp + common/predicate/greater_or_equal.cpp + common/predicate/greater_than.cpp + common/predicate/in.cpp + common/predicate/is_not_null.cpp + common/predicate/is_null.cpp + common/predicate/leaf_predicate.cpp + common/predicate/less_or_equal.cpp + common/predicate/less_than.cpp + common/predicate/like.cpp + common/predicate/literal_converter.cpp + common/predicate/literal.cpp + common/predicate/not_equal.cpp + common/predicate/not_in.cpp + common/predicate/or.cpp + common/predicate/predicate_builder.cpp + common/predicate/predicate_utils.cpp + common/predicate/starts_with.cpp + common/reader/batch_reader.cpp + common/reader/concat_batch_reader.cpp + common/reader/predicate_batch_reader.cpp + common/reader/prefetch_file_batch_reader_impl.cpp + common/reader/reader_utils.cpp + common/reader/complete_row_kind_batch_reader.cpp + common/reader/data_evolution_file_reader.cpp + common/sst/block_handle.cpp + common/sst/block_iterator.cpp + common/sst/block_trailer.cpp + common/sst/block_reader.cpp + common/sst/block_writer.cpp + common/sst/sst_file_reader.cpp + common/sst/sst_file_writer.cpp + common/types/data_field.cpp + common/types/data_type.cpp + common/types/data_type_json_parser.cpp + common/types/row_kind.cpp + common/types/row_type.cpp + common/utils/file_type.cpp + common/utils/arrow/arrow_input_stream_adapter.cpp + common/utils/arrow/arrow_output_stream_adapter.cpp + common/utils/arrow/arrow_utils.cpp + common/utils/arrow/mem_utils.cpp + common/utils/binary_row_partition_computer.cpp + common/utils/bit_set.cpp + common/utils/bloom_filter.cpp + common/utils/bloom_filter64.cpp + common/utils/crc32c.cpp + common/utils/decimal_utils.cpp + common/utils/delta_varint_compressor.cpp + common/utils/fields_comparator.cpp + common/utils/path_util.cpp + common/utils/range.cpp + common/utils/read_ahead_cache.cpp + common/utils/byte_range_combiner.cpp + common/utils/roaring_bitmap32.cpp + common/utils/roaring_bitmap64.cpp + common/utils/row_range_index.cpp + common/utils/status.cpp + common/utils/string_utils.cpp) + +set(PAIMON_CORE_SRCS + core/disk/file_io_channel.cpp + core/mergetree/spill_reader.cpp + core/mergetree/spill_writer.cpp + core/append/append_only_writer.cpp + core/append/bucketed_append_compact_manager.cpp + core/bucket/bucket_select_converter.cpp + core/append/append_compact_task.cpp + core/append/append_compact_coordinator.cpp + core/bucket/hive_bucket_function.cpp + core/bucket/mod_bucket_function.cpp + core/bucket/bucket_id_calculator.cpp + core/casting/binary_to_string_cast_executor.cpp + core/casting/boolean_to_decimal_cast_executor.cpp + core/casting/boolean_to_numeric_cast_executor.cpp + core/casting/boolean_to_string_cast_executor.cpp + core/casting/casted_row.cpp + core/casting/cast_executor_factory.cpp + core/casting/date_to_string_cast_executor.cpp + core/casting/date_to_timestamp_cast_executor.cpp + core/casting/decimal_to_decimal_cast_executor.cpp + core/casting/decimal_to_numeric_primitive_cast_executor.cpp + core/casting/numeric_primitive_cast_executor.cpp + core/casting/numeric_primitive_to_decimal_cast_executor.cpp + core/casting/numeric_primitive_to_timestamp_cast_executor.cpp + core/casting/numeric_to_boolean_cast_executor.cpp + core/casting/numeric_to_string_cast_executor.cpp + core/casting/string_to_binary_cast_executor.cpp + core/casting/string_to_boolean_cast_executor.cpp + core/casting/string_to_date_cast_executor.cpp + core/casting/string_to_decimal_cast_executor.cpp + core/casting/string_to_numeric_primitive_cast_executor.cpp + core/casting/string_to_timestamp_cast_executor.cpp + core/casting/timestamp_to_date_cast_executor.cpp + core/casting/timestamp_to_numeric_primitive_cast_executor.cpp + core/casting/timestamp_to_string_cast_executor.cpp + core/casting/timestamp_to_timestamp_cast_executor.cpp + core/casting/casting_utils.cpp + core/catalog/catalog.cpp + core/catalog/file_system_catalog.cpp + core/catalog/identifier.cpp + core/core_options.cpp + core/deletionvectors/deletion_vector.cpp + core/deletionvectors/deletion_file_writer.cpp + core/deletionvectors/bitmap_deletion_vector.cpp + core/deletionvectors/deletion_vectors_index_file.cpp + core/deletionvectors/deletion_vector_index_file_writer.cpp + core/global_index/global_index_evaluator_impl.cpp + core/global_index/global_index_scan.cpp + core/global_index/global_index_scan_impl.cpp + core/global_index/global_index_write_task.cpp + core/index/index_file_handler.cpp + core/index/global_index_meta.cpp + core/index/index_file_meta_serializer.cpp + core/io/meta_to_arrow_array_converter.cpp + core/io/async_key_value_producer_and_consumer.cpp + core/io/data_file_meta_09_serializer.cpp + core/io/data_file_meta_10_serializer.cpp + core/io/data_file_meta_12_serializer.cpp + core/io/data_file_meta_first_row_id_legacy_serializer.cpp + core/io/data_file_meta.cpp + core/io/data_file_meta_serializer.cpp + core/io/data_file_path_factory.cpp + core/io/data_file_writer.cpp + core/io/field_mapping_reader.cpp + core/io/complete_row_tracking_fields_reader.cpp + core/io/file_index_evaluator.cpp + core/io/key_value_data_file_record_reader.cpp + core/io/key_value_data_file_writer.cpp + core/io/key_value_in_memory_record_reader.cpp + core/io/merged_key_value_record_reader.cpp + core/io/key_value_meta_projection_consumer.cpp + core/io/key_value_projection_consumer.cpp + core/io/key_value_projection_reader.cpp + core/io/multiple_blob_file_writer.cpp + core/io/rolling_blob_file_writer.cpp + core/manifest/file_kind.cpp + core/manifest/file_source.cpp + core/manifest/index_manifest_entry_serializer.cpp + core/manifest/index_manifest_file.cpp + core/manifest/manifest_entry.cpp + core/manifest/manifest_entry_serializer.cpp + core/manifest/manifest_entry_writer.cpp + core/manifest/manifest_file.cpp + core/manifest/manifest_file_meta.cpp + core/manifest/manifest_file_meta_serializer.cpp + core/manifest/manifest_list.cpp + core/manifest/partition_entry.cpp + core/manifest/index_manifest_file_handler.cpp + core/memory/writer_memory_manager.cpp + core/mergetree/compact/universal_compaction.cpp + core/mergetree/compact/early_full_compaction.cpp + core/mergetree/compact/aggregate/aggregate_merge_function.cpp + core/mergetree/compact/aggregate/field_sum_agg.cpp + core/mergetree/compact/interval_partition.cpp + core/mergetree/compact/loser_tree.cpp + core/mergetree/compact/merge_tree_compact_manager.cpp + core/mergetree/compact/merge_tree_compact_manager_factory.cpp + core/mergetree/compact/merge_tree_compact_rewriter.cpp + core/mergetree/compact/merge_tree_compact_task.cpp + core/mergetree/compact/partial_update_merge_function.cpp + core/mergetree/compact/sort_merge_reader_with_loser_tree.cpp + core/mergetree/compact/sort_merge_reader_with_min_heap.cpp + core/mergetree/compact/lookup_merge_tree_compact_rewriter.cpp + core/mergetree/compact/changelog_merge_tree_rewriter.cpp + core/mergetree/merge_tree_writer.cpp + core/mergetree/in_memory_sort_buffer.cpp + core/mergetree/external_sort_buffer.cpp + core/mergetree/spill_file_merger.cpp + core/mergetree/write_buffer.cpp + core/mergetree/levels.cpp + core/mergetree/lookup_file.cpp + core/mergetree/lookup_levels.cpp + core/mergetree/lookup/remote_lookup_file_manager.cpp + core/migrate/file_meta_utils.cpp + core/operation/data_evolution_file_store_scan.cpp + core/operation/data_evolution_split_read.cpp + core/operation/abstract_file_store_write.cpp + core/operation/abstract_split_read.cpp + core/operation/append_only_file_store_scan.cpp + core/operation/append_only_file_store_write.cpp + core/operation/commit_context.cpp + core/operation/expire_snapshots.cpp + core/operation/file_store_commit.cpp + core/operation/file_store_commit_impl.cpp + core/operation/file_store_scan.cpp + core/operation/file_store_write.cpp + core/operation/internal_read_context.cpp + core/operation/key_value_file_store_scan.cpp + core/operation/key_value_file_store_write.cpp + core/operation/manifest_file_merger.cpp + core/operation/merge_file_split_read.cpp + core/operation/blob_file_context.cpp + core/operation/orphan_files_cleaner.cpp + core/operation/orphan_files_cleaner_impl.cpp + core/operation/raw_file_split_read.cpp + core/operation/read_context.cpp + core/operation/scan_context.cpp + core/operation/write_context.cpp + core/operation/write_restore.cpp + core/postpone/postpone_bucket_writer.cpp + core/schema/arrow_schema_validator.cpp + core/schema/schema_manager.cpp + core/schema/schema_validation.cpp + core/schema/table_schema.cpp + core/snapshot.cpp + core/snapshot_info.cpp + core/stats/simple_stats_collector.cpp + core/stats/simple_stats_converter.cpp + core/stats/simple_stats.cpp + core/stats/simple_stats_evolution.cpp + core/table/table.cpp + core/table/sink/commit_message.cpp + core/table/sink/commit_message_impl.cpp + core/table/sink/commit_message_serializer.cpp + core/table/source/append_only_table_read.cpp + core/table/source/split.cpp + core/table/source/data_split_impl.cpp + core/table/source/data_table_batch_scan.cpp + core/table/source/data_table_stream_scan.cpp + core/table/source/fallback_table_read.cpp + core/table/source/key_value_table_read.cpp + core/table/source/merge_tree_split_generator.cpp + core/table/source/data_evolution_split_generator.cpp + core/table/source/plan_impl.cpp + core/table/source/snapshot/snapshot_reader.cpp + core/table/source/startup_mode.cpp + core/table/source/table_read.cpp + core/table/source/table_scan.cpp + core/table/source/data_evolution_batch_scan.cpp + core/table/system/audit_log_system_table.cpp + core/table/system/binlog_system_table.cpp + core/table/system/options_system_table.cpp + core/table/system/system_table.cpp + core/table/system/system_table_scan.cpp + core/table/system/system_table_schema.cpp + core/tag/tag.cpp + core/utils/field_mapping.cpp + core/utils/file_store_path_factory.cpp + core/utils/file_utils.cpp + core/utils/manifest_meta_reader.cpp + core/utils/partition_path_utils.cpp + core/utils/primary_key_table_utils.cpp + core/utils/snapshot_manager.cpp + core/utils/special_field_ids.cpp + core/utils/tag_manager.cpp) + +add_paimon_lib(paimon + SOURCES + ${PAIMON_COMMON_SRCS} + ${PAIMON_CORE_SRCS} + DEPENDENCIES + arrow + tbb + glog + fmt + roaring_bitmap + xxhash + Threads::Threads + RapidJSON + STATIC_LINK_LIBS + arrow + tbb + glog + dl + fmt + roaring_bitmap + xxhash + Threads::Threads + RapidJSON + SHARED_LINK_FLAGS + ${PAIMON_VERSION_SCRIPT_FLAGS}) + +add_subdirectory(common/file_index) +add_subdirectory(common/global_index) + +if(PAIMON_BUILD_TESTS) + add_paimon_test(memory_test + SOURCES + common/memory/memory_pool_test.cpp + common/memory/bytes_test.cpp + common/memory/memory_segment_test.cpp + common/memory/memory_segment_utils_test.cpp + common/memory/memory_slice_test.cpp + STATIC_LINK_LIBS + paimon_shared + test_utils_static + fmt + ${GTEST_LINK_TOOLCHAIN}) + + add_paimon_test(common_test + SOURCES + common/data/binary_array_test.cpp + common/data/binary_map_test.cpp + common/data/binary_row_test.cpp + common/data/binary_row_writer_test.cpp + common/data/binary_section_test.cpp + common/data/binary_string_test.cpp + common/data/columnar/columnar_array_test.cpp + common/data/columnar/columnar_row_test.cpp + common/data/columnar/columnar_utils_test.cpp + common/data/data_define_test.cpp + common/data/decimal_test.cpp + common/data/generic_row_test.cpp + common/data/internal_row_test.cpp + common/data/record_batch_test.cpp + common/data/serializer/binary_row_serializer_test.cpp + common/data/serializer/row_compacted_serializer_test.cpp + common/data/serializer/binary_serializer_utils_test.cpp + common/data/timestamp_test.cpp + common/data/blob_test.cpp + common/data/blob_descriptor_test.cpp + common/data/blob_utils_test.cpp + common/executor/default_executor_test.cpp + common/format/column_stats_test.cpp + common/fs/external_path_provider_test.cpp + common/file_index/file_indexer_factory_test.cpp + common/file_index/file_index_result_test.cpp + common/file_index/file_index_reader_test.cpp + common/file_index/file_index_format_test.cpp + common/file_index/empty/empty_file_index_reader_test.cpp + common/file_index/bitmap/bitmap_index_result_test.cpp + common/file_index/bitmap/bitmap_file_index_meta_test.cpp + common/file_index/bitmap/bitmap_file_index_test.cpp + common/file_index/bitmap/apply_bitmap_index_batch_reader_test.cpp + common/file_index/bsi/bit_slice_index_bitmap_file_index_test.cpp + common/file_index/bsi/bit_slice_index_roaring_bitmap_test.cpp + common/file_index/rangebitmap/bit_slice_index_bitmap_test.cpp + common/file_index/rangebitmap/dictionary/chunked_dictionary_test.cpp + common/file_index/rangebitmap/range_bitmap_file_index_test.cpp + common/file_index/rangebitmap/range_bitmap_io_test.cpp + common/file_index/bloomfilter/bloom_filter_file_index_test.cpp + common/file_index/bloomfilter/fast_hash_test.cpp + common/global_index/complete_index_score_batch_reader_test.cpp + common/global_index/global_index_result_test.cpp + common/global_index/global_index_utils_test.cpp + common/global_index/offset_global_index_reader_test.cpp + common/global_index/union_global_index_reader_test.cpp + common/global_index/global_indexer_factory_test.cpp + common/global_index/bitmap_global_index_result_test.cpp + common/global_index/bitmap_scored_global_index_result_test.cpp + common/global_index/bitmap/bitmap_global_index_test.cpp + common/global_index/btree/btree_index_meta_test.cpp + common/global_index/btree/btree_file_footer_test.cpp + common/global_index/btree/key_serializer_test.cpp + common/global_index/btree/btree_global_index_integration_test.cpp + common/global_index/btree/btree_compatibility_test.cpp + common/global_index/btree/btree_file_meta_selector_test.cpp + common/global_index/btree/lazy_filtered_btree_reader_test.cpp + common/global_index/rangebitmap/range_bitmap_global_index_test.cpp + common/global_index/wrap/file_index_reader_wrapper_test.cpp + common/io/byte_array_input_stream_test.cpp + common/io/data_input_output_stream_test.cpp + common/io/buffered_input_stream_test.cpp + common/io/memory_segment_output_stream_test.cpp + common/io/cache_input_stream_test.cpp + common/io/offset_input_stream_test.cpp + common/lookup/sort/sort_lookup_store_test.cpp + common/logging/logging_test.cpp + common/metrics/metrics_impl_test.cpp + common/metrics/histogram_test.cpp + common/metrics/histogram_windowing_test.cpp + common/options/memory_size_test.cpp + common/options/time_duration_test.cpp + common/predicate/literal_converter_test.cpp + common/predicate/literal_test.cpp + common/predicate/predicate_test.cpp + common/predicate/predicate_utils_test.cpp + common/predicate/predicate_validator_test.cpp + common/reader/concat_batch_reader_test.cpp + common/reader/predicate_batch_reader_test.cpp + common/reader/prefetch_file_batch_reader_impl_test.cpp + common/reader/reader_utils_test.cpp + common/reader/complete_row_kind_batch_reader_test.cpp + common/reader/data_evolution_file_reader_test.cpp + common/reader/data_evolution_array_test.cpp + common/reader/data_evolution_row_test.cpp + common/table/special_fields_test.cpp + common/types/data_field_test.cpp + common/types/data_type_json_parser_test.cpp + common/types/row_kind_test.cpp + common/types/data_type_test.cpp + common/utils/file_type_test.cpp + common/utils/row_range_index_test.cpp + common/utils/var_length_int_utils_test.cpp + common/utils/arrow/arrow_utils_test.cpp + common/utils/arrow/arrow_stream_adapter_test.cpp + common/utils/arrow/mem_utils_test.cpp + common/utils/arrow/status_utils_test.cpp + common/utils/concurrent_hash_map_test.cpp + common/utils/projected_row_test.cpp + common/utils/projected_array_test.cpp + common/utils/bit_set_test.cpp + common/utils/bloom_filter_test.cpp + common/utils/bloom_filter64_test.cpp + common/utils/xxhash_test.cpp + common/utils/binary_row_partition_computer_test.cpp + common/utils/bin_packing_test.cpp + common/utils/data_converter_utils_test.cpp + common/utils/date_time_utils_test.cpp + common/utils/delta_varint_compressor_test.cpp + common/utils/field_type_utils_test.cpp + common/utils/fields_comparator_test.cpp + common/utils/internal_row_utils_test.cpp + common/utils/jsonizable_test.cpp + common/utils/linked_hash_map_test.cpp + common/utils/long_counter_test.cpp + common/utils/math_test.cpp + common/utils/murmurhash_utils_test.cpp + common/utils/object_utils_test.cpp + common/utils/options_utils_test.cpp + common/utils/path_util_test.cpp + common/utils/preconditions_test.cpp + common/utils/rapidjson_util_test.cpp + common/utils/roaring_bitmap32_test.cpp + common/utils/roaring_bitmap64_test.cpp + common/utils/range_helper_test.cpp + common/utils/read_ahead_cache_test.cpp + common/io/cache/lru_cache_test.cpp + common/utils/byte_range_combiner_test.cpp + common/utils/scope_guard_test.cpp + common/utils/serialization_utils_test.cpp + common/utils/status_test.cpp + common/utils/stream_utils_test.cpp + common/utils/string_utils_test.cpp + common/utils/range_test.cpp + common/utils/uuid_test.cpp + common/utils/decimal_utils_test.cpp + common/utils/threadsafe_queue_test.cpp + common/utils/generic_lru_cache_test.cpp + STATIC_LINK_LIBS + paimon_shared + test_utils_static + ${TEST_STATIC_LINK_LIBS} + ${GTEST_LINK_TOOLCHAIN}) + + add_paimon_test(common_factories_test + SOURCES + common/factories/factory_creator_test.cpp + common/factories/io_hook_test.cpp + STATIC_LINK_LIBS + paimon_shared + test_utils_static + ${GTEST_LINK_TOOLCHAIN}) + + add_paimon_test(common_sst_file_format_test + SOURCES + common/compression/block_compression_factory_test.cpp + common/sst/sst_file_io_test.cpp + common/sst/block_cache_test.cpp + common/sst/block_meta_test.cpp + common/sst/block_write_read_test.cpp + common/utils/crc32c_test.cpp + STATIC_LINK_LIBS + paimon_shared + test_utils_static + "-Wl,--whole-archive" + paimon_local_file_system_static + "-Wl,--no-whole-archive" + ${GTEST_LINK_TOOLCHAIN}) + + add_paimon_test(core_test + SOURCES + core/append/append_only_writer_test.cpp + core/append/append_compact_coordinator_test.cpp + core/append/bucketed_append_compact_manager_test.cpp + core/bucket/bucket_select_converter_test.cpp + core/bucket/default_bucket_function_test.cpp + core/bucket/hive_bucket_function_test.cpp + core/bucket/bucket_id_calculator_test.cpp + core/bucket/mod_bucket_function_test.cpp + core/casting/cast_executor_factory_test.cpp + core/casting/cast_executor_test.cpp + core/casting/casted_row_test.cpp + core/casting/casting_utils_test.cpp + core/catalog/commit_table_request_test.cpp + core/catalog/renaming_snapshot_commit_test.cpp + core/catalog/file_system_catalog_test.cpp + core/catalog/catalog_test.cpp + core/catalog/identifier_test.cpp + core/compact/compact_deletion_file_test.cpp + core/compact/compact_future_manager_test.cpp + core/compact/noop_compact_manager_test.cpp + core/core_options_test.cpp + core/options/lookup_strategy_test.cpp + core/deletionvectors/apply_deletion_vector_batch_reader_test.cpp + core/deletionvectors/bitmap_deletion_vector_test.cpp + core/deletionvectors/bucketed_dv_maintainer_test.cpp + core/deletionvectors/deletion_file_writer_test.cpp + core/deletionvectors/deletion_vector_test.cpp + core/deletionvectors/deletion_vector_index_file_writer_test.cpp + core/deletionvectors/deletion_vectors_index_file_test.cpp + core/disk/io_manager_test.cpp + core/index/index_in_data_file_dir_path_factory_test.cpp + core/index/deletion_vector_meta_test.cpp + core/index/index_file_meta_serializer_test.cpp + core/index/index_file_handler_test.cpp + core/io/compact_increment_test.cpp + core/io/concat_key_value_record_reader_test.cpp + core/io/data_file_meta_serializer_test.cpp + core/io/data_file_path_factory_test.cpp + core/io/data_increment_test.cpp + core/io/field_mapping_reader_test.cpp + core/io/key_value_data_file_record_reader_test.cpp + core/io/key_value_projection_reader_test.cpp + core/io/key_value_in_memory_record_reader_test.cpp + core/io/merged_key_value_record_reader_test.cpp + core/io/complete_row_tracking_fields_reader_test.cpp + core/io/data_file_meta_test.cpp + core/io/file_index_evaluator_test.cpp + core/io/single_file_writer_test.cpp + core/io/rolling_blob_file_writer_test.cpp + core/global_index/indexed_split_test.cpp + core/manifest/file_source_test.cpp + core/manifest/file_kind_test.cpp + core/manifest/manifest_entry_writer_test.cpp + core/manifest/manifest_committable_test.cpp + core/manifest/manifest_entry_serializer_test.cpp + core/manifest/manifest_file_meta_serializer_test.cpp + core/manifest/manifest_file_test.cpp + core/manifest/manifest_list_test.cpp + core/manifest/partition_entry_test.cpp + core/manifest/file_entry_test.cpp + core/manifest/index_manifest_entry_serializer_test.cpp + core/manifest/index_manifest_file_handler_test.cpp + core/memory/writer_memory_manager_test.cpp + core/mergetree/levels_test.cpp + core/mergetree/lookup_file_test.cpp + core/mergetree/lookup_levels_test.cpp + core/mergetree/compact/aggregate/aggregate_merge_function_test.cpp + core/mergetree/compact/aggregate/field_aggregator_factory_test.cpp + core/mergetree/compact/aggregate/field_bool_agg_test.cpp + core/mergetree/compact/aggregate/field_first_non_null_value_agg_test.cpp + core/mergetree/compact/aggregate/field_first_value_agg_test.cpp + core/mergetree/compact/aggregate/field_ignore_retract_agg_test.cpp + core/mergetree/compact/aggregate/field_last_non_null_value_agg_test.cpp + core/mergetree/compact/aggregate/field_last_value_agg_test.cpp + core/mergetree/compact/aggregate/field_listagg_agg_test.cpp + core/mergetree/compact/aggregate/field_min_max_agg_test.cpp + core/mergetree/compact/aggregate/field_primary_key_agg_test.cpp + core/mergetree/compact/aggregate/field_sum_agg_test.cpp + core/mergetree/compact/deduplicate_merge_function_test.cpp + core/mergetree/compact/first_row_merge_function_test.cpp + core/mergetree/compact/first_row_merge_function_wrapper_test.cpp + core/mergetree/compact/interval_partition_test.cpp + core/mergetree/compact/lookup_changelog_merge_function_wrapper_test.cpp + core/mergetree/compact/lookup_merge_tree_compact_rewriter_test.cpp + core/mergetree/compact/lookup_merge_function_test.cpp + core/mergetree/compact/partial_update_merge_function_test.cpp + core/mergetree/compact/reducer_merge_function_wrapper_test.cpp + core/mergetree/compact/sort_merge_reader_test.cpp + core/mergetree/compact/off_peak_hours_test.cpp + core/mergetree/compact/early_full_compaction_test.cpp + core/mergetree/compact/universal_compaction_test.cpp + core/mergetree/compact/force_up_level0_compaction_test.cpp + core/mergetree/compact/compact_strategy_test.cpp + core/mergetree/compact/file_rewrite_compact_task_test.cpp + core/mergetree/compact/merge_tree_compact_manager_test.cpp + core/mergetree/compact/merge_tree_compact_manager_factory_test.cpp + core/mergetree/compact/merge_tree_compact_rewriter_test.cpp + core/mergetree/lookup/persist_processor_test.cpp + core/mergetree/lookup/remote_lookup_file_manager_test.cpp + core/mergetree/drop_delete_reader_test.cpp + core/mergetree/merge_tree_writer_test.cpp + core/mergetree/write_buffer_test.cpp + core/mergetree/sort_buffer_test.cpp + core/mergetree/spill_file_merger_test.cpp + core/mergetree/sorted_run_test.cpp + core/mergetree/spill_channel_manager_test.cpp + core/mergetree/spill_reader_writer_test.cpp + core/migrate/file_meta_utils_test.cpp + core/operation/metrics/compaction_metrics_test.cpp + core/operation/data_evolution_file_store_scan_test.cpp + core/operation/data_evolution_split_read_test.cpp + core/operation/key_value_file_store_write_test.cpp + core/operation/internal_read_context_test.cpp + core/operation/abstract_split_read_test.cpp + core/operation/append_only_file_store_write_test.cpp + core/operation/commit_metrics_test.cpp + core/operation/expire_snapshots_test.cpp + core/operation/file_store_commit_impl_test.cpp + core/operation/file_store_commit_test.cpp + core/operation/append_only_file_store_scan_test.cpp + core/operation/key_value_file_store_scan_test.cpp + core/operation/file_store_scan_test.cpp + core/operation/file_system_write_restore_test.cpp + core/operation/file_store_write_test.cpp + core/operation/manifest_file_merger_test.cpp + core/operation/merge_file_split_read_test.cpp + core/operation/blob_file_context_test.cpp + core/operation/orphan_files_cleaner_test.cpp + core/operation/raw_file_split_read_test.cpp + core/operation/read_context_test.cpp + core/operation/scan_context_test.cpp + core/operation/write_restore_test.cpp + core/operation/write_context_test.cpp + core/partition/partition_statistics_test.cpp + core/postpone/postpone_bucket_writer_test.cpp + core/schema/schema_manager_test.cpp + core/schema/schema_validation_test.cpp + core/schema/arrow_schema_validator_test.cpp + core/schema/table_schema_test.cpp + core/snapshot_test.cpp + core/stats/simple_stats_evolution_test.cpp + core/stats/simple_stats_collector_test.cpp + core/stats/simple_stats_test.cpp + core/table/table_test.cpp + core/table/sink/commit_message_test.cpp + core/table/sink/commit_message_impl_test.cpp + core/table/source/fallback_data_split_test.cpp + core/table/source/table_read_test.cpp + core/table/source/data_split_test.cpp + core/table/source/deletion_file_test.cpp + core/table/source/split_generator_test.cpp + core/table/source/startup_mode_test.cpp + core/table/source/table_scan_test.cpp + core/table/system/system_table_test.cpp + core/tag/tag_test.cpp + core/utils/branch_manager_test.cpp + core/utils/file_store_path_factory_cache_test.cpp + core/utils/field_mapping_test.cpp + core/utils/file_store_path_factory_test.cpp + core/utils/file_utils_test.cpp + core/utils/manifest_meta_reader_test.cpp + core/utils/offset_row_test.cpp + core/utils/partition_path_utils_test.cpp + core/utils/snapshot_manager_test.cpp + core/utils/tag_manager_test.cpp + core/utils/primary_key_table_utils_test.cpp + core/utils/index_file_path_factories_test.cpp + STATIC_LINK_LIBS + paimon_shared + test_utils_static + ${TEST_STATIC_LINK_LIBS} + ${GTEST_LINK_TOOLCHAIN}) + + add_paimon_test(fs_test + SOURCES + common/fs/file_system_test.cpp + common/fs/resolving_file_system_test.cpp + fs/local/local_file_test.cpp + # fs/jindo/jindo_file_system_factory_test.cpp + # fs/jindo/jindo_file_system_test.cpp + STATIC_LINK_LIBS + paimon_shared + "-Wl,--whole-archive" + paimon_local_file_system_static + # paimon_jindo_file_system_static + "-Wl,--no-whole-archive" + test_utils_static + ${GTEST_LINK_TOOLCHAIN}) + +endif() diff --git a/src/paimon/common/file_index/CMakeLists.txt b/src/paimon/common/file_index/CMakeLists.txt new file mode 100644 index 0000000..9a1419e --- /dev/null +++ b/src/paimon/common/file_index/CMakeLists.txt @@ -0,0 +1,52 @@ +# 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. + +set(PAIMON_FILE_INDEX_SRC + bitmap/bitmap_file_index_factory.cpp + bitmap/bitmap_file_index.cpp + bitmap/bitmap_file_index_meta.cpp + bitmap/bitmap_file_index_meta_v1.cpp + bitmap/bitmap_file_index_meta_v2.cpp + bsi/bit_slice_index_bitmap_file_index.cpp + bsi/bit_slice_index_bitmap_file_index_factory.cpp + bsi/bit_slice_index_roaring_bitmap.cpp + bloomfilter/bloom_filter_file_index.cpp + bloomfilter/bloom_filter_file_index_factory.cpp + bloomfilter/fast_hash.cpp + rangebitmap/dictionary/chunked_dictionary.cpp + rangebitmap/dictionary/fixed_length_chunk.cpp + rangebitmap/dictionary/key_factory.cpp + rangebitmap/utils/literal_serialization_utils.cpp + rangebitmap/bit_slice_index_bitmap.cpp + rangebitmap/range_bitmap.cpp + rangebitmap/range_bitmap_file_index.cpp + rangebitmap/range_bitmap_file_index_factory.cpp) + +add_paimon_lib(paimon_file_index + SOURCES + ${PAIMON_FILE_INDEX_SRC} + DEPENDENCIES + paimon_shared + STATIC_LINK_LIBS + arrow + fmt + xxhash + dl + Threads::Threads + SHARED_LINK_LIBS + paimon_shared + SHARED_LINK_FLAGS + ${PAIMON_VERSION_SCRIPT_FLAGS}) diff --git a/src/paimon/common/global_index/CMakeLists.txt b/src/paimon/common/global_index/CMakeLists.txt new file mode 100644 index 0000000..7805e3a --- /dev/null +++ b/src/paimon/common/global_index/CMakeLists.txt @@ -0,0 +1,49 @@ +# 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. + +set(PAIMON_GLOBAL_INDEX_SRC + bitmap/bitmap_global_index.cpp + bitmap/bitmap_global_index_factory.cpp + btree/btree_file_footer.cpp + btree/btree_global_index_factory.cpp + btree/btree_global_indexer.cpp + btree/btree_global_index_reader.cpp + btree/btree_global_index_writer.cpp + btree/btree_file_meta_selector.cpp + btree/btree_index_meta.cpp + btree/lazy_filtered_btree_reader.cpp + btree/key_serializer.cpp + rangebitmap/range_bitmap_global_index.cpp + rangebitmap/range_bitmap_global_index_factory.cpp + offset_global_index_reader.cpp + union_global_index_reader.cpp) + +add_paimon_lib(paimon_global_index + SOURCES + ${PAIMON_GLOBAL_INDEX_SRC} + DEPENDENCIES + paimon_shared + paimon_file_index_shared + STATIC_LINK_LIBS + arrow + fmt + dl + Threads::Threads + SHARED_LINK_LIBS + paimon_shared + paimon_file_index_shared + SHARED_LINK_FLAGS + ${PAIMON_VERSION_SCRIPT_FLAGS}) diff --git a/src/paimon/format/avro/CMakeLists.txt b/src/paimon/format/avro/CMakeLists.txt new file mode 100644 index 0000000..8aa593b --- /dev/null +++ b/src/paimon/format/avro/CMakeLists.txt @@ -0,0 +1,74 @@ +# 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. + +if(PAIMON_ENABLE_AVRO) + + set(PAIMON_AVRO_FILE_FORMAT + avro_direct_decoder.cpp + avro_direct_encoder.cpp + avro_file_batch_reader.cpp + avro_file_format.cpp + avro_file_format_factory.cpp + avro_format_writer.cpp + avro_input_stream_impl.cpp + avro_output_stream_impl.cpp + avro_schema_converter.cpp + avro_stats_extractor.cpp) + + add_paimon_lib(paimon_avro_file_format + SOURCES + ${PAIMON_AVRO_FILE_FORMAT} + DEPENDENCIES + paimon_shared + avro + STATIC_LINK_LIBS + arrow + glog + fmt + avro + tbb + dl + Threads::Threads + SHARED_LINK_LIBS + paimon_shared + SHARED_LINK_FLAGS + ${PAIMON_VERSION_SCRIPT_FLAGS}) + + if(PAIMON_BUILD_TESTS) + add_paimon_test(avro_format_test + SOURCES + avro_direct_encoder_decoder_test.cpp + avro_file_batch_reader_test.cpp + avro_file_format_test.cpp + avro_format_writer_test.cpp + avro_input_stream_impl_test.cpp + avro_schema_converter_test.cpp + avro_stats_extractor_test.cpp + avro_writer_builder_test.cpp + STATIC_LINK_LIBS + paimon_shared + test_utils_static + "-Wl,--whole-archive" + paimon_local_file_system_static + paimon_avro_file_format_static + "-Wl,--no-whole-archive" + ${GTEST_LINK_TOOLCHAIN} + EXTRA_LINK_LIBS + avro) + + endif() + +endif() diff --git a/src/paimon/format/blob/CMakeLists.txt b/src/paimon/format/blob/CMakeLists.txt new file mode 100644 index 0000000..4400ba0 --- /dev/null +++ b/src/paimon/format/blob/CMakeLists.txt @@ -0,0 +1,55 @@ +# 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. + +set(PAIMON_BLOB_FILE_FORMAT blob_file_batch_reader.cpp blob_file_format_factory.cpp + blob_format_writer.cpp blob_stats_extractor.cpp) + +add_paimon_lib(paimon_blob_file_format + SOURCES + ${PAIMON_BLOB_FILE_FORMAT} + EXTRA_INCLUDES + ${BLOB_INCLUDE_DIR} + DEPENDENCIES + paimon_shared + STATIC_LINK_LIBS + arrow + fmt + dl + Threads::Threads + SHARED_LINK_LIBS + paimon_shared + SHARED_LINK_FLAGS + ${PAIMON_VERSION_SCRIPT_FLAGS}) + +if(PAIMON_BUILD_TESTS) + add_paimon_test(blob_format_test + SOURCES + blob_format_writer_test.cpp + blob_file_batch_reader_test.cpp + blob_stats_extractor_test.cpp + blob_writer_builder_test.cpp + blob_file_format_factory_test.cpp + EXTRA_INCLUDES + ${BLOB_INCLUDE_DIR} + STATIC_LINK_LIBS + paimon_shared + test_utils_static + "-Wl,--whole-archive" + paimon_local_file_system_static + paimon_blob_file_format_static + "-Wl,--no-whole-archive" + ${GTEST_LINK_TOOLCHAIN}) +endif() diff --git a/src/paimon/format/orc/CMakeLists.txt b/src/paimon/format/orc/CMakeLists.txt new file mode 100644 index 0000000..25b44a5 --- /dev/null +++ b/src/paimon/format/orc/CMakeLists.txt @@ -0,0 +1,74 @@ +# 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. + +if(PAIMON_ENABLE_ORC) + + set(PAIMON_ORC_FILE_FORMAT + predicate_converter.cpp + orc_reader_wrapper.cpp + read_range_generator.cpp + orc_file_format_factory.cpp + orc_file_batch_reader.cpp + orc_input_stream_impl.cpp + orc_output_stream_impl.cpp + orc_adapter.cpp + orc_stats_extractor.cpp + orc_format_writer.cpp) + + add_paimon_lib(paimon_orc_file_format + SOURCES + ${PAIMON_ORC_FILE_FORMAT} + DEPENDENCIES + paimon_shared + orc::orc + STATIC_LINK_LIBS + arrow + glog + fmt + orc::orc + tbb + dl + Threads::Threads + SHARED_LINK_LIBS + paimon_shared + SHARED_LINK_FLAGS + ${PAIMON_VERSION_SCRIPT_FLAGS}) + + if(PAIMON_BUILD_TESTS) + add_paimon_test(orc_format_test + SOURCES + complex_predicate_test.cpp + predicate_converter_test.cpp + predicate_pushdown_test.cpp + read_range_generator_test.cpp + orc_reader_wrapper_test.cpp + orc_input_output_stream_test.cpp + orc_adapter_test.cpp + orc_stats_extractor_test.cpp + orc_format_writer_test.cpp + orc_file_batch_reader_test.cpp + STATIC_LINK_LIBS + paimon_shared + test_utils_static + "-Wl,--whole-archive" + paimon_local_file_system_static + paimon_orc_file_format_static + "-Wl,--no-whole-archive" + ${GTEST_LINK_TOOLCHAIN} + EXTRA_LINK_LIBS + orc::orc) + endif() +endif() diff --git a/src/paimon/format/parquet/CMakeLists.txt b/src/paimon/format/parquet/CMakeLists.txt new file mode 100644 index 0000000..3dedd91 --- /dev/null +++ b/src/paimon/format/parquet/CMakeLists.txt @@ -0,0 +1,68 @@ +# 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. + +set(PAIMON_PARQUET_FILE_FORMAT + parquet_field_id_converter.cpp + predicate_converter.cpp + file_reader_wrapper.cpp + parquet_timestamp_converter.cpp + parquet_file_batch_reader.cpp + parquet_file_format_factory.cpp + parquet_format_writer.cpp + parquet_schema_util.cpp + parquet_stats_extractor.cpp + parquet_writer_builder.cpp) + +add_paimon_lib(paimon_parquet_file_format + SOURCES + ${PAIMON_PARQUET_FILE_FORMAT} + DEPENDENCIES + paimon_shared + parquet + STATIC_LINK_LIBS + parquet + arrow + glog + fmt + dl + Threads::Threads + SHARED_LINK_LIBS + paimon_shared + SHARED_LINK_FLAGS + ${PAIMON_VERSION_SCRIPT_FLAGS}) + +if(PAIMON_BUILD_TESTS) + add_paimon_test(parquet_format_test + SOURCES + file_reader_wrapper_test.cpp + parquet_timestamp_converter_test.cpp + parquet_field_id_converter_test.cpp + parquet_file_batch_reader_test.cpp + parquet_format_writer_test.cpp + parquet_stats_extractor_test.cpp + parquet_writer_builder_test.cpp + predicate_converter_test.cpp + predicate_pushdown_test.cpp + STATIC_LINK_LIBS + paimon_shared + test_utils_static + "-Wl,--whole-archive" + paimon_local_file_system_static + paimon_parquet_file_format_static + "-Wl,--no-whole-archive" + parquet + ${GTEST_LINK_TOOLCHAIN}) +endif() diff --git a/src/paimon/fs/local/CMakeLists.txt b/src/paimon/fs/local/CMakeLists.txt new file mode 100644 index 0000000..26db2f4 --- /dev/null +++ b/src/paimon/fs/local/CMakeLists.txt @@ -0,0 +1,30 @@ +# 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. + +set(PAIMON_LOCAL_FILE_SYSTEM local_file.cpp local_file_system.cpp + local_file_system_factory.cpp) + +add_paimon_lib(paimon_local_file_system + SOURCES + ${PAIMON_LOCAL_FILE_SYSTEM} + DEPENDENCIES + paimon_shared + STATIC_LINK_LIBS + fmt + SHARED_LINK_LIBS + paimon_shared + SHARED_LINK_FLAGS + ${PAIMON_VERSION_SCRIPT_FLAGS}) diff --git a/src/paimon/global_index/lucene/CMakeLists.txt b/src/paimon/global_index/lucene/CMakeLists.txt new file mode 100644 index 0000000..8ffcc59 --- /dev/null +++ b/src/paimon/global_index/lucene/CMakeLists.txt @@ -0,0 +1,74 @@ +# 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. + +if(PAIMON_ENABLE_LUCENE) + set(PAIMON_LUCENE + lucene_global_index.cpp + lucene_directory.cpp + lucene_utils.cpp + jieba_analyzer.cpp + lucene_global_index_writer.cpp + lucene_global_index_reader.cpp + lucene_global_index_factory.cpp) + + add_paimon_lib(paimon_lucene_index + SOURCES + ${PAIMON_LUCENE} + EXTRA_INCLUDES + ${LUCENE_INCLUDE_DIR} + ${JIEBA_INCLUDE_DIR} + DEPENDENCIES + paimon_shared + lucene + jieba + STATIC_LINK_LIBS + lucene + arrow + fmt + dl + Threads::Threads + SHARED_LINK_LIBS + paimon_shared + SHARED_LINK_FLAGS + ${PAIMON_VERSION_SCRIPT_FLAGS}) + if(PAIMON_BUILD_TESTS) + target_compile_definitions(paimon_lucene_index_objlib + PRIVATE JIEBA_TEST_DICT_DIR="${JIEBA_DICT_DIR}") + + endif() + + if(PAIMON_BUILD_TESTS) + add_paimon_test(lucene_index_test + SOURCES + jieba_analyzer_test.cpp + lucene_api_test.cpp + jieba_api_test.cpp + lucene_directory_test.cpp + lucene_global_index_test.cpp + lucene_filter_test.cpp + EXTRA_INCLUDES + ${LUCENE_INCLUDE_DIR} + STATIC_LINK_LIBS + paimon_shared + test_utils_static + "-Wl,--whole-archive" + paimon_local_file_system_static + paimon_lucene_index_static + "-Wl,--no-whole-archive" + ${GTEST_LINK_TOOLCHAIN}) + + endif() +endif() diff --git a/src/paimon/testing/mock/CMakeLists.txt b/src/paimon/testing/mock/CMakeLists.txt new file mode 100644 index 0000000..2e54330 --- /dev/null +++ b/src/paimon/testing/mock/CMakeLists.txt @@ -0,0 +1,34 @@ +# 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. + +if(PAIMON_BUILD_TESTS) + set(PAIMON_MOCK_FILE_FORMAT + mock_file_system_factory.cpp + mock_file_format_factory.cpp + mock_file_format.cpp + mock_format_writer_builder.cpp + mock_format_writer.cpp + mock_stats_extractor.cpp) + + add_paimon_lib(paimon_mock_file_format + SOURCES + ${PAIMON_MOCK_FILE_FORMAT} + DEPENDENCIES + paimon_shared + SHARED_LINK_LIBS + paimon_shared) + +endif() diff --git a/src/paimon/testing/utils/CMakeLists.txt b/src/paimon/testing/utils/CMakeLists.txt new file mode 100644 index 0000000..96281f8 --- /dev/null +++ b/src/paimon/testing/utils/CMakeLists.txt @@ -0,0 +1,42 @@ +# 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. + +if(PAIMON_BUILD_TESTS) + + set(PAIMON_TEST_UTILS testharness.cpp data_generator.cpp) + + add_paimon_lib(test_utils + SOURCES + ${PAIMON_TEST_UTILS} + DEPENDENCIES + paimon_static + arrow + STATIC_LINK_LIBS + paimon_static + ${GTEST_LINK_TOOLCHAIN}) + + add_paimon_test(test_utils_test + SOURCES + data_generator_test.cpp + STATIC_LINK_LIBS + paimon_shared + "-Wl,--whole-archive" + paimon_local_file_system_shared + "-Wl,--no-whole-archive" + test_utils_static + ${GTEST_LINK_TOOLCHAIN}) + +endif() diff --git a/test/inte/CMakeLists.txt b/test/inte/CMakeLists.txt new file mode 100644 index 0000000..e9e4814 --- /dev/null +++ b/test/inte/CMakeLists.txt @@ -0,0 +1,102 @@ +# 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. + +if(PAIMON_BUILD_TESTS) + add_paimon_test(blob_table_inte_test + STATIC_LINK_LIBS + paimon_shared + ${TEST_STATIC_LINK_LIBS} + test_utils_static + ${GTEST_LINK_TOOLCHAIN}) + + add_paimon_test(data_evolution_table_test + STATIC_LINK_LIBS + paimon_shared + ${TEST_STATIC_LINK_LIBS} + test_utils_static + ${GTEST_LINK_TOOLCHAIN}) + + add_paimon_test(global_index_test + STATIC_LINK_LIBS + paimon_shared + ${TEST_STATIC_LINK_LIBS} + test_utils_static + ${GTEST_LINK_TOOLCHAIN}) + + add_paimon_test(write_and_read_inte_test + STATIC_LINK_LIBS + paimon_shared + ${TEST_STATIC_LINK_LIBS} + test_utils_static + ${GTEST_LINK_TOOLCHAIN}) + + add_paimon_test(clean_inte_test + STATIC_LINK_LIBS + paimon_shared + ${TEST_STATIC_LINK_LIBS} + test_utils_static + ${GTEST_LINK_TOOLCHAIN}) + + add_paimon_test(read_inte_test + STATIC_LINK_LIBS + paimon_shared + ${TEST_STATIC_LINK_LIBS} + test_utils_static + ${GTEST_LINK_TOOLCHAIN}) + + add_paimon_test(scan_and_read_inte_test + STATIC_LINK_LIBS + paimon_shared + ${TEST_STATIC_LINK_LIBS} + test_utils_static + ${GTEST_LINK_TOOLCHAIN}) + + add_paimon_test(scan_inte_test + STATIC_LINK_LIBS + paimon_shared + ${TEST_STATIC_LINK_LIBS} + test_utils_static + ${GTEST_LINK_TOOLCHAIN}) + + add_paimon_test(write_inte_test + STATIC_LINK_LIBS + paimon_shared + ${TEST_STATIC_LINK_LIBS} + test_utils_static + ${GTEST_LINK_TOOLCHAIN}) + + add_paimon_test(read_inte_with_index_test + STATIC_LINK_LIBS + paimon_shared + ${TEST_STATIC_LINK_LIBS} + test_utils_static + ${GTEST_LINK_TOOLCHAIN}) + + add_paimon_test(append_compaction_inte_test + STATIC_LINK_LIBS + paimon_shared + ${TEST_STATIC_LINK_LIBS} + test_utils_static + ${GTEST_LINK_TOOLCHAIN}) + + add_paimon_test(pk_compaction_inte_test + STATIC_LINK_LIBS + paimon_shared + ${TEST_STATIC_LINK_LIBS} + test_utils_static + ${GTEST_LINK_TOOLCHAIN}) + +endif()