mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-14 19:45:11 +00:00
Add missing check for argument type
This commit is contained in:
parent
d65f98ea25
commit
5f589e20a3
@ -127,6 +127,15 @@ namespace
|
||||
|
||||
if (args_size == 3)
|
||||
{
|
||||
if ((type_x->isValueRepresentedByNumber() != type_arr_to_nested->isValueRepresentedByNumber())
|
||||
|| (isString(type_x) != isString(type_arr_to_nested)))
|
||||
throw Exception(
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
|
||||
"Function {} has signature: "
|
||||
"transform(T, Array(T), Array(U), U) -> U; "
|
||||
"or transform(T, Array(T), Array(T)) -> T; where T and U are types.",
|
||||
getName());
|
||||
|
||||
auto ret = tryGetLeastSupertype(DataTypes{type_arr_to_nested, type_x});
|
||||
if (!ret)
|
||||
throw Exception(
|
||||
|
@ -69,3 +69,4 @@ other
|
||||
2100
|
||||
2200
|
||||
2900
|
||||
----
|
||||
|
@ -21,3 +21,5 @@ SELECT '----';
|
||||
SELECT transform(number, [2, 4, 6], [2900, 2000, 2100], 2200) as x FROM numbers(10) GROUP BY x;
|
||||
SELECT '#1';
|
||||
SELECT transform(number, [2, 4, 6], [2900, 2000, 2100], materialize(2200)) as x FROM numbers(10) GROUP BY x;
|
||||
SELECT '----';
|
||||
SELECT transform(number, [1], [null]) FROM system.numbers LIMIT 1; -- { serverError ILLEGAL_TYPE_OF_ARGUMENT }
|
||||
|
Loading…
Reference in New Issue
Block a user