You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/03/22 18:44:16 UTC

[GitHub] [iceberg] liuml07 commented on a change in pull request #4372: API: Fix NPE when validating identifier fields

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



##########
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:
       > Also, I thought Preconditions only supports %s, does this actually work?
   https://javadoc.io/doc/com.google.guava/guava/latest/com/google/common/base/Preconditions.html
   
   You are right. I changed to %s now.




-- 
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-unsubscribe@iceberg.apache.org

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



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