Apply suggestions from code review

This commit is contained in:
Antonio Andelic 2024-04-29 14:59:31 +02:00 committed by GitHub
parent bff72f3b27
commit fb375e7a74
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 3 deletions

View File

@ -22,8 +22,7 @@ public:
static constexpr auto name = "clamp";
String getName() const override { return name; }
size_t getNumberOfArguments() const override { return 0; }
bool isVariadic() const override { return true; }
size_t getNumberOfArguments() const override { return 3; }
bool useDefaultImplementationForConstants() const override { return true; }
bool isSuitableForShortCircuitArgumentsExecution(const DataTypesWithConstInfo & /*arguments*/) const override { return false; }
static FunctionPtr create(ContextPtr) { return std::make_shared<FunctionClamp>(); }

View File

@ -12,4 +12,4 @@ select clamp(1, 5, nan);
select clamp(toInt64(number), toInt64(number-1), toInt64(number+1)) from numbers(3);
select clamp(number, number-1, number+1) from numbers(3); -- { serverError NO_COMMON_TYPE }
select clamp(1, 3, 2); -- { serverError BAD_ARGUMENTS }
select clamp(1, data[1], data[2])from (select arrayJoin([[1, 2], [2,3], [3,2], [4, 4]]) as data); -- { serverError 36 }
select clamp(1, data[1], data[2])from (select arrayJoin([[1, 2], [2,3], [3,2], [4, 4]]) as data); -- { serverError BAD_ARGUMENTS }