Check number of arguments

This commit is contained in:
Dmitry Krylov 2021-04-12 20:29:35 +10:00
parent a5a4fbdb00
commit a3d57bd5af

View File

@ -30,13 +30,8 @@ public:
/// For argument-lambda expressions, it defines the types of arguments of these expressions. /// For argument-lambda expressions, it defines the types of arguments of these expressions.
void getLambdaArgumentTypes(DataTypes & arguments) const override void getLambdaArgumentTypes(DataTypes & arguments) const override
{ {
if (arguments.empty()) if (arguments.size() < 3)
throw Exception("Function " + getName() + " needs at least one argument; passed " throw Exception("Function " + getName() + " needs lambda function, at least one array argument and one accumulator argument.",
+ toString(arguments.size()) + ".",
ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);
if (arguments.size() == 1)
throw Exception("Function " + getName() + " needs at least one array argument.",
ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH); ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);
DataTypes nested_types(arguments.size() - 1); DataTypes nested_types(arguments.size() - 1);