diff --git a/dbms/src/Storages/System/StorageSystemDetachedParts.cpp b/dbms/src/Storages/System/StorageSystemDetachedParts.cpp index 583df8aefa5..615b0f45cf5 100644 --- a/dbms/src/Storages/System/StorageSystemDetachedParts.cpp +++ b/dbms/src/Storages/System/StorageSystemDetachedParts.cpp @@ -7,6 +7,7 @@ #include #include #include +#include namespace DB { @@ -42,7 +43,7 @@ protected: }}); } - BlockInputStreams read( + Pipes readWithProcessors( const Names & /* column_names */, const SelectQueryInfo & query_info, const Context & context, @@ -74,8 +75,12 @@ protected: } } - return BlockInputStreams(1, std::make_shared( - block.cloneWithColumns(std::move(new_columns)))); + UInt64 num_rows = new_columns.at(0)->size(); + Chunk chunk(std::move(new_columns), num_rows); + + Pipes pipes; + pipes.emplace_back(std::make_shared(std::move(block), std::move(chunk))); + return pipes; } }; diff --git a/dbms/src/Storages/System/StorageSystemDisks.cpp b/dbms/src/Storages/System/StorageSystemDisks.cpp index 3e40a6f1fc2..4f80b9c1d86 100644 --- a/dbms/src/Storages/System/StorageSystemDisks.cpp +++ b/dbms/src/Storages/System/StorageSystemDisks.cpp @@ -1,5 +1,6 @@ #include #include +#include namespace DB { @@ -22,7 +23,7 @@ StorageSystemDisks::StorageSystemDisks(const std::string & name_) })); } -BlockInputStreams StorageSystemDisks::read( +Pipes StorageSystemDisks::readWithProcessors( const Names & column_names, const SelectQueryInfo & /*query_info*/, const Context & context, @@ -49,15 +50,20 @@ BlockInputStreams StorageSystemDisks::read( col_keep->insert(disk_ptr->getKeepingFreeSpace()); } - Block res = getSampleBlock().cloneEmpty(); - size_t col_num = 0; - res.getByPosition(col_num++).column = std::move(col_name); - res.getByPosition(col_num++).column = std::move(col_path); - res.getByPosition(col_num++).column = std::move(col_free); - res.getByPosition(col_num++).column = std::move(col_total); - res.getByPosition(col_num++).column = std::move(col_keep); + Columns columns; + columns.emplace_back(std::move(col_name)); + columns.emplace_back(std::move(col_path)); + columns.emplace_back(std::move(col_free)); + columns.emplace_back(std::move(col_total)); + columns.emplace_back(std::move(col_keep)); - return BlockInputStreams(1, std::make_shared(res)); + UInt64 num_rows = columns.at(0)->size(); + Chunk chunk(std::move(columns), num_rows); + + Pipes pipes; + pipes.emplace_back(std::make_shared(getSampleBlock(), std::move(chunk))); + + return pipes; } } diff --git a/dbms/src/Storages/System/StorageSystemDisks.h b/dbms/src/Storages/System/StorageSystemDisks.h index 8b472177ac0..15b04e2e2e4 100644 --- a/dbms/src/Storages/System/StorageSystemDisks.h +++ b/dbms/src/Storages/System/StorageSystemDisks.h @@ -20,7 +20,7 @@ class StorageSystemDisks : public ext::shared_ptr_helper, pu public: std::string getName() const override { return "SystemDisks"; } - BlockInputStreams read( + Pipes readWithProcessors( const Names & column_names, const SelectQueryInfo & query_info, const Context & context,