Update ExpressionAnalyzer.cpp

This commit is contained in:
alexey-milovidov 2019-05-25 13:51:48 +03:00 committed by GitHub
parent cbc0f56af1
commit 1d98441c34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -852,13 +852,16 @@ bool ExpressionAnalyzer::appendLimitBy(ExpressionActionsChain & chain, bool only
NameSet aggregated_names;
for (const auto & column : aggregated_columns)
{
step.required_output.push_back(column.name);
aggregated_names.insert(column.name);
step.required_output.push_back(column.name);
aggregated_names.insert(column.name);
}
for (const auto & child : select_query->limitBy()->children)
if (!aggregated_names.count(child->getColumnName()))
step.required_output.push_back(child->getColumnName());
{
auto child_name = child->getColumnName();
if (!aggregated_names.count(child_name))
step.required_output.push_back(std::move(child_name));
}
return true;
}