nastra commented on code in PR #17413:
URL: https://github.com/apache/iceberg/pull/17413#discussion_r3773124689


##########
api/src/main/java/org/apache/iceberg/types/TypeUtil.java:
##########
@@ -291,6 +291,25 @@ public static List<Types.NestedField> 
ancestorFields(Schema schema, int fieldId)
     return parents;
   }
 
+  /**
+   * Returns whether a field may contain null values.
+   *
+   * <p>A field may be null if it is optional or if any field that contains it 
is optional. A
+   * required field nested in an optional struct is null whenever that struct 
is null. A field that
+   * is not present in the schema may be null because its requirement is 
unknown.
+   *
+   * @param schema The schema that contains the field ID
+   * @param fieldId The field ID to check
+   * @return true if the field may be null, false if it cannot be null
+   */
+  public static boolean isNullable(Schema schema, int fieldId) {
+    Types.NestedField field = schema.findField(fieldId);
+
+    return field == null

Review Comment:
   the only reason I didn't throw here initially is so that we could use the 
same method for `UnboundPredicate`, but throwing introduces a behavioral change 
(I've reverted the changes in `UnboundPredicate`)



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