mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 10:02:01 +00:00
Fix array index argument type check for JSONExtract* functions
This commit is contained in:
parent
c33bd7794f
commit
399d024c2c
@ -191,7 +191,7 @@ private:
|
||||
for (const auto i : collections::range(first_index_argument, first_index_argument + num_index_arguments))
|
||||
{
|
||||
const auto & column = columns[i];
|
||||
if (!isString(column.type) && !isInteger(column.type))
|
||||
if (!isString(column.type) && !isNativeInteger(column.type))
|
||||
throw Exception{"The argument " + std::to_string(i + 1) + " of function " + String(function_name)
|
||||
+ " should be a string specifying key or an integer specifying index, illegal type: " + column.type->getName(),
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT};
|
||||
|
@ -253,3 +253,4 @@ e
|
||||
u
|
||||
v
|
||||
--show error: type should be const string
|
||||
--show error: index type should be integer
|
||||
|
@ -280,3 +280,6 @@ SELECT JSONExtractString(json, 's') FROM (SELECT arrayJoin(['{"s":"u"}', '{"s":"
|
||||
SELECT '--show error: type should be const string';
|
||||
SELECT JSONExtractKeysAndValues([], JSONLength('^?V{LSwp')); -- { serverError 44 }
|
||||
WITH '{"i": 1, "f": 1.2}' AS json SELECT JSONExtract(json, 'i', JSONType(json, 'i')); -- { serverError 44 }
|
||||
|
||||
SELECT '--show error: index type should be integer';
|
||||
SELECT JSONExtract('[]', JSONExtract('0', 'UInt256'), 'UInt256'); -- { serverError 43 }
|
||||
|
Loading…
Reference in New Issue
Block a user