Fix JSONExtract String with null value.

This commit is contained in:
Amos Bird 2021-08-21 17:03:16 +08:00
parent 14ef66e49b
commit 4d3db821bb
No known key found for this signature in database
GPG Key ID: 80D430DCBECFEDB4
3 changed files with 5 additions and 0 deletions

View File

@ -695,6 +695,8 @@ struct JSONExtractTree
{
if (element.isString())
return JSONExtractStringImpl<JSONParser>::insertResultToColumn(dest, element, {});
else if (element.isNull())
return false;
else
return JSONExtractRawImpl<JSONParser>::insertResultToColumn(dest, element, {});
}

View File

@ -1 +1,2 @@
('123','456','[7,8,9]')
\N

View File

@ -1 +1,3 @@
select JSONExtract('{"a": "123", "b": 456, "c": [7, 8, 9]}', 'Tuple(a String, b String, c String)');
with '{"string_value":null}' as json select JSONExtract(json, 'string_value', 'Nullable(String)');