ExecutableUserDefinedFunction fix usage in GROUP BY

This commit is contained in:
Maksim Kita 2022-04-21 13:44:56 +02:00
parent dd93d5d872
commit 397603e9be
3 changed files with 23 additions and 3 deletions

View File

@ -21,6 +21,7 @@
#include <Interpreters/Context.h>
#include <Interpreters/ExternalDictionariesLoader.h>
#include <Interpreters/GatherFunctionQuantileVisitor.h>
#include <Interpreters/UserDefinedExecutableFunctionFactory.h>
#include <Parsers/ASTExpressionList.h>
#include <Parsers/ASTFunction.h>
@ -138,10 +139,18 @@ void optimizeGroupBy(ASTSelectQuery * select_query, ContextPtr context)
continue;
}
}
else if (!function_factory.get(function->name, context)->isInjective({}))
else
{
++i;
continue;
FunctionOverloadResolverPtr function_builder = UserDefinedExecutableFunctionFactory::instance().tryGet(function->name, context);
if (!function_builder)
function_builder = function_factory.get(function->name, context);
if (function_builder->isInjective({}))
{
++i;
continue;
}
}
/// copy shared pointer to args in order to ensure lifetime

View File

@ -0,0 +1,10 @@
0
2
4
6
8
10
12
14
16
18

View File

@ -0,0 +1 @@
SELECT test_function(number, number) as a FROM numbers(10) GROUP BY a ORDER BY a;