diff --git a/src/Disks/HDFS/DiskHDFS.cpp b/src/Disks/HDFS/DiskHDFS.cpp index e7da612c573..f97cd414d04 100644 --- a/src/Disks/HDFS/DiskHDFS.cpp +++ b/src/Disks/HDFS/DiskHDFS.cpp @@ -105,20 +105,17 @@ std::unique_ptr DiskHDFS::writeFile(const String & path void DiskHDFS::removeFromRemoteFS(const RemoteFSPathKeeper & fs_paths_keeper) { - if (!fs_paths_keeper.empty()) + for (const auto & chunk : fs_paths_keeper) { - for (const auto & chunk : fs_paths_keeper) + for (const auto & hdfs_object_path : chunk) { - for (const auto & hdfs_object_path : chunk) - { - const String hdfs_path = hdfs_object_path.GetKey(); - const size_t begin_of_path = hdfs_path.find('/', hdfs_path.find("//") + 2); + const String hdfs_path = hdfs_object_path.GetKey(); + const size_t begin_of_path = hdfs_path.find('/', hdfs_path.find("//") + 2); - /// Add path from root to file name - int res = hdfsDelete(hdfs_fs.get(), hdfs_path.substr(begin_of_path).c_str(), 0); - if (res == -1) - throw Exception(ErrorCodes::LOGICAL_ERROR, "HDFSDelete failed with path: " + hdfs_path); - } + /// Add path from root to file name + int res = hdfsDelete(hdfs_fs.get(), hdfs_path.substr(begin_of_path).c_str(), 0); + if (res == -1) + throw Exception(ErrorCodes::LOGICAL_ERROR, "HDFSDelete failed with path: " + hdfs_path); } } } diff --git a/src/Disks/IDiskRemote.cpp b/src/Disks/IDiskRemote.cpp index abde1d3a563..c4f3c470b40 100644 --- a/src/Disks/IDiskRemote.cpp +++ b/src/Disks/IDiskRemote.cpp @@ -1,5 +1,7 @@ #include +#if USE_AWS_S3 + #include "Disks/DiskFactory.h" #include #include @@ -485,3 +487,5 @@ bool IDiskRemote::tryReserve(UInt64 bytes) } } + +#endif diff --git a/src/Disks/IDiskRemote.h b/src/Disks/IDiskRemote.h index 02e0c7f082e..2fa76fa09e3 100644 --- a/src/Disks/IDiskRemote.h +++ b/src/Disks/IDiskRemote.h @@ -1,4 +1,7 @@ #pragma once +#include + +#if USE_AWS_S3 #include #include "Disks/DiskFactory.h" @@ -242,3 +245,5 @@ private: }; } + +#endif diff --git a/src/Disks/S3/DiskS3.cpp b/src/Disks/S3/DiskS3.cpp index d508bcf38e3..31ffaaed4b8 100644 --- a/src/Disks/S3/DiskS3.cpp +++ b/src/Disks/S3/DiskS3.cpp @@ -21,7 +21,6 @@ #include #include #include - #include diff --git a/src/IO/ReadIndirectBufferFromRemoteFS.cpp b/src/IO/ReadIndirectBufferFromRemoteFS.cpp index f3dd77063fa..955986e5259 100644 --- a/src/IO/ReadIndirectBufferFromRemoteFS.cpp +++ b/src/IO/ReadIndirectBufferFromRemoteFS.cpp @@ -1,4 +1,6 @@ #include "ReadIndirectBufferFromRemoteFS.h" + +#if USE_AWS_S3 || USE_HDFS #include #include @@ -111,10 +113,16 @@ bool ReadIndirectBufferFromRemoteFS::nextImpl() } +#if USE_AWS_S3 template class ReadIndirectBufferFromRemoteFS; +#endif +#if USE_HDFS template class ReadIndirectBufferFromRemoteFS; +#endif } + +#endif diff --git a/src/IO/ReadIndirectBufferFromRemoteFS.h b/src/IO/ReadIndirectBufferFromRemoteFS.h index 1c9ee3ef926..93f2f26faac 100644 --- a/src/IO/ReadIndirectBufferFromRemoteFS.h +++ b/src/IO/ReadIndirectBufferFromRemoteFS.h @@ -1,3 +1,7 @@ +#include + +#if USE_AWS_S3 || USE_HDFS + #include #include #include @@ -37,3 +41,5 @@ private: }; } + +#endif diff --git a/src/IO/WriteIndirectBufferFromRemoteFS.cpp b/src/IO/WriteIndirectBufferFromRemoteFS.cpp index 2b9c4f628b8..adc711608d7 100644 --- a/src/IO/WriteIndirectBufferFromRemoteFS.cpp +++ b/src/IO/WriteIndirectBufferFromRemoteFS.cpp @@ -1,4 +1,6 @@ #include "WriteIndirectBufferFromRemoteFS.h" + +#if USE_AWS_S3 || USE_HDFS #include #include @@ -54,10 +56,16 @@ void WriteIndirectBufferFromRemoteFS::sync() } +#if USE_AWS_S3 template class WriteIndirectBufferFromRemoteFS; +#endif +#if USE_HDFS template class WriteIndirectBufferFromRemoteFS; +#endif } + +#endif diff --git a/src/IO/WriteIndirectBufferFromRemoteFS.h b/src/IO/WriteIndirectBufferFromRemoteFS.h index 246376c5366..2b752502d9b 100644 --- a/src/IO/WriteIndirectBufferFromRemoteFS.h +++ b/src/IO/WriteIndirectBufferFromRemoteFS.h @@ -1,3 +1,7 @@ +#include + +#if USE_AWS_S3 || USE_HDFS + #include #include #include @@ -30,3 +34,5 @@ private: }; } + +#endif