ClickHouse/src/DataStreams/ExpressionBlockInputStream.cpp

40 lines
884 B
C++
Raw Normal View History

#include <Interpreters/ExpressionActions.h>
#include <DataStreams/ExpressionBlockInputStream.h>
2016-01-13 00:32:59 +00:00
namespace DB
{
ExpressionBlockInputStream::ExpressionBlockInputStream(const BlockInputStreamPtr & input, const ExpressionActionsPtr & expression_)
: expression(expression_)
2016-01-13 00:32:59 +00:00
{
children.push_back(input);
2019-05-16 17:16:25 +00:00
cached_header = children.back()->getHeader();
expression->execute(cached_header, true);
2016-01-13 00:32:59 +00:00
}
String ExpressionBlockInputStream::getName() const { return "Expression"; }
Block ExpressionBlockInputStream::getTotals()
2016-01-13 00:32:59 +00:00
{
totals = children.back()->getTotals();
2020-09-08 10:40:53 +00:00
expression->execute(totals);
2016-01-13 00:32:59 +00:00
return totals;
2016-01-13 00:32:59 +00:00
}
Block ExpressionBlockInputStream::getHeader() const
{
return cached_header.cloneEmpty();
}
2016-01-13 00:32:59 +00:00
Block ExpressionBlockInputStream::readImpl()
{
Block res = children.back()->read();
if (res)
expression->execute(res);
return res;
2016-01-13 00:32:59 +00:00
}
}