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/06/24 00:38:42 UTC

[GitHub] [iceberg] szehon-ho commented on a diff in pull request #5113: Fix NPE in BoundPredicate.toString for IS_NULL/NOT_NULL on an optional struct column

szehon-ho commented on code in PR #5113:
URL: https://github.com/apache/iceberg/pull/5113#discussion_r905604572


##########
api/src/main/java/org/apache/iceberg/expressions/UnboundPredicate.java:
##########
@@ -109,6 +109,10 @@ public Expression bind(StructType struct, boolean caseSensitive) {
       return bindUnaryOperation(bound);
     }
 
+    if (bound.type().isNestedType()) {

Review Comment:
   Wondering if this is necessary.  Today will hit ValidationException when it tries to make a Literal?  
   
   If necessary, we can use "Preconditions".



##########
api/src/test/java/org/apache/iceberg/expressions/TestPredicateBinding.java:
##########
@@ -605,4 +605,188 @@ public void testNotInPredicateBindingConversionToExpression() {
     Expression expr = unbound.bind(struct);
     Assert.assertEquals("Should change NOT_IN to alwaysTrue expression", Expressions.alwaysTrue(), expr);
   }
+
+  @Test
+  public void testStructFields() {
+    StructType structFieldType =
+        Types.StructType.of(Types.NestedField.optional(11, "float_field", Types.FloatType.get()));
+    StructType struct = StructType.of(
+        optional(10, "struct", structFieldType)
+    );
+
+    UnboundPredicate<Float> lt = new UnboundPredicate<>(LT, ref("struct"), 1.234f);
+    try {
+      lt.bind(struct);

Review Comment:
   For this and other instance of validation exception, we can use "AssertHelpers.assertThrowsCause"



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