mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-20 05:05:38 +00:00
3cc0829cc1
This commit prevents stateful functions like rowNumberInAllBlocks from being modified in getHeader() calls.
44 lines
990 B
C++
44 lines
990 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"; }
|
|
|
|
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, true);
|
|
return res;
|
|
}
|
|
|
|
Block ExpressionBlockInputStream::readImpl()
|
|
{
|
|
Block res = children.back()->read();
|
|
if (!res)
|
|
return res;
|
|
expression->execute(res);
|
|
return res;
|
|
}
|
|
|
|
}
|