mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-18 05:32:52 +00:00
41 lines
909 B
C++
41 lines
909 B
C++
#include <Interpreters/ExpressionActions.h>
|
|
#include <DataStreams/ExpressionBlockInputStream.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
ExpressionBlockInputStream::ExpressionBlockInputStream(const BlockInputStreamPtr & input, const ExpressionActionsPtr & expression_)
|
|
: expression(expression_)
|
|
{
|
|
children.push_back(input);
|
|
cached_header = children.back()->getHeader();
|
|
expression->execute(cached_header, true);
|
|
}
|
|
|
|
String ExpressionBlockInputStream::getName() const { return "Expression"; }
|
|
|
|
Block ExpressionBlockInputStream::getTotals()
|
|
{
|
|
totals = children.back()->getTotals();
|
|
expression->executeOnTotals(totals);
|
|
|
|
return totals;
|
|
}
|
|
|
|
Block ExpressionBlockInputStream::getHeader() const
|
|
{
|
|
return cached_header.cloneEmpty();
|
|
}
|
|
|
|
Block ExpressionBlockInputStream::readImpl()
|
|
{
|
|
Block res = children.back()->read();
|
|
if (!res)
|
|
return res;
|
|
expression->execute(res);
|
|
return res;
|
|
}
|
|
|
|
}
|