rdblue commented on a change in pull request #845: Add persistent IDs to 
partition fields
URL: https://github.com/apache/incubator-iceberg/pull/845#discussion_r403232756
 
 

 ##########
 File path: core/src/main/java/org/apache/iceberg/PartitionSpecParser.java
 ##########
 @@ -138,6 +140,13 @@ private static void 
buildFromJsonFields(PartitionSpec.Builder builder, JsonNode
         "Cannot parse partition spec fields, not an array: %s", json);
 
     Iterator<JsonNode> elements = json.elements();
+
+    boolean hasFieldId = false;
+    if (elements.hasNext() && elements.next().has(FIELD_ID)) {
+      hasFieldId = true;
+    }
+    elements = json.elements();
 
 Review comment:
   I think it would be easier to follow and would result in a better error 
message if we put this logic inside the elements loop.
   
   How about adding a counter for field IDs that are present and after the loop 
throwing an exception if the counter is not equal to the number of fields? Then 
each field would be handled independently (using `has(FIELD_ID)`).
   
   I like the idea of a check here that states there were missing field IDs.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to