barronw commented on code in PR #1426:
URL: https://github.com/apache/iceberg-python/pull/1426#discussion_r1890958338


##########
pyiceberg/table/name_mapping.py:
##########
@@ -49,9 +49,10 @@ def convert_null_to_empty_List(cls, v: Any) -> Any:
     @model_serializer
     def ser_model(self) -> Dict[str, Any]:
         """Set custom serializer to leave out the field when it is empty."""
+        field_id = {"field-id": self.field_id} if self.field_id is not None 
else {}
         fields = {"fields": self.fields} if len(self.fields) > 0 else {}
         return {
-            "field-id": self.field_id,
+            **field_id,
             "names": self.names,
             **fields,
         }

Review Comment:
   Updated, needed to reorder fields in the tests.



##########
pyiceberg/table/name_mapping.py:
##########
@@ -49,9 +49,10 @@ def convert_null_to_empty_List(cls, v: Any) -> Any:
     @model_serializer
     def ser_model(self) -> Dict[str, Any]:
         """Set custom serializer to leave out the field when it is empty."""
+        field_id = {"field-id": self.field_id} if self.field_id is not None 
else {}
         fields = {"fields": self.fields} if len(self.fields) > 0 else {}
         return {
-            "field-id": self.field_id,
+            **field_id,
             "names": self.names,
             **fields,
         }

Review Comment:
   Updated, needed to also reorder fields in the tests.



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to