mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-17 21:24:28 +00:00
44 lines
992 B
C++
44 lines
992 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);
|
|
}
|
|
|
|
String ExpressionBlockInputStream::getName() const { return "Expression"; }
|
|
|
|
const Block & ExpressionBlockInputStream::getTotals()
|
|
{
|
|
if (IProfilingBlockInputStream * child = dynamic_cast<IProfilingBlockInputStream *>(&*children.back()))
|
|
{
|
|
totals = child->getTotals();
|
|
expression->executeOnTotals(totals);
|
|
}
|
|
|
|
return totals;
|
|
}
|
|
|
|
Block ExpressionBlockInputStream::getHeader() const
|
|
{
|
|
Block res = children.back()->getHeader();
|
|
expression->execute(res);
|
|
return res;
|
|
}
|
|
|
|
Block ExpressionBlockInputStream::readImpl()
|
|
{
|
|
Block res = children.back()->read();
|
|
if (!res)
|
|
return res;
|
|
expression->execute(res);
|
|
return res;
|
|
}
|
|
|
|
}
|