mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-18 13:42:02 +00:00
46 lines
975 B
C++
46 lines
975 B
C++
|
#include <DB/Interpreters/ExpressionActions.h>
|
||
|
#include <DB/DataStreams/ExpressionBlockInputStream.h>
|
||
|
|
||
|
|
||
|
namespace DB
|
||
|
{
|
||
|
|
||
|
ExpressionBlockInputStream::ExpressionBlockInputStream(BlockInputStreamPtr input_, ExpressionActionsPtr expression_)
|
||
|
: expression(expression_)
|
||
|
{
|
||
|
children.push_back(input_);
|
||
|
}
|
||
|
|
||
|
String ExpressionBlockInputStream::getName() const { return "Expression"; }
|
||
|
|
||
|
String ExpressionBlockInputStream::getID() const
|
||
|
{
|
||
|
std::stringstream res;
|
||
|
res << "Expression(" << children.back()->getID() << ", " << expression->getID() << ")";
|
||
|
return res.str();
|
||
|
}
|
||
|
|
||
|
const Block & ExpressionBlockInputStream::getTotals()
|
||
|
{
|
||
|
if (IProfilingBlockInputStream * child = dynamic_cast<IProfilingBlockInputStream *>(&*children.back()))
|
||
|
{
|
||
|
totals = child->getTotals();
|
||
|
expression->executeOnTotals(totals);
|
||
|
}
|
||
|
|
||
|
return totals;
|
||
|
}
|
||
|
|
||
|
Block ExpressionBlockInputStream::readImpl()
|
||
|
{
|
||
|
Block res = children.back()->read();
|
||
|
if (!res)
|
||
|
return res;
|
||
|
|
||
|
expression->execute(res);
|
||
|
|
||
|
return res;
|
||
|
}
|
||
|
|
||
|
}
|