From d532094f88bf9840d57f955fff6c91eceec01f38 Mon Sep 17 00:00:00 2001 From: Chang Chen Date: Sun, 26 May 2024 11:11:27 +0800 Subject: [PATCH] Fix build due to https://github.com/ClickHouse/ClickHouse/pull/59767 --- .../Disks/ObjectStorages/GlutenHDFSObjectStorage.cpp | 8 +++++--- .../Disks/ObjectStorages/GlutenHDFSObjectStorage.h | 2 +- .../ObjectStorages/registerGlutenDiskObjectStorage.cpp | 3 +-- .../local-engine/Storages/Output/WriteBufferBuilder.cpp | 6 ++---- .../Storages/SubstraitSource/ExcelTextFormatFile.cpp | 7 ++----- .../Storages/SubstraitSource/ReadBufferBuilder.cpp | 6 +++--- 6 files changed, 14 insertions(+), 18 deletions(-) diff --git a/cpp-ch/local-engine/Disks/ObjectStorages/GlutenHDFSObjectStorage.cpp b/cpp-ch/local-engine/Disks/ObjectStorages/GlutenHDFSObjectStorage.cpp index 3a844a91f804..60b82ec845bb 100644 --- a/cpp-ch/local-engine/Disks/ObjectStorages/GlutenHDFSObjectStorage.cpp +++ b/cpp-ch/local-engine/Disks/ObjectStorages/GlutenHDFSObjectStorage.cpp @@ -17,7 +17,7 @@ #include "GlutenHDFSObjectStorage.h" #if USE_HDFS -#include +#include using namespace DB; namespace local_engine { @@ -35,8 +35,10 @@ std::unique_ptr GlutenHDFSObjectStorage::readObject( /// DB::ObjectStorageKey local_engine::GlutenHDFSObjectStorage::generateObjectKeyForPath(const std::string & path) const { - return DB::ObjectStorageKey::createAsAbsolute(hdfs_root_path + path); + initializeHDFSFS(); + /// what ever data_source_description.description value is, consider that key as relative key + chassert(data_directory.starts_with("/")); + return ObjectStorageKey::createAsRelative(fs::path(url_without_path) / data_directory.substr(1) / path); } } #endif - diff --git a/cpp-ch/local-engine/Disks/ObjectStorages/GlutenHDFSObjectStorage.h b/cpp-ch/local-engine/Disks/ObjectStorages/GlutenHDFSObjectStorage.h index 1efa441c2142..a532c98cb87d 100644 --- a/cpp-ch/local-engine/Disks/ObjectStorages/GlutenHDFSObjectStorage.h +++ b/cpp-ch/local-engine/Disks/ObjectStorages/GlutenHDFSObjectStorage.h @@ -33,7 +33,7 @@ class GlutenHDFSObjectStorage final : public DB::HDFSObjectStorage const String & hdfs_root_path_, SettingsPtr settings_, const Poco::Util::AbstractConfiguration & config_) - : HDFSObjectStorage(hdfs_root_path_, std::move(settings_), config_), config(config_) + : HDFSObjectStorage(hdfs_root_path_, std::move(settings_), config_, /* lazy_initialize */true), config(config_) { } std::unique_ptr readObject( /// NOLINT diff --git a/cpp-ch/local-engine/Disks/ObjectStorages/registerGlutenDiskObjectStorage.cpp b/cpp-ch/local-engine/Disks/ObjectStorages/registerGlutenDiskObjectStorage.cpp index 8f20080297c6..800b51f93e94 100644 --- a/cpp-ch/local-engine/Disks/ObjectStorages/registerGlutenDiskObjectStorage.cpp +++ b/cpp-ch/local-engine/Disks/ObjectStorages/registerGlutenDiskObjectStorage.cpp @@ -75,7 +75,7 @@ void registerGlutenS3ObjectStorage(ObjectStorageFactory & factory) auto uri = getS3URI(config, config_prefix, context); auto s3_capabilities = getCapabilitiesFromConfig(config, config_prefix); auto settings = getSettings(config, config_prefix, context); - auto client = getClient(config, config_prefix, context, *settings); + auto client = getClient(config, config_prefix, context, *settings, true); auto key_generator = createObjectStorageKeysGeneratorAsIsWithPrefix(uri.key); auto object_storage = std::make_shared( @@ -110,7 +110,6 @@ void registerGlutenHDFSObjectStorage(ObjectStorageFactory & factory) std::unique_ptr settings = std::make_unique( config.getUInt64(config_prefix + ".min_bytes_for_seek", 1024 * 1024), - config.getInt(config_prefix + ".objects_chunk_size_to_delete", 1000), context->getSettingsRef().hdfs_replication ); return std::make_unique(uri, std::move(settings), config); diff --git a/cpp-ch/local-engine/Storages/Output/WriteBufferBuilder.cpp b/cpp-ch/local-engine/Storages/Output/WriteBufferBuilder.cpp index 02f9cd9f290c..3dc205c39cbd 100644 --- a/cpp-ch/local-engine/Storages/Output/WriteBufferBuilder.cpp +++ b/cpp-ch/local-engine/Storages/Output/WriteBufferBuilder.cpp @@ -17,13 +17,11 @@ #include #include #include -#include #include -#include -#include +#include +#include #include #include -#include #include #include diff --git a/cpp-ch/local-engine/Storages/SubstraitSource/ExcelTextFormatFile.cpp b/cpp-ch/local-engine/Storages/SubstraitSource/ExcelTextFormatFile.cpp index d7cbcaa5fe94..038f280b0560 100644 --- a/cpp-ch/local-engine/Storages/SubstraitSource/ExcelTextFormatFile.cpp +++ b/cpp-ch/local-engine/Storages/SubstraitSource/ExcelTextFormatFile.cpp @@ -14,13 +14,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "Common/CHUtil.h" #include "ExcelTextFormatFile.h" - +#include #include #include -#include #include #include @@ -28,9 +26,8 @@ #include #include #include -#include #include -#include +#include #include #include #include diff --git a/cpp-ch/local-engine/Storages/SubstraitSource/ReadBufferBuilder.cpp b/cpp-ch/local-engine/Storages/SubstraitSource/ReadBufferBuilder.cpp index 21640fe490c7..d54ff985ec5f 100644 --- a/cpp-ch/local-engine/Storages/SubstraitSource/ReadBufferBuilder.cpp +++ b/cpp-ch/local-engine/Storages/SubstraitSource/ReadBufferBuilder.cpp @@ -35,9 +35,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include