From 6703e3e6daf6341128308b82e373e7374134ec0c Mon Sep 17 00:00:00 2001 From: Li Feiyang Date: Fri, 17 Oct 2025 16:54:05 +0800 Subject: [PATCH] update --- src/iceberg/util/json_util_internal.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/iceberg/util/json_util_internal.h b/src/iceberg/util/json_util_internal.h index c525ac90a..81d17b04b 100644 --- a/src/iceberg/util/json_util_internal.h +++ b/src/iceberg/util/json_util_internal.h @@ -57,7 +57,7 @@ Result GetJsonValueImpl(const nlohmann::json& json, std::string_view key) { template Result> GetJsonValueOptional(const nlohmann::json& json, std::string_view key) { - if (!json.contains(key)) { + if (!json.contains(key) || json.at(key).is_null()) { return std::nullopt; } ICEBERG_ASSIGN_OR_RAISE(auto value, GetJsonValueImpl(json, key)); @@ -66,7 +66,7 @@ Result> GetJsonValueOptional(const nlohmann::json& json, template Result GetJsonValue(const nlohmann::json& json, std::string_view key) { - if (!json.contains(key)) { + if (!json.contains(key) || json.at(key).is_null()) { return JsonParseError("Missing '{}' in {}", key, SafeDumpJson(json)); } return GetJsonValueImpl(json, key); @@ -75,7 +75,7 @@ Result GetJsonValue(const nlohmann::json& json, std::string_view key) { template Result GetJsonValueOrDefault(const nlohmann::json& json, std::string_view key, T default_value = T{}) { - if (!json.contains(key)) { + if (!json.contains(key) || json.at(key).is_null()) { return default_value; } return GetJsonValueImpl(json, key);