From 0eedf8568931b5a65faa2c96dec5055f0f693b3d Mon Sep 17 00:00:00 2001 From: Christian Zentgraf Date: Thu, 9 Jan 2025 11:43:01 -0500 Subject: [PATCH] [native] Switch to using the Velox mono library This change makes use of the Velox mono library for non-test related components. This removes the need to add individual velox subcomponent libraries and cuts down on the linking size because symbols are duplicated. When adding new non-test velox dependencies use the velox library rather than the individual velox component. For tests, the velox components are still needed to be separately used. --- presto-native-execution/CMakeLists.txt | 1 + .../presto_cpp/main/CMakeLists.txt | 25 ++----------------- .../presto_cpp/main/common/CMakeLists.txt | 5 ++-- .../presto_cpp/main/http/CMakeLists.txt | 3 +-- .../presto_cpp/main/operators/CMakeLists.txt | 6 +---- .../presto_cpp/main/types/CMakeLists.txt | 10 +++----- .../presto_cpp/presto_protocol/CMakeLists.txt | 2 +- 7 files changed, 12 insertions(+), 40 deletions(-) diff --git a/presto-native-execution/CMakeLists.txt b/presto-native-execution/CMakeLists.txt index d5001dde70a7..e7a6e8f49556 100644 --- a/presto-native-execution/CMakeLists.txt +++ b/presto-native-execution/CMakeLists.txt @@ -204,6 +204,7 @@ include_directories(${CMAKE_BINARY_DIR}) # set this for backwards compatibility, will be overwritten in velox/ set(VELOX_GTEST_INCUDE_DIR "velox/third_party/googletest/googletest/include") +set(VELOX_MONO_LIBRARY ON) add_subdirectory(velox) if(PRESTO_ENABLE_TESTING) diff --git a/presto-native-execution/presto_cpp/main/CMakeLists.txt b/presto-native-execution/presto_cpp/main/CMakeLists.txt index abe71dd6f3fa..ac1c2bd8bb47 100644 --- a/presto-native-execution/presto_cpp/main/CMakeLists.txt +++ b/presto-native-execution/presto_cpp/main/CMakeLists.txt @@ -51,27 +51,7 @@ target_link_libraries( presto_http presto_operators presto_velox_conversion - velox_aggregates - velox_caching - velox_common_base - velox_core - velox_dwio_common_exception - velox_encode - velox_exec - velox_functions_lib - velox_functions_prestosql - velox_hive_connector - velox_hive_iceberg_splitreader - velox_hive_partition_function - velox_presto_serializer - velox_serialization - velox_time - velox_type_parser - velox_type - velox_type_fbhive - velox_type_tz - velox_vector - velox_window + velox ${RE2} ${FOLLY_WITH_DEPENDENCIES} ${GLOG} @@ -94,8 +74,7 @@ add_executable(presto_server PrestoMain.cpp) # results in multiple link errors similar to the one below only on GCC. # "undefined reference to `vtable for velox::connector::tpch::TpchTableHandle`" # TODO: Fix these errors. -target_link_libraries(presto_server presto_server_lib velox_hive_connector - velox_tpch_connector) +target_link_libraries(presto_server presto_server_lib velox) if(PRESTO_ENABLE_REMOTE_FUNCTIONS) add_library(presto_server_remote_function JsonSignatureParser.cpp diff --git a/presto-native-execution/presto_cpp/main/common/CMakeLists.txt b/presto-native-execution/presto_cpp/main/common/CMakeLists.txt index c19e2c0b7eb2..07267981a2ec 100644 --- a/presto-native-execution/presto_cpp/main/common/CMakeLists.txt +++ b/presto-native-execution/presto_cpp/main/common/CMakeLists.txt @@ -13,12 +13,11 @@ add_library(presto_exception Exception.cpp) add_library(presto_common Counters.cpp Utils.cpp ConfigReader.cpp Configs.cpp) -target_link_libraries(presto_exception velox_exception) +target_link_libraries(presto_exception velox) set_property(TARGET presto_exception PROPERTY JOB_POOL_LINK presto_link_job_pool) -target_link_libraries(presto_common velox_common_config velox_core - velox_exception) +target_link_libraries(presto_common velox) set_property(TARGET presto_common PROPERTY JOB_POOL_LINK presto_link_job_pool) if(PRESTO_ENABLE_TESTING) diff --git a/presto-native-execution/presto_cpp/main/http/CMakeLists.txt b/presto-native-execution/presto_cpp/main/http/CMakeLists.txt index c60ddefac439..227e6a688c06 100644 --- a/presto-native-execution/presto_cpp/main/http/CMakeLists.txt +++ b/presto-native-execution/presto_cpp/main/http/CMakeLists.txt @@ -23,8 +23,7 @@ target_link_libraries( presto_http http_filters presto_common - velox_memory - velox_exception + velox ${PROXYGEN_LIBRARIES} ${LIBSODIUM_LIBRARY} ${OPENSSL_SSL_LIBRARY} diff --git a/presto-native-execution/presto_cpp/main/operators/CMakeLists.txt b/presto-native-execution/presto_cpp/main/operators/CMakeLists.txt index 1f8190f429cf..5c7c9e90988d 100644 --- a/presto-native-execution/presto_cpp/main/operators/CMakeLists.txt +++ b/presto-native-execution/presto_cpp/main/operators/CMakeLists.txt @@ -25,11 +25,7 @@ add_library( target_link_libraries( presto_operators presto_common - velox_core - velox_exec - velox_presto_serializer - velox_vector - velox_row_fast) + velox) if(PRESTO_ENABLE_TESTING) add_subdirectory(tests) diff --git a/presto-native-execution/presto_cpp/main/types/CMakeLists.txt b/presto-native-execution/presto_cpp/main/types/CMakeLists.txt index c17e136e9984..bb55a02718a1 100644 --- a/presto-native-execution/presto_cpp/main/types/CMakeLists.txt +++ b/presto-native-execution/presto_cpp/main/types/CMakeLists.txt @@ -18,21 +18,19 @@ add_library( presto_types OBJECT PrestoToVeloxQueryPlan.cpp PrestoToVeloxExpr.cpp VeloxPlanValidator.cpp PrestoToVeloxSplit.cpp PrestoToVeloxConnector.cpp) -add_dependencies(presto_types presto_operators presto_type_converter velox_type - velox_type_fbhive) +add_dependencies(presto_types presto_operators presto_type_converter velox) -target_link_libraries(presto_types presto_type_converter velox_type_fbhive - velox_hive_partition_function velox_tpch_gen) +target_link_libraries(presto_types presto_type_converter velox) set_property(TARGET presto_types PROPERTY JOB_POOL_LINK presto_link_job_pool) add_library(presto_function_metadata OBJECT FunctionMetadata.cpp) -target_link_libraries(presto_function_metadata velox_function_registry) +target_link_libraries(presto_function_metadata velox) add_library(presto_velox_conversion OBJECT VeloxPlanConversion.cpp) -target_link_libraries(presto_velox_conversion velox_type) +target_link_libraries(presto_velox_conversion velox) if(PRESTO_ENABLE_TESTING) add_subdirectory(tests) diff --git a/presto-native-execution/presto_cpp/presto_protocol/CMakeLists.txt b/presto-native-execution/presto_cpp/presto_protocol/CMakeLists.txt index 15ebb198c164..9f59ae6f1aec 100644 --- a/presto-native-execution/presto_cpp/presto_protocol/CMakeLists.txt +++ b/presto-native-execution/presto_cpp/presto_protocol/CMakeLists.txt @@ -13,7 +13,7 @@ add_library( presto_protocol OBJECT presto_protocol.cpp Base64Util.cpp core/DataSize.cpp core/Duration.cpp core/ConnectorProtocol.cpp) -target_link_libraries(presto_protocol velox_type velox_presto_serializer ${RE2}) +target_link_libraries(presto_protocol velox_type velox ${RE2}) if(PRESTO_ENABLE_TESTING) add_subdirectory(tests)