Merge pull request #16826 from amosbird/fixcrash

Fix crash in agg empty arglist
This commit is contained in:
alexey-milovidov 2020-11-14 23:23:00 +03:00 committed by GitHub
commit 2c0ab53492
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 1 deletions

View File

@ -104,7 +104,7 @@ public:
KeepAggregateFunctionVisitor(keep_data).visit(function_node->arguments);
/// Place argument of an aggregate function instead of function
if (!keep_aggregator)
if (!keep_aggregator && !function_node->arguments->children.empty())
{
String alias = function_node->alias;
ast = (function_node->arguments->children[0])->clone();

View File

@ -0,0 +1,5 @@
-- make sure the system.query_log table is created
SELECT 1;
SYSTEM FLUSH LOGS;
SELECT any() as t, substring(query, 1, 70) AS query, avg(memory_usage) usage, count() count FROM system.query_log WHERE event_date >= toDate(1604295323) AND event_time >= toDateTime(1604295323) AND type in (1,2,3,4) and initial_user in ('') and('all' = 'all' or(positionCaseInsensitive(query, 'all') = 1)) GROUP BY query ORDER BY usage desc LIMIT 5; -- { serverError 42 }