mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-12 01:12:12 +00:00
97f2a2213e
* Move some code outside dbms/src folder * Fix paths
35 lines
726 B
C++
35 lines
726 B
C++
#include <DataStreams/FilterColumnsBlockInputStream.h>
|
|
|
|
namespace DB
|
|
{
|
|
|
|
Block FilterColumnsBlockInputStream::getHeader() const
|
|
{
|
|
Block block = children.back()->getHeader();
|
|
Block filtered;
|
|
|
|
for (const auto & it : columns_to_save)
|
|
if (throw_if_column_not_found || block.has(it))
|
|
filtered.insert(std::move(block.getByName(it)));
|
|
|
|
return filtered;
|
|
}
|
|
|
|
Block FilterColumnsBlockInputStream::readImpl()
|
|
{
|
|
Block block = children.back()->read();
|
|
|
|
if (!block)
|
|
return block;
|
|
|
|
Block filtered;
|
|
|
|
for (const auto & it : columns_to_save)
|
|
if (throw_if_column_not_found || block.has(it))
|
|
filtered.insert(std::move(block.getByName(it)));
|
|
|
|
return filtered;
|
|
}
|
|
|
|
}
|