fix build error

This commit is contained in:
taiyang-li 2021-11-10 10:53:03 +08:00
parent c47bb97fce
commit 68fc3e761d
4 changed files with 7 additions and 15 deletions

View File

@ -4,15 +4,6 @@ set (SRCS
${CMAKE_CURRENT_LIST_DIR}/ThriftHiveMetastore.cpp ${CMAKE_CURRENT_LIST_DIR}/ThriftHiveMetastore.cpp
) )
# set(THRIFT_COMPILER_PATH ${ClickHouse_BINARY_DIR}/contrib/thrift-cmake/thrift-compiler)
# add_custom_command(
# OUTPUT ${SRCS}
# COMMAND ${THRIFT_COMPILER_PATH}
# ARGS -r --gen cpp -out ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_LIST_DIR}/hive_metastore.thrift
# COMMENT "Running cpp thrift compiler for hive_metastore.thrift"
# DEPENDS ${THRIFT_COMPILER}
# VERBATIM)
add_library(hivemetastore ${SRCS}) add_library(hivemetastore ${SRCS})
target_link_libraries(hivemetastore PUBLIC ${THRIFT_LIBRARY}) target_link_libraries(hivemetastore PUBLIC ${THRIFT_LIBRARY})
target_include_directories(hivemetastore SYSTEM PUBLIC ${CMAKE_CURRENT_LIST_DIR}) target_include_directories(hivemetastore SYSTEM PUBLIC ${CMAKE_CURRENT_LIST_DIR})

View File

@ -450,6 +450,7 @@ if (USE_HDFS)
if (USE_ORC AND USE_PARQUET) if (USE_ORC AND USE_PARQUET)
dbms_target_link_libraries(PRIVATE hivemetastore) dbms_target_link_libraries(PRIVATE hivemetastore)
dbms_target_include_directories(SYSTEM BEFORE PUBLIC ${ClickHouse_SOURCE_DIR}/contrib/hive-metastore)
endif() endif()
endif() endif()

View File

@ -88,7 +88,7 @@
#include <Interpreters/Lemmatizers.h> #include <Interpreters/Lemmatizers.h>
#include <filesystem> #include <filesystem>
#if USE_HDFS #if USE_HDFS && USE_ORC && USE_PARQUET
#include <ThriftHiveMetastore.h> #include <ThriftHiveMetastore.h>
#include <thrift/protocol/TBinaryProtocol.h> #include <thrift/protocol/TBinaryProtocol.h>
#include <thrift/transport/TBufferTransports.h> #include <thrift/transport/TBufferTransports.h>
@ -163,7 +163,7 @@ struct ContextSharedPart
mutable std::mutex storage_policies_mutex; mutable std::mutex storage_policies_mutex;
/// Separate mutex for re-initialization of zookeeper session. This operation could take a long time and must not interfere with another operations. /// Separate mutex for re-initialization of zookeeper session. This operation could take a long time and must not interfere with another operations.
mutable std::mutex zookeeper_mutex; mutable std::mutex zookeeper_mutex;
#if USE_HDFS #if USE_HDFS && USE_ORC && USE_PARQUET
/// Separate mutex for re-initialization of hive metastore client. This operation could take a long time and must not interfere with another operations. /// Separate mutex for re-initialization of hive metastore client. This operation could take a long time and must not interfere with another operations.
mutable std::mutex hive_metastore_mutex; mutable std::mutex hive_metastore_mutex;
#endif #endif
@ -179,7 +179,7 @@ struct ContextSharedPart
mutable std::map<String, zkutil::ZooKeeperPtr> auxiliary_zookeepers; /// Map for auxiliary ZooKeeper clients. mutable std::map<String, zkutil::ZooKeeperPtr> auxiliary_zookeepers; /// Map for auxiliary ZooKeeper clients.
ConfigurationPtr auxiliary_zookeepers_config; /// Stores auxiliary zookeepers configs ConfigurationPtr auxiliary_zookeepers_config; /// Stores auxiliary zookeepers configs
#if USE_HDFS #if USE_HDFS && USE_ORC && USE_PARQUET
mutable std::map<String, HMSClientPtr> hive_metastore_clients; /// Map for hive metastore clients mutable std::map<String, HMSClientPtr> hive_metastore_clients; /// Map for hive metastore clients
#endif #endif
@ -1824,7 +1824,7 @@ zkutil::ZooKeeperPtr Context::getZooKeeper() const
return shared->zookeeper; return shared->zookeeper;
} }
#if USE_HDFS #if USE_HDFS && USE_ORC && USE_PARQUET
HMSClientPtr Context::getHMSClient(const String & name) const HMSClientPtr Context::getHMSClient(const String & name) const
{ {
using namespace apache::thrift; using namespace apache::thrift;

View File

@ -174,7 +174,7 @@ private:
std::unique_ptr<ContextSharedPart> shared; std::unique_ptr<ContextSharedPart> shared;
}; };
#if USE_HDFS #if USE_HDFS && USE_ORC && USE_PARQUET
class HMSClient; class HMSClient;
using HMSClientPtr = std::shared_ptr<HMSClient>; using HMSClientPtr = std::shared_ptr<HMSClient>;
#endif #endif
@ -693,7 +693,7 @@ public:
// Reload Zookeeper // Reload Zookeeper
void reloadZooKeeperIfChanged(const ConfigurationPtr & config) const; void reloadZooKeeperIfChanged(const ConfigurationPtr & config) const;
#if USE_HDFS #if USE_HDFS && USE_ORC && USE_PARQUET
HMSClientPtr getHMSClient(const String & name) const; HMSClientPtr getHMSClient(const String & name) const;
#endif #endif