cache ExpressionBlockInputStream header

This commit is contained in:
chertus 2019-05-14 21:26:19 +03:00
parent aba710a70e
commit 4a5e2dfd3c
2 changed files with 8 additions and 3 deletions

View File

@ -23,9 +23,13 @@ Block ExpressionBlockInputStream::getTotals()
Block ExpressionBlockInputStream::getHeader() const
{
Block res = children.back()->getHeader();
expression->execute(res, true);
return res;
if (!cached_header.columns())
{
cached_header = children.back()->getHeader();
expression->execute(cached_header, true);
}
return cached_header.cloneEmpty();
}
Block ExpressionBlockInputStream::readImpl()

View File

@ -30,6 +30,7 @@ protected:
private:
ExpressionActionsPtr expression;
mutable Block cached_header;
};
}