mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Merge pull request #16082 from CurtizJ/fix-bad-aggregation
Fix segfault with wrong aggregation in lambdas
This commit is contained in:
commit
6dc5cb166f
@ -421,11 +421,17 @@ bool ExpressionAnalyzer::makeAggregateDescriptions(ActionsDAGPtr & actions)
|
||||
aggregate.argument_names.resize(arguments.size());
|
||||
DataTypes types(arguments.size());
|
||||
|
||||
const auto & index = actions->getIndex();
|
||||
for (size_t i = 0; i < arguments.size(); ++i)
|
||||
{
|
||||
getRootActionsNoMakeSet(arguments[i], true, actions);
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1 @@
|
||||
SELECT arrayMap(x -> x * sum(x), range(10)); -- { serverError 47 }
|
Loading…
Reference in New Issue
Block a user