Fix scalars for MV.

This commit is contained in:
Nikolai Kochetov 2020-04-30 18:00:38 +03:00 committed by Alexey Milovidov
parent e41e998f4a
commit abef634d1f
3 changed files with 11 additions and 0 deletions

View File

@ -93,6 +93,10 @@ PushingToViewsBlockOutputStream::PushingToViewsBlockOutputStream(
views.emplace_back(ViewInfo{std::move(query), database_table, std::move(out)});
}
/// Remove calculated scalar subquery results, because they can be calculated for real, not substituted tables.
if (views_context->hasQueryContext())
views_context->getQueryContext().dropScalars();
/// Do not push to destination table if the flag is set
if (!no_destination)
{

View File

@ -885,6 +885,12 @@ bool Context::hasScalar(const String & name) const
}
void Context::dropScalars()
{
scalars.clear();
}
StoragePtr Context::executeTableFunction(const ASTPtr & table_expression)
{
/// Slightly suboptimal.

View File

@ -330,6 +330,7 @@ public:
const Block & getScalar(const String & name) const;
void addScalar(const String & name, const Block & block);
bool hasScalar(const String & name) const;
void dropScalars();
StoragePtr executeTableFunction(const ASTPtr & table_expression);