mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 16:50:48 +00:00
fix segfault with wrong aggregation in lambdas
This commit is contained in:
parent
e89a3b5d09
commit
0de364ec94
@ -421,11 +421,17 @@ bool ExpressionAnalyzer::makeAggregateDescriptions(ActionsDAGPtr & actions)
|
|||||||
aggregate.argument_names.resize(arguments.size());
|
aggregate.argument_names.resize(arguments.size());
|
||||||
DataTypes types(arguments.size());
|
DataTypes types(arguments.size());
|
||||||
|
|
||||||
|
const auto & index = actions->getIndex();
|
||||||
for (size_t i = 0; i < arguments.size(); ++i)
|
for (size_t i = 0; i < arguments.size(); ++i)
|
||||||
{
|
{
|
||||||
getRootActionsNoMakeSet(arguments[i], true, actions);
|
getRootActionsNoMakeSet(arguments[i], true, actions);
|
||||||
const std::string & name = arguments[i]->getColumnName();
|
const std::string & name = arguments[i]->getColumnName();
|
||||||
types[i] = actions->getIndex().find(name)->second->result_type;
|
|
||||||
|
auto it = index.find(name);
|
||||||
|
if (it == index.end())
|
||||||
|
throw Exception(ErrorCodes::UNKNOWN_IDENTIFIER, "Unknown identifier (in aggregate function '{}'): {}", node->name, name);
|
||||||
|
|
||||||
|
types[i] = it->second->result_type;
|
||||||
aggregate.argument_names[i] = name;
|
aggregate.argument_names[i] = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
SELECT arrayMap(x -> x * sum(x), range(10)); -- { serverError 47 }
|
Loading…
Reference in New Issue
Block a user