liuml07 commented on a change in pull request #4372:
URL: https://github.com/apache/iceberg/pull/4372#discussion_r832518050



##########
File path: api/src/main/java/org/apache/iceberg/Schema.java
##########
@@ -109,6 +109,8 @@ public Schema(int schemaId, List<NestedField> columns, 
Map<String, Integer> alia
   static void validateIdentifierField(int fieldId, Map<Integer, 
Types.NestedField> idToField,
                                               Map<Integer, Integer> 
idToParent) {
     Types.NestedField field = idToField.get(fieldId);
+    Preconditions.checkArgument(field != null,
+        "Can not add filedId %d as an identifier field: field not exists", 
fieldId);

Review comment:
       > maybe change it to Preconditions.checkArgument(null != field, "Cannot 
use fieldId %s: field does not exist", fieldId);
   
   I replaced `can not` with `cannot` which is also suggested in another 
comment. I think `filed != null` reads smoother and I see more places use this 
pattern. Keep "as an identifier field" in error message as this error may 
happen when constructing a full Schema, where it's clearer to report the error 
is for identifier fields.




-- 
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