Revert "Merge pull request #49419 from ClickHouse/fix-function-parameter-exception"

This reverts commit b921476a3b, reversing
changes made to 7896d30737.
This commit is contained in:
Alexey Milovidov 2023-07-08 00:56:42 +02:00
parent a96874850e
commit f4696d762c
2 changed files with 1 additions and 15 deletions

View File

@ -116,7 +116,6 @@ namespace ErrorCodes
extern const int UNKNOWN_TABLE; extern const int UNKNOWN_TABLE;
extern const int ILLEGAL_COLUMN; extern const int ILLEGAL_COLUMN;
extern const int NUMBER_OF_COLUMNS_DOESNT_MATCH; extern const int NUMBER_OF_COLUMNS_DOESNT_MATCH;
extern const int FUNCTION_CANNOT_HAVE_PARAMETERS;
} }
/** Query analyzer implementation overview. Please check documentation in QueryAnalysisPass.h first. /** Query analyzer implementation overview. Please check documentation in QueryAnalysisPass.h first.
@ -4897,11 +4896,6 @@ ProjectionNames QueryAnalyzer::resolveFunction(QueryTreeNodePtr & node, Identifi
lambda_expression_untyped->formatASTForErrorMessage(), lambda_expression_untyped->formatASTForErrorMessage(),
scope.scope_node->formatASTForErrorMessage()); scope.scope_node->formatASTForErrorMessage());
if (!parameters.empty())
{
throw Exception(ErrorCodes::FUNCTION_CANNOT_HAVE_PARAMETERS, "Function {} is not parametric", function_node.formatASTForErrorMessage());
}
auto lambda_expression_clone = lambda_expression_untyped->clone(); auto lambda_expression_clone = lambda_expression_untyped->clone();
IdentifierResolveScope lambda_scope(lambda_expression_clone, &scope /*parent_scope*/); IdentifierResolveScope lambda_scope(lambda_expression_clone, &scope /*parent_scope*/);
@ -5018,12 +5012,9 @@ ProjectionNames QueryAnalyzer::resolveFunction(QueryTreeNodePtr & node, Identifi
} }
FunctionOverloadResolverPtr function = UserDefinedExecutableFunctionFactory::instance().tryGet(function_name, scope.context, parameters); FunctionOverloadResolverPtr function = UserDefinedExecutableFunctionFactory::instance().tryGet(function_name, scope.context, parameters);
bool is_executable_udf = false;
if (!function) if (!function)
function = FunctionFactory::instance().tryGet(function_name, scope.context); function = FunctionFactory::instance().tryGet(function_name, scope.context);
else
is_executable_udf = true;
if (!function) if (!function)
{ {
@ -5074,12 +5065,6 @@ ProjectionNames QueryAnalyzer::resolveFunction(QueryTreeNodePtr & node, Identifi
return result_projection_names; return result_projection_names;
} }
/// Executable UDFs may have parameters. They are checked in UserDefinedExecutableFunctionFactory.
if (!parameters.empty() && !is_executable_udf)
{
throw Exception(ErrorCodes::FUNCTION_CANNOT_HAVE_PARAMETERS, "Function {} is not parametric", function_name);
}
/** For lambda arguments we need to initialize lambda argument types DataTypeFunction using `getLambdaArgumentTypes` function. /** For lambda arguments we need to initialize lambda argument types DataTypeFunction using `getLambdaArgumentTypes` function.
* Then each lambda arguments are initialized with columns, where column source is lambda. * Then each lambda arguments are initialized with columns, where column source is lambda.
* This information is important for later steps of query processing. * This information is important for later steps of query processing.

View File

@ -111,6 +111,7 @@
00917_multiple_joins_denny_crane 00917_multiple_joins_denny_crane
00725_join_on_bug_1 00725_join_on_bug_1
00636_partition_key_parts_pruning 00636_partition_key_parts_pruning
00261_storage_aliases_and_array_join
01825_type_json_multiple_files 01825_type_json_multiple_files
01281_group_by_limit_memory_tracking 01281_group_by_limit_memory_tracking
02723_zookeeper_name 02723_zookeeper_name