mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-15 02:41:59 +00:00
97f2a2213e
* Move some code outside dbms/src folder * Fix paths
38 lines
917 B
C++
38 lines
917 B
C++
#pragma once
|
|
|
|
#include <DataStreams/IBlockInputStream.h>
|
|
#include <iostream>
|
|
|
|
namespace DB
|
|
{
|
|
|
|
/// Removes columns other than columns_to_save_ from block,
|
|
/// and reorders columns as in columns_to_save_.
|
|
/// Functionality is similar to ExpressionBlockInputStream with ExpressionActions containing PROJECT action.
|
|
class FilterColumnsBlockInputStream : public IBlockInputStream
|
|
{
|
|
public:
|
|
FilterColumnsBlockInputStream(
|
|
const BlockInputStreamPtr & input, const Names & columns_to_save_, bool throw_if_column_not_found_)
|
|
: columns_to_save(columns_to_save_), throw_if_column_not_found(throw_if_column_not_found_)
|
|
{
|
|
children.push_back(input);
|
|
}
|
|
|
|
String getName() const override
|
|
{
|
|
return "FilterColumns";
|
|
}
|
|
|
|
Block getHeader() const override;
|
|
|
|
protected:
|
|
Block readImpl() override;
|
|
|
|
private:
|
|
Names columns_to_save;
|
|
bool throw_if_column_not_found;
|
|
};
|
|
|
|
}
|