huan233usc commented on code in PR #746:
URL: https://github.com/apache/iceberg-cpp/pull/746#discussion_r3484397218


##########
src/iceberg/json_serde.cc:
##########
@@ -307,6 +310,15 @@ nlohmann::json ToJson(const SchemaField& field) {
   if (!field.doc().empty()) {
     json[kDoc] = field.doc();
   }
+  // Defaults are validated to be primitive literals matching the field type, 
so
+  // single-value serialization cannot fail here.
+  if (field.initial_default().has_value()) {
+    ICEBERG_ASSIGN_OR_THROW(json[kInitialDefault],

Review Comment:
   Thanks @wgtmac, this is in general a good call. But the changing the 
signature to return Result<nlohmann::json> just in case any error requires 
changing lots of places that is not related on default values. 
   
   I updated the pr but also create a pure refactor in 
https://github.com/apache/iceberg-cpp/pull/785



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to