From 510f7221dee988e220e7212994e45d97f4cf4f39 Mon Sep 17 00:00:00 2001 From: robot-clickhouse Date: Wed, 25 Sep 2024 22:15:52 +0000 Subject: [PATCH] Backport #69914 to 24.9: Remove dbms dependency on clickhouse_functions --- cmake/dbms_glob_sources.cmake | 6 ++-- programs/library-bridge/CMakeLists.txt | 1 - programs/odbc-bridge/CMakeLists.txt | 1 - src/Access/examples/CMakeLists.txt | 2 +- src/AggregateFunctions/CMakeLists.txt | 13 ++++----- .../examples/CMakeLists.txt | 4 +-- src/AggregateFunctions/fuzzers/CMakeLists.txt | 2 +- src/CMakeLists.txt | 22 ++++++++++++++ src/Client/examples/CMakeLists.txt | 2 +- src/Columns/benchmarks/CMakeLists.txt | 3 +- src/Common/ZooKeeper/examples/CMakeLists.txt | 3 -- src/Common/benchmarks/CMakeLists.txt | 4 +-- src/Common/examples/CMakeLists.txt | 22 +++++++------- src/Common/mysqlxx/tests/CMakeLists.txt | 2 +- src/Compression/examples/CMakeLists.txt | 2 +- src/Compression/fuzzers/CMakeLists.txt | 12 ++++---- src/Core/examples/CMakeLists.txt | 4 +-- src/Core/fuzzers/CMakeLists.txt | 2 +- src/DataTypes/fuzzers/CMakeLists.txt | 2 +- src/Dictionaries/CMakeLists.txt | 8 ++--- src/Formats/fuzzers/CMakeLists.txt | 2 +- src/Functions/CMakeLists.txt | 29 +++++++++++++++++++ src/Functions/GatherUtils/CMakeLists.txt | 15 ++++++++++ src/Functions/array/CMakeLists.txt | 13 +++++++++ src/IO/examples/CMakeLists.txt | 6 ++-- src/Interpreters/examples/CMakeLists.txt | 22 +++++++------- src/Interpreters/fuzzers/CMakeLists.txt | 1 - src/Parsers/examples/CMakeLists.txt | 4 +-- src/Storages/examples/CMakeLists.txt | 6 ++-- src/Storages/fuzzers/CMakeLists.txt | 4 +-- src/TableFunctions/CMakeLists.txt | 2 ++ 31 files changed, 146 insertions(+), 75 deletions(-) diff --git a/cmake/dbms_glob_sources.cmake b/cmake/dbms_glob_sources.cmake index fbe7f96cea3..01d999f3341 100644 --- a/cmake/dbms_glob_sources.cmake +++ b/cmake/dbms_glob_sources.cmake @@ -12,11 +12,13 @@ macro(add_headers_only prefix common_path) add_glob(${prefix}_headers ${common_path}/*.h) endmacro() +# Assumes the path is under src and that src/ needs to be removed (valid for any subdirectory under src/) macro(extract_into_parent_list src_list dest_list) list(REMOVE_ITEM ${src_list} ${ARGN}) - get_filename_component(__dir_name ${CMAKE_CURRENT_SOURCE_DIR} NAME) + file(RELATIVE_PATH relative ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) + string(REPLACE "src/" "" relative ${relative}) foreach(file IN ITEMS ${ARGN}) - list(APPEND ${dest_list} ${__dir_name}/${file}) + list(APPEND ${dest_list} ${relative}/${file}) endforeach() set(${dest_list} "${${dest_list}}" PARENT_SCOPE) endmacro() diff --git a/programs/library-bridge/CMakeLists.txt b/programs/library-bridge/CMakeLists.txt index 86410d712ec..c5efb6afadc 100644 --- a/programs/library-bridge/CMakeLists.txt +++ b/programs/library-bridge/CMakeLists.txt @@ -19,7 +19,6 @@ target_link_libraries(clickhouse-library-bridge PRIVATE daemon dbms bridge - clickhouse_functions ) set_target_properties(clickhouse-library-bridge PROPERTIES RUNTIME_OUTPUT_DIRECTORY ..) diff --git a/programs/odbc-bridge/CMakeLists.txt b/programs/odbc-bridge/CMakeLists.txt index 14af330f788..f0c622af587 100644 --- a/programs/odbc-bridge/CMakeLists.txt +++ b/programs/odbc-bridge/CMakeLists.txt @@ -24,7 +24,6 @@ target_link_libraries(clickhouse-odbc-bridge PRIVATE clickhouse_parsers ch_contrib::nanodbc ch_contrib::unixodbc - clickhouse_functions ) set_target_properties(clickhouse-odbc-bridge PROPERTIES RUNTIME_OUTPUT_DIRECTORY ..) diff --git a/src/Access/examples/CMakeLists.txt b/src/Access/examples/CMakeLists.txt index 18f40c2ef14..99d040cec68 100644 --- a/src/Access/examples/CMakeLists.txt +++ b/src/Access/examples/CMakeLists.txt @@ -1,4 +1,4 @@ if (TARGET ch_contrib::krb5) clickhouse_add_executable (kerberos_init kerberos_init.cpp) - target_link_libraries (kerberos_init PRIVATE dbms clickhouse_functions ch_contrib::krb5) + target_link_libraries (kerberos_init PRIVATE dbms ch_contrib::krb5) endif() diff --git a/src/AggregateFunctions/CMakeLists.txt b/src/AggregateFunctions/CMakeLists.txt index 9471934aec8..f02f3566125 100644 --- a/src/AggregateFunctions/CMakeLists.txt +++ b/src/AggregateFunctions/CMakeLists.txt @@ -3,20 +3,17 @@ add_headers_and_sources(clickhouse_aggregate_functions .) add_headers_and_sources(clickhouse_aggregate_functions Combinators) extract_into_parent_list(clickhouse_aggregate_functions_sources dbms_sources - IAggregateFunction.cpp - AggregateFunctionFactory.cpp - Combinators/AggregateFunctionCombinatorFactory.cpp - Combinators/AggregateFunctionState.cpp - AggregateFunctionCount.cpp - parseAggregateFunctionParameters.cpp + AggregateFunctionFactory.cpp # AggregateFunctionFactory::instance() Used many times + Combinators/AggregateFunctionCombinatorFactory.cpp # AggregateFunctionCombinatorFactory::instance() Used by AggregateFunctionFactory.cpp + AggregateFunctionCount.cpp # Used in optimizeUseAggregateProjection.cpp + IAggregateFunction.cpp # For AggregateFunctionCount.cpp, WindowTransform.cpp, FunctionsConversion.cpp... + parseAggregateFunctionParameters.cpp # getAggregateFunctionNameAndParametersArray, getAggregateFunctionParametersArray (Graphite.cpp, ExpressionAnalyzer.cpp) ) extract_into_parent_list(clickhouse_aggregate_functions_headers dbms_headers IAggregateFunction.h Combinators/IAggregateFunctionCombinator.h AggregateFunctionFactory.h Combinators/AggregateFunctionCombinatorFactory.h - Combinators/AggregateFunctionState.h - AggregateFunctionCount.cpp FactoryHelpers.h parseAggregateFunctionParameters.h ) diff --git a/src/AggregateFunctions/examples/CMakeLists.txt b/src/AggregateFunctions/examples/CMakeLists.txt index 8ded1e5472a..a9033fd8508 100644 --- a/src/AggregateFunctions/examples/CMakeLists.txt +++ b/src/AggregateFunctions/examples/CMakeLists.txt @@ -1,5 +1,5 @@ clickhouse_add_executable (quantile-t-digest quantile-t-digest.cpp) -target_link_libraries (quantile-t-digest PRIVATE dbms clickhouse_functions clickhouse_aggregate_functions) +target_link_libraries (quantile-t-digest PRIVATE dbms clickhouse_aggregate_functions) clickhouse_add_executable (group_array_sorted group_array_sorted.cpp) -target_link_libraries (group_array_sorted PRIVATE dbms clickhouse_functions clickhouse_aggregate_functions) +target_link_libraries (group_array_sorted PRIVATE dbms clickhouse_aggregate_functions) diff --git a/src/AggregateFunctions/fuzzers/CMakeLists.txt b/src/AggregateFunctions/fuzzers/CMakeLists.txt index 1ce0c52feb7..6a7be0d4377 100644 --- a/src/AggregateFunctions/fuzzers/CMakeLists.txt +++ b/src/AggregateFunctions/fuzzers/CMakeLists.txt @@ -1,2 +1,2 @@ clickhouse_add_executable(aggregate_function_state_deserialization_fuzzer aggregate_function_state_deserialization_fuzzer.cpp ${SRCS}) -target_link_libraries(aggregate_function_state_deserialization_fuzzer PRIVATE clickhouse_functions clickhouse_aggregate_functions) +target_link_libraries(aggregate_function_state_deserialization_fuzzer PRIVATE clickhouse_aggregate_functions) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f0410eee9fe..82ba9c8d02d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -72,6 +72,28 @@ add_subdirectory (Daemon) add_subdirectory (Loggers) add_subdirectory (Formats) +if (OMIT_HEAVY_DEBUG_SYMBOLS) + # Files inherited via extract_into_parent_list that would be marked to remove heavy symbols otherwise + set_source_files_properties( + Functions/IFunction.cpp + Functions/FunctionFactory.cpp + Functions/FunctionHelpers.cpp + Functions/FunctionsLogical.cpp + Functions/if.cpp + Functions/multiIf.cpp + Functions/multiMatchAny.cpp + Functions/checkHyperscanRegexp.cpp + Functions/CastOverloadResolver.cpp + Functions/FunctionsConversion.cpp + Functions/extractTimeZoneFromFunctionArguments.cpp + Functions/GatherUtils/createArraySource.cpp + Functions/GatherUtils/createValueSource.cpp + Functions/GatherUtils/createArraySink.cpp + Functions/GatherUtils/resizeConstantSize.cpp + Functions/GatherUtils/resizeDynamicSize.cpp + PROPERTIES COMPILE_FLAGS -g0) +endif() + add_headers_and_sources(clickhouse_common_io Common) add_headers_and_sources(clickhouse_common_io Common/HashTable) add_headers_and_sources(clickhouse_common_io Common/Scheduler) diff --git a/src/Client/examples/CMakeLists.txt b/src/Client/examples/CMakeLists.txt index 469f7aa0852..9d788a49c59 100644 --- a/src/Client/examples/CMakeLists.txt +++ b/src/Client/examples/CMakeLists.txt @@ -1,2 +1,2 @@ clickhouse_add_executable(test-connect test_connect.cpp) -target_link_libraries (test-connect PRIVATE dbms clickhouse_functions) +target_link_libraries (test-connect PRIVATE dbms) diff --git a/src/Columns/benchmarks/CMakeLists.txt b/src/Columns/benchmarks/CMakeLists.txt index 04c4bb88ac3..6701c342ead 100644 --- a/src/Columns/benchmarks/CMakeLists.txt +++ b/src/Columns/benchmarks/CMakeLists.txt @@ -1,5 +1,4 @@ clickhouse_add_executable(column_insert_many_from benchmark_column_insert_many_from.cpp) target_link_libraries (column_insert_many_from PRIVATE ch_contrib::gbenchmark_all - dbms - clickhouse_functions) + dbms) diff --git a/src/Common/ZooKeeper/examples/CMakeLists.txt b/src/Common/ZooKeeper/examples/CMakeLists.txt index 11669d765f7..678b302a512 100644 --- a/src/Common/ZooKeeper/examples/CMakeLists.txt +++ b/src/Common/ZooKeeper/examples/CMakeLists.txt @@ -1,18 +1,15 @@ clickhouse_add_executable(zkutil_test_commands zkutil_test_commands.cpp) target_link_libraries(zkutil_test_commands PRIVATE clickhouse_common_zookeeper_no_log - clickhouse_functions dbms) clickhouse_add_executable(zkutil_test_commands_new_lib zkutil_test_commands_new_lib.cpp) target_link_libraries(zkutil_test_commands_new_lib PRIVATE clickhouse_common_zookeeper_no_log clickhouse_compression - clickhouse_functions dbms) clickhouse_add_executable(zkutil_test_async zkutil_test_async.cpp) target_link_libraries(zkutil_test_async PRIVATE clickhouse_common_zookeeper_no_log - clickhouse_functions dbms) diff --git a/src/Common/benchmarks/CMakeLists.txt b/src/Common/benchmarks/CMakeLists.txt index 8b4b9d187b7..690ced1eb88 100644 --- a/src/Common/benchmarks/CMakeLists.txt +++ b/src/Common/benchmarks/CMakeLists.txt @@ -2,7 +2,6 @@ clickhouse_add_executable(integer_hash_tables_and_hashes integer_hash_tables_and target_link_libraries (integer_hash_tables_and_hashes PRIVATE ch_contrib::gbenchmark_all dbms - clickhouse_functions ch_contrib::abseil_swiss_tables ch_contrib::sparsehash ch_contrib::wyhash @@ -12,5 +11,4 @@ target_link_libraries (integer_hash_tables_and_hashes PRIVATE clickhouse_add_executable(orc_string_dictionary orc_string_dictionary.cpp) target_link_libraries (orc_string_dictionary PRIVATE ch_contrib::gbenchmark_all - dbms - clickhouse_functions) + dbms) diff --git a/src/Common/examples/CMakeLists.txt b/src/Common/examples/CMakeLists.txt index 47aa6a664f5..ee0c1671b8e 100644 --- a/src/Common/examples/CMakeLists.txt +++ b/src/Common/examples/CMakeLists.txt @@ -11,10 +11,10 @@ clickhouse_add_executable (small_table small_table.cpp) target_link_libraries (small_table PRIVATE clickhouse_common_io clickhouse_common_config) clickhouse_add_executable (parallel_aggregation parallel_aggregation.cpp) -target_link_libraries (parallel_aggregation PRIVATE dbms clickhouse_functions) +target_link_libraries (parallel_aggregation PRIVATE dbms) clickhouse_add_executable (parallel_aggregation2 parallel_aggregation2.cpp) -target_link_libraries (parallel_aggregation2 PRIVATE dbms clickhouse_functions) +target_link_libraries (parallel_aggregation2 PRIVATE dbms) clickhouse_add_executable (int_hashes_perf int_hashes_perf.cpp) target_link_libraries (int_hashes_perf PRIVATE clickhouse_common_io clickhouse_common_config) @@ -26,24 +26,24 @@ clickhouse_add_executable (radix_sort radix_sort.cpp) target_link_libraries (radix_sort PRIVATE clickhouse_common_io clickhouse_common_config ch_contrib::pdqsort) clickhouse_add_executable (arena_with_free_lists arena_with_free_lists.cpp) -target_link_libraries (arena_with_free_lists PRIVATE dbms clickhouse_functions) +target_link_libraries (arena_with_free_lists PRIVATE dbms) clickhouse_add_executable (lru_hash_map_perf lru_hash_map_perf.cpp) -target_link_libraries (lru_hash_map_perf PRIVATE dbms clickhouse_functions) +target_link_libraries (lru_hash_map_perf PRIVATE dbms) if (OS_LINUX) clickhouse_add_executable (thread_creation_latency thread_creation_latency.cpp) - target_link_libraries (thread_creation_latency PRIVATE dbms clickhouse_functions clickhouse_common_io clickhouse_common_config) + target_link_libraries (thread_creation_latency PRIVATE dbms clickhouse_common_io clickhouse_common_config) endif() clickhouse_add_executable (array_cache array_cache.cpp) target_link_libraries (array_cache PRIVATE clickhouse_common_io clickhouse_common_config) clickhouse_add_executable (space_saving space_saving.cpp) -target_link_libraries (space_saving PRIVATE dbms clickhouse_functions clickhouse_common_io clickhouse_common_config) +target_link_libraries (space_saving PRIVATE dbms clickhouse_common_io clickhouse_common_config) clickhouse_add_executable (integer_hash_tables_benchmark integer_hash_tables_benchmark.cpp) -target_link_libraries (integer_hash_tables_benchmark PRIVATE dbms clickhouse_functions ch_contrib::abseil_swiss_tables ch_contrib::sparsehash) +target_link_libraries (integer_hash_tables_benchmark PRIVATE dbms ch_contrib::abseil_swiss_tables ch_contrib::sparsehash) clickhouse_add_executable (cow_columns cow_columns.cpp) target_link_libraries (cow_columns PRIVATE clickhouse_common_io clickhouse_common_config) @@ -69,13 +69,13 @@ clickhouse_add_executable (procfs_metrics_provider_perf procfs_metrics_provider_ target_link_libraries (procfs_metrics_provider_perf PRIVATE clickhouse_common_io clickhouse_common_config) clickhouse_add_executable (average average.cpp) -target_link_libraries (average PRIVATE dbms clickhouse_common_io clickhouse_common_config clickhouse_functions) +target_link_libraries (average PRIVATE dbms clickhouse_common_io clickhouse_common_config) clickhouse_add_executable (shell_command_inout shell_command_inout.cpp) target_link_libraries (shell_command_inout PRIVATE clickhouse_common_io clickhouse_common_config) clickhouse_add_executable (executable_udf executable_udf.cpp) -target_link_libraries (executable_udf PRIVATE dbms clickhouse_functions) +target_link_libraries (executable_udf PRIVATE dbms) if (ENABLE_HIVE) clickhouse_add_executable (hive_metastore_client hive_metastore_client.cpp) @@ -83,11 +83,11 @@ if (ENABLE_HIVE) endif() clickhouse_add_executable (interval_tree interval_tree.cpp) -target_link_libraries (interval_tree PRIVATE dbms clickhouse_functions) +target_link_libraries (interval_tree PRIVATE dbms) if (ENABLE_SSL) clickhouse_add_executable (encrypt_decrypt encrypt_decrypt.cpp) - target_link_libraries (encrypt_decrypt PRIVATE dbms clickhouse_functions) + target_link_libraries (encrypt_decrypt PRIVATE dbms) endif() clickhouse_add_executable (check_pointer_valid check_pointer_valid.cpp) diff --git a/src/Common/mysqlxx/tests/CMakeLists.txt b/src/Common/mysqlxx/tests/CMakeLists.txt index 53bee778470..287249798bf 100644 --- a/src/Common/mysqlxx/tests/CMakeLists.txt +++ b/src/Common/mysqlxx/tests/CMakeLists.txt @@ -1,2 +1,2 @@ clickhouse_add_executable (mysqlxx_pool_test mysqlxx_pool_test.cpp) -target_link_libraries (mysqlxx_pool_test PRIVATE mysqlxx clickhouse_common_config loggers_no_text_log) +target_link_libraries (mysqlxx_pool_test PRIVATE mysqlxx dbms clickhouse_common_config loggers_no_text_log) diff --git a/src/Compression/examples/CMakeLists.txt b/src/Compression/examples/CMakeLists.txt index f686f250ae9..039eb203ad5 100644 --- a/src/Compression/examples/CMakeLists.txt +++ b/src/Compression/examples/CMakeLists.txt @@ -1,2 +1,2 @@ clickhouse_add_executable (compressed_buffer compressed_buffer.cpp) -target_link_libraries (compressed_buffer PRIVATE dbms clickhouse_functions clickhouse_common_io clickhouse_common_config clickhouse_compression) +target_link_libraries (compressed_buffer PRIVATE dbms clickhouse_common_io clickhouse_common_config clickhouse_compression) diff --git a/src/Compression/fuzzers/CMakeLists.txt b/src/Compression/fuzzers/CMakeLists.txt index 311f1eb3d35..a693faecc14 100644 --- a/src/Compression/fuzzers/CMakeLists.txt +++ b/src/Compression/fuzzers/CMakeLists.txt @@ -5,19 +5,19 @@ # If you want really small size of the resulted binary, just link with fuzz_compression and clickhouse_common_io clickhouse_add_executable (compressed_buffer_fuzzer compressed_buffer_fuzzer.cpp) -target_link_libraries (compressed_buffer_fuzzer PRIVATE dbms clickhouse_functions) +target_link_libraries (compressed_buffer_fuzzer PRIVATE dbms) clickhouse_add_executable (lz4_decompress_fuzzer lz4_decompress_fuzzer.cpp) -target_link_libraries (lz4_decompress_fuzzer PUBLIC dbms ch_contrib::lz4 clickhouse_functions) +target_link_libraries (lz4_decompress_fuzzer PUBLIC dbms ch_contrib::lz4) clickhouse_add_executable (delta_decompress_fuzzer delta_decompress_fuzzer.cpp) -target_link_libraries (delta_decompress_fuzzer PRIVATE dbms clickhouse_functions) +target_link_libraries (delta_decompress_fuzzer PRIVATE dbms) clickhouse_add_executable (double_delta_decompress_fuzzer double_delta_decompress_fuzzer.cpp) -target_link_libraries (double_delta_decompress_fuzzer PRIVATE dbms clickhouse_functions) +target_link_libraries (double_delta_decompress_fuzzer PRIVATE dbms) clickhouse_add_executable (encrypted_decompress_fuzzer encrypted_decompress_fuzzer.cpp) -target_link_libraries (encrypted_decompress_fuzzer PRIVATE dbms clickhouse_functions) +target_link_libraries (encrypted_decompress_fuzzer PRIVATE dbms) clickhouse_add_executable (gcd_decompress_fuzzer gcd_decompress_fuzzer.cpp) -target_link_libraries (gcd_decompress_fuzzer PRIVATE dbms clickhouse_functions) +target_link_libraries (gcd_decompress_fuzzer PRIVATE dbms) diff --git a/src/Core/examples/CMakeLists.txt b/src/Core/examples/CMakeLists.txt index 369c6101032..729d6f88cde 100644 --- a/src/Core/examples/CMakeLists.txt +++ b/src/Core/examples/CMakeLists.txt @@ -1,8 +1,8 @@ clickhouse_add_executable (string_pool string_pool.cpp) -target_link_libraries (string_pool PRIVATE dbms clickhouse_functions clickhouse_common_io clickhouse_common_config ch_contrib::sparsehash) +target_link_libraries (string_pool PRIVATE dbms clickhouse_common_io clickhouse_common_config ch_contrib::sparsehash) clickhouse_add_executable (field field.cpp) -target_link_libraries (field PRIVATE dbms clickhouse_functions) +target_link_libraries (field PRIVATE dbms) clickhouse_add_executable (string_ref_hash string_ref_hash.cpp) target_link_libraries (string_ref_hash PRIVATE clickhouse_common_io clickhouse_common_config) diff --git a/src/Core/fuzzers/CMakeLists.txt b/src/Core/fuzzers/CMakeLists.txt index 61d6b9629eb..c60ce0e097f 100644 --- a/src/Core/fuzzers/CMakeLists.txt +++ b/src/Core/fuzzers/CMakeLists.txt @@ -1,2 +1,2 @@ clickhouse_add_executable (names_and_types_fuzzer names_and_types_fuzzer.cpp) -target_link_libraries (names_and_types_fuzzer PRIVATE clickhouse_functions) +target_link_libraries (names_and_types_fuzzer PRIVATE) diff --git a/src/DataTypes/fuzzers/CMakeLists.txt b/src/DataTypes/fuzzers/CMakeLists.txt index e54ef0a860c..9e5b1b3f673 100644 --- a/src/DataTypes/fuzzers/CMakeLists.txt +++ b/src/DataTypes/fuzzers/CMakeLists.txt @@ -1,2 +1,2 @@ clickhouse_add_executable(data_type_deserialization_fuzzer data_type_deserialization_fuzzer.cpp ${SRCS}) -target_link_libraries(data_type_deserialization_fuzzer PRIVATE clickhouse_functions clickhouse_aggregate_functions) +target_link_libraries(data_type_deserialization_fuzzer PRIVATE clickhouse_aggregate_functions) diff --git a/src/Dictionaries/CMakeLists.txt b/src/Dictionaries/CMakeLists.txt index 783835356e6..c3a9580e3a4 100644 --- a/src/Dictionaries/CMakeLists.txt +++ b/src/Dictionaries/CMakeLists.txt @@ -18,10 +18,10 @@ if (OMIT_HEAVY_DEBUG_SYMBOLS) endif() extract_into_parent_list(clickhouse_dictionaries_sources dbms_sources - DictionaryFactory.cpp - DictionarySourceFactory.cpp - DictionaryStructure.cpp - getDictionaryConfigurationFromAST.cpp + DictionaryFactory.cpp # DictionaryFactory::instance() Used by ExternalDictionariesLoader.cpp, getDictionaryConfigurationFromAST.cpp... + DictionarySourceFactory.cpp # DictionarySourceFactory::instance() Used by DictionaryFactory.cpp + DictionaryStructure.cpp # DictionaryStructure::DictionaryStructure (ExternalDictionariesLoader.cpp) + getDictionaryConfigurationFromAST.cpp # getDictionaryConfigurationFromAST (StorageDictionary.cpp, AST Visitors) ) extract_into_parent_list(clickhouse_dictionaries_headers dbms_headers DictionaryFactory.h diff --git a/src/Formats/fuzzers/CMakeLists.txt b/src/Formats/fuzzers/CMakeLists.txt index b8a7e78b6e2..ee1a4fd4358 100644 --- a/src/Formats/fuzzers/CMakeLists.txt +++ b/src/Formats/fuzzers/CMakeLists.txt @@ -1,2 +1,2 @@ clickhouse_add_executable(format_fuzzer format_fuzzer.cpp ${SRCS}) -target_link_libraries(format_fuzzer PRIVATE clickhouse_functions clickhouse_aggregate_functions) +target_link_libraries(format_fuzzer PRIVATE clickhouse_aggregate_functions) diff --git a/src/Functions/CMakeLists.txt b/src/Functions/CMakeLists.txt index 7c90f83569a..8fc15ae2af2 100644 --- a/src/Functions/CMakeLists.txt +++ b/src/Functions/CMakeLists.txt @@ -3,6 +3,31 @@ add_subdirectory(divide) include("${ClickHouse_SOURCE_DIR}/cmake/dbms_glob_sources.cmake") add_headers_and_sources(clickhouse_functions .) +# These files are moved from clickhouse_functions into dbms to make dbms self-contained (not depend on clickhouse_functions) +# This allows less dependency and linker work (specially important when building many example executables) +set(DBMS_FUNCTIONS + IFunction.cpp # IFunctionOverloadResolver::getLambdaArgumentTypes, IExecutableFunction::execute... (Many AST visitors, analyzer passes, some storages...) + FunctionFactory.cpp # FunctionFactory::instance() (Many AST visitors, analyzer passes, some storages...) + FunctionHelpers.cpp # convertConstTupleToConstantElements, checkAndGetColumnConstStringOrFixedString, checkAndGetNestedArrayOffset ...) + FunctionsLogical.cpp # createInternalFunctionAndOverloadResolve / createInternalFunctionOrOverloadResolver ... (Multiple) + if.cpp # createInternalFunctionIfOverloadResolver (Used by MultiIfToIfPass.cpp) + multiIf.cpp # createInternalMultiIfOverloadResolver (Used by IfChainToMultiIfPass.cpp) + multiMatchAny.cpp # createInternalMultiMatchAnyOverloadResolver (Used by ConvertOrLikeChainPass.cpp) + checkHyperscanRegexp.cpp # checkHyperscanRegexp (Used by MultiMatchAnyImpl.h, multiMatchAny.cpp) + CastOverloadResolver.cpp # createInternalCast (Used by WindowTransform.cpp, KeyCondition.cpp...) + FunctionsConversion.cpp # createFunctionBaseCast (Used by CastOverloadResolver.cpp) + extractTimeZoneFromFunctionArguments.cpp # extractTimeZoneFromFunctionArguments (DateTimeTransforms.h, FunctionsConversion.cpp) +) +extract_into_parent_list(clickhouse_functions_sources dbms_sources ${DBMS_FUNCTIONS}) +extract_into_parent_list(clickhouse_functions_headers dbms_headers + IFunction.h + FunctionFactory.h + FunctionHelpers.h + extractTimeZoneFromFunctionArguments.h + FunctionsLogical.h + CastOverloadResolver.h +) + add_library(clickhouse_functions_obj OBJECT ${clickhouse_functions_headers} ${clickhouse_functions_sources}) if (OMIT_HEAVY_DEBUG_SYMBOLS) target_compile_options(clickhouse_functions_obj PRIVATE "-g0") @@ -142,6 +167,10 @@ if (USE_GPERF) add_dependencies(generate-source generate-html-char-ref) endif () +# Update after all the includes +set(dbms_sources "${dbms_sources}" PARENT_SCOPE) +set(dbms_headers "${dbms_headers}" PARENT_SCOPE) + target_link_libraries(clickhouse_functions_obj PUBLIC ${PUBLIC_LIBS} PRIVATE ${PRIVATE_LIBS}) # Used to forward the linking information to the final binaries such as clickhouse / unit_tests_dbms, diff --git a/src/Functions/GatherUtils/CMakeLists.txt b/src/Functions/GatherUtils/CMakeLists.txt index 376ca6613d8..36245ac597e 100644 --- a/src/Functions/GatherUtils/CMakeLists.txt +++ b/src/Functions/GatherUtils/CMakeLists.txt @@ -1,6 +1,21 @@ include("${ClickHouse_SOURCE_DIR}/cmake/dbms_glob_sources.cmake") add_headers_and_sources(clickhouse_functions_gatherutils .) + +# Used by arrayResize.cpp +set(DBMS_GATHERUTILS_FUNCTIONS + createArraySource.cpp + createValueSource.cpp + createArraySink.cpp + resizeConstantSize.cpp + resizeDynamicSize.cpp +) + +extract_into_parent_list(clickhouse_functions_gatherutils_sources dbms_sources ${DBMS_GATHERUTILS_FUNCTIONS}) +extract_into_parent_list(clickhouse_functions_gatherutils_headers + GatherUtils.h +) + add_library(clickhouse_functions_gatherutils ${clickhouse_functions_gatherutils_sources} ${clickhouse_functions_gatherutils_headers}) target_link_libraries(clickhouse_functions_gatherutils PRIVATE dbms) diff --git a/src/Functions/array/CMakeLists.txt b/src/Functions/array/CMakeLists.txt index 2800b5b4e28..533c48087dd 100644 --- a/src/Functions/array/CMakeLists.txt +++ b/src/Functions/array/CMakeLists.txt @@ -1,5 +1,18 @@ include("${ClickHouse_SOURCE_DIR}/cmake/dbms_glob_sources.cmake") +include(CMakePrintHelpers) + add_headers_and_sources(clickhouse_functions_array .) + +# createInternalFunctionHasOverloadResolver, FunctionArrayResize, FunctionEmptyArrayToSingle +# Used by ArrayExistsToHasPass.cpp and ArrayJoinAction.cpp +set(DBMS_ARRAY_FUNCTIONS + arrayResize.cpp + has.cpp + emptyArrayToSingle.cpp +) +extract_into_parent_list(clickhouse_functions_array_sources dbms_sources ${DBMS_ARRAY_FUNCTIONS}) +extract_into_parent_list(clickhouse_functions_headers dbms_headers arrayResize.h has.h emptyArrayToSingle.h) + add_library(clickhouse_functions_array OBJECT ${clickhouse_functions_array_sources} ${clickhouse_functions_array_headers}) target_link_libraries(clickhouse_functions_array PRIVATE dbms clickhouse_functions_gatherutils) diff --git a/src/IO/examples/CMakeLists.txt b/src/IO/examples/CMakeLists.txt index 48fb9ce858b..8dea3a84cc4 100644 --- a/src/IO/examples/CMakeLists.txt +++ b/src/IO/examples/CMakeLists.txt @@ -38,7 +38,7 @@ clickhouse_add_executable (o_direct_and_dirty_pages o_direct_and_dirty_pages.cpp target_link_libraries (o_direct_and_dirty_pages PRIVATE clickhouse_common_io clickhouse_common_config) clickhouse_add_executable (io_operators io_operators.cpp) -target_link_libraries (io_operators PRIVATE dbms clickhouse_functions clickhouse_common_io clickhouse_common_config) +target_link_libraries (io_operators PRIVATE dbms clickhouse_common_io clickhouse_common_config) clickhouse_add_executable (write_int write_int.cpp) target_link_libraries (write_int PRIVATE clickhouse_common_io clickhouse_common_config) @@ -56,7 +56,7 @@ clickhouse_add_executable (limit_read_buffer2 limit_read_buffer2.cpp) target_link_libraries (limit_read_buffer2 PRIVATE clickhouse_common_io clickhouse_common_config) clickhouse_add_executable (parse_date_time_best_effort parse_date_time_best_effort.cpp) -target_link_libraries (parse_date_time_best_effort PRIVATE dbms clickhouse_functions clickhouse_common_io clickhouse_common_config) +target_link_libraries (parse_date_time_best_effort PRIVATE dbms clickhouse_common_io clickhouse_common_config) clickhouse_add_executable (zlib_ng_bug zlib_ng_bug.cpp) target_link_libraries (zlib_ng_bug PRIVATE ch_contrib::zlib clickhouse_common_io clickhouse_common_config) @@ -75,7 +75,7 @@ target_link_libraries (hadoop_snappy_read_buffer PRIVATE clickhouse_common_io cl if (TARGET ch_contrib::hdfs) clickhouse_add_executable (read_buffer_from_hdfs read_buffer_from_hdfs.cpp) - target_link_libraries (read_buffer_from_hdfs PRIVATE dbms clickhouse_functions ch_contrib::hdfs) + target_link_libraries (read_buffer_from_hdfs PRIVATE dbms ch_contrib::hdfs) endif () diff --git a/src/Interpreters/examples/CMakeLists.txt b/src/Interpreters/examples/CMakeLists.txt index dff777af115..f027baadb17 100644 --- a/src/Interpreters/examples/CMakeLists.txt +++ b/src/Interpreters/examples/CMakeLists.txt @@ -1,35 +1,35 @@ clickhouse_add_executable (hash_map hash_map.cpp) -target_link_libraries (hash_map PRIVATE dbms clickhouse_functions clickhouse_functions ch_contrib::sparsehash) +target_link_libraries (hash_map PRIVATE dbms ch_contrib::sparsehash) clickhouse_add_executable (hash_map_lookup hash_map_lookup.cpp) -target_link_libraries (hash_map_lookup PRIVATE dbms clickhouse_functions clickhouse_common_io clickhouse_common_config clickhouse_compression) +target_link_libraries (hash_map_lookup PRIVATE dbms clickhouse_common_io clickhouse_common_config clickhouse_compression) clickhouse_add_executable (hash_map3 hash_map3.cpp) -target_link_libraries (hash_map3 PRIVATE dbms clickhouse_functions clickhouse_common_io clickhouse_common_config clickhouse_compression ch_contrib::farmhash ch_contrib::metrohash) +target_link_libraries (hash_map3 PRIVATE dbms clickhouse_common_io clickhouse_common_config clickhouse_compression ch_contrib::farmhash ch_contrib::metrohash) clickhouse_add_executable (hash_map_string hash_map_string.cpp) -target_link_libraries (hash_map_string PRIVATE dbms clickhouse_functions clickhouse_common_io clickhouse_common_config clickhouse_compression ch_contrib::sparsehash) +target_link_libraries (hash_map_string PRIVATE dbms clickhouse_common_io clickhouse_common_config clickhouse_compression ch_contrib::sparsehash) clickhouse_add_executable (hash_map_string_2 hash_map_string_2.cpp) -target_link_libraries (hash_map_string_2 PRIVATE dbms clickhouse_functions clickhouse_common_io clickhouse_common_config clickhouse_compression) +target_link_libraries (hash_map_string_2 PRIVATE dbms clickhouse_common_io clickhouse_common_config clickhouse_compression) clickhouse_add_executable (hash_map_string_3 hash_map_string_3.cpp) -target_link_libraries (hash_map_string_3 PRIVATE dbms clickhouse_functions clickhouse_common_io clickhouse_common_config clickhouse_compression ch_contrib::farmhash ch_contrib::metrohash) +target_link_libraries (hash_map_string_3 PRIVATE dbms clickhouse_common_io clickhouse_common_config clickhouse_compression ch_contrib::farmhash ch_contrib::metrohash) clickhouse_add_executable (hash_map_string_small hash_map_string_small.cpp) -target_link_libraries (hash_map_string_small PRIVATE dbms clickhouse_functions clickhouse_common_io clickhouse_common_config clickhouse_compression ch_contrib::sparsehash) +target_link_libraries (hash_map_string_small PRIVATE dbms clickhouse_common_io clickhouse_common_config clickhouse_compression ch_contrib::sparsehash) clickhouse_add_executable (string_hash_map string_hash_map.cpp) -target_link_libraries (string_hash_map PRIVATE dbms clickhouse_functions clickhouse_common_io clickhouse_common_config clickhouse_compression ch_contrib::sparsehash) +target_link_libraries (string_hash_map PRIVATE dbms clickhouse_common_io clickhouse_common_config clickhouse_compression ch_contrib::sparsehash) clickhouse_add_executable (string_hash_map_aggregation string_hash_map.cpp) -target_link_libraries (string_hash_map_aggregation PRIVATE dbms clickhouse_functions clickhouse_common_io clickhouse_common_config clickhouse_compression) +target_link_libraries (string_hash_map_aggregation PRIVATE dbms clickhouse_common_io clickhouse_common_config clickhouse_compression) clickhouse_add_executable (string_hash_set string_hash_set.cpp) -target_link_libraries (string_hash_set PRIVATE dbms clickhouse_functions clickhouse_common_io clickhouse_common_config clickhouse_compression) +target_link_libraries (string_hash_set PRIVATE dbms clickhouse_common_io clickhouse_common_config clickhouse_compression) clickhouse_add_executable (two_level_hash_map two_level_hash_map.cpp) -target_link_libraries (two_level_hash_map PRIVATE dbms clickhouse_functions clickhouse_common_io clickhouse_common_config clickhouse_compression ch_contrib::sparsehash) +target_link_libraries (two_level_hash_map PRIVATE dbms clickhouse_common_io clickhouse_common_config clickhouse_compression ch_contrib::sparsehash) clickhouse_add_executable (jit_example jit_example.cpp) target_link_libraries (jit_example PRIVATE dbms clickhouse_functions) diff --git a/src/Interpreters/fuzzers/CMakeLists.txt b/src/Interpreters/fuzzers/CMakeLists.txt index 4ac002d3d4a..3317bba7e30 100644 --- a/src/Interpreters/fuzzers/CMakeLists.txt +++ b/src/Interpreters/fuzzers/CMakeLists.txt @@ -1,7 +1,6 @@ clickhouse_add_executable(execute_query_fuzzer execute_query_fuzzer.cpp) target_link_libraries(execute_query_fuzzer PRIVATE dbms - clickhouse_functions clickhouse_table_functions clickhouse_aggregate_functions clickhouse_dictionaries diff --git a/src/Parsers/examples/CMakeLists.txt b/src/Parsers/examples/CMakeLists.txt index 0ea52497ecc..07f60601acd 100644 --- a/src/Parsers/examples/CMakeLists.txt +++ b/src/Parsers/examples/CMakeLists.txt @@ -4,7 +4,7 @@ clickhouse_add_executable(lexer lexer.cpp ${SRCS}) target_link_libraries(lexer PRIVATE clickhouse_parsers clickhouse_common_config) clickhouse_add_executable(select_parser select_parser.cpp ${SRCS} "../../Server/ServerType.cpp") -target_link_libraries(select_parser PRIVATE dbms clickhouse_functions) +target_link_libraries(select_parser PRIVATE dbms) clickhouse_add_executable(create_parser create_parser.cpp ${SRCS} "../../Server/ServerType.cpp") -target_link_libraries(create_parser PRIVATE dbms clickhouse_functions) +target_link_libraries(create_parser PRIVATE dbms) diff --git a/src/Storages/examples/CMakeLists.txt b/src/Storages/examples/CMakeLists.txt index 0d6accbc895..b4786b7313b 100644 --- a/src/Storages/examples/CMakeLists.txt +++ b/src/Storages/examples/CMakeLists.txt @@ -1,8 +1,8 @@ clickhouse_add_executable (merge_selector merge_selector.cpp) -target_link_libraries (merge_selector PRIVATE dbms clickhouse_functions) +target_link_libraries (merge_selector PRIVATE dbms) clickhouse_add_executable (merge_selector2 merge_selector2.cpp) -target_link_libraries (merge_selector2 PRIVATE dbms clickhouse_functions) +target_link_libraries (merge_selector2 PRIVATE dbms) clickhouse_add_executable (get_current_inserts_in_replicated get_current_inserts_in_replicated.cpp) -target_link_libraries (get_current_inserts_in_replicated PRIVATE dbms clickhouse_common_config clickhouse_common_zookeeper clickhouse_functions) +target_link_libraries (get_current_inserts_in_replicated PRIVATE dbms clickhouse_common_config clickhouse_common_zookeeper) diff --git a/src/Storages/fuzzers/CMakeLists.txt b/src/Storages/fuzzers/CMakeLists.txt index f67552716a2..2c7c0c16fc2 100644 --- a/src/Storages/fuzzers/CMakeLists.txt +++ b/src/Storages/fuzzers/CMakeLists.txt @@ -1,7 +1,7 @@ clickhouse_add_executable (mergetree_checksum_fuzzer mergetree_checksum_fuzzer.cpp) # Look at comment around fuzz_compression target declaration -target_link_libraries (mergetree_checksum_fuzzer PRIVATE dbms clickhouse_functions) +target_link_libraries (mergetree_checksum_fuzzer PRIVATE dbms) clickhouse_add_executable (columns_description_fuzzer columns_description_fuzzer.cpp) -target_link_libraries (columns_description_fuzzer PRIVATE clickhouse_functions) +target_link_libraries (columns_description_fuzzer PRIVATE) diff --git a/src/TableFunctions/CMakeLists.txt b/src/TableFunctions/CMakeLists.txt index 770990cc405..ccdab2fc41b 100644 --- a/src/TableFunctions/CMakeLists.txt +++ b/src/TableFunctions/CMakeLists.txt @@ -6,6 +6,8 @@ if (TARGET ch_contrib::hivemetastore) add_headers_and_sources(clickhouse_table_functions Hive) endif () +# TableFunctionFactory::instance(), TableFunctionFactory::get(), DB::ITableFunction::execute(), TableFunctionView::getSelectQuery() +# Used by different storages and analyzer extract_into_parent_list(clickhouse_table_functions_sources dbms_sources ITableFunction.cpp TableFunctionView.cpp