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


##########
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) {

Review Comment:
   It looks like this is using the term "nullable" to mean that the field may 
be in an optional parent or may be optional itself. I don't think that is 
obvious, nor is it very differentiated from "optional" that we use in most 
places across the library. This method name should be more specific.



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