diff --git a/src/Functions/FunctionsJSON.h b/src/Functions/FunctionsJSON.h index d0762ff9a8d..0ac04ae0dec 100644 --- a/src/Functions/FunctionsJSON.h +++ b/src/Functions/FunctionsJSON.h @@ -695,6 +695,8 @@ struct JSONExtractTree { if (element.isString()) return JSONExtractStringImpl::insertResultToColumn(dest, element, {}); + else if (element.isNull()) + return false; else return JSONExtractRawImpl::insertResultToColumn(dest, element, {}); } diff --git a/tests/queries/0_stateless/01915_json_extract_raw_string.reference b/tests/queries/0_stateless/01915_json_extract_raw_string.reference index 839cb33f5f2..3a41f35710c 100644 --- a/tests/queries/0_stateless/01915_json_extract_raw_string.reference +++ b/tests/queries/0_stateless/01915_json_extract_raw_string.reference @@ -1 +1,2 @@ ('123','456','[7,8,9]') +\N diff --git a/tests/queries/0_stateless/01915_json_extract_raw_string.sql b/tests/queries/0_stateless/01915_json_extract_raw_string.sql index 6ba94ac6dfd..4c5be79f6ef 100644 --- a/tests/queries/0_stateless/01915_json_extract_raw_string.sql +++ b/tests/queries/0_stateless/01915_json_extract_raw_string.sql @@ -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)');