ClickHouse/dbms/include/DB/DataStreams/AddingDefaultBlockOutputStream.h

41 lines
864 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
#include <Poco/SharedPtr.h>
#include <DB/DataStreams/IBlockOutputStream.h>
#include <DB/Columns/ColumnConst.h>
namespace DB
{
/** Добавляет в блок недостающие столбцы со значениями по-умолчанию.
* Эти столбцы - материалированные (не константы).
*/
class AddingDefaultBlockOutputStream : public IBlockOutputStream
{
public:
AddingDefaultBlockOutputStream(
BlockOutputStreamPtr output_,
NamesAndTypesListPtr required_columns_)
: output(output_), required_columns(required_columns_)
{
}
String getName() const { return "AddingDefaultBlockOutputStream"; }
void write(const Block & block) {
Block res = block;
res.addDefaults(required_columns);
}
private:
BlockOutputStreamPtr output;
NamesAndTypesListPtr required_columns;
};
}