From a3d57bd5aff3f6f57cc0e3ec7fe5e9eefbebe7b2 Mon Sep 17 00:00:00 2001 From: Dmitry Krylov Date: Mon, 12 Apr 2021 20:29:35 +1000 Subject: [PATCH] Check number of arguments --- src/Functions/array/arrayFold.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/Functions/array/arrayFold.cpp b/src/Functions/array/arrayFold.cpp index 546c5a627bb..bd38a25d77a 100644 --- a/src/Functions/array/arrayFold.cpp +++ b/src/Functions/array/arrayFold.cpp @@ -30,13 +30,8 @@ public: /// For argument-lambda expressions, it defines the types of arguments of these expressions. void getLambdaArgumentTypes(DataTypes & arguments) const override { - if (arguments.empty()) - throw Exception("Function " + getName() + " needs at least one argument; passed " - + toString(arguments.size()) + ".", - ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH); - - if (arguments.size() == 1) - throw Exception("Function " + getName() + " needs at least one array argument.", + if (arguments.size() < 3) + throw Exception("Function " + getName() + " needs lambda function, at least one array argument and one accumulator argument.", ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH); DataTypes nested_types(arguments.size() - 1);