amogh-jahagirdar commented on code in PR #11261:
URL: https://github.com/apache/iceberg/pull/11261#discussion_r1797529748


##########
spark/v3.5/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestDelete.java:
##########
@@ -1401,6 +1401,22 @@ public void 
testDeleteToCustomWapBranchWithoutWhereClause() throws NoSuchTableEx
         });
   }
 
+  @TestTemplate
+  public void testDeleteWithFilterOnNestedColumn() {
+    createAndInitNestedColumnsTable();
+
+    sql("INSERT INTO TABLE %s VALUES (1, named_struct(\"c1\", 3, \"c2\", 
\"v1\"))", tableName);
+    sql("INSERT INTO TABLE %s VALUES (2, named_struct(\"c1\", 2, \"c2\", 
\"v2\"))", tableName);
+
+    sql("DELETE FROM %s WHERE complex.c1 = 3", tableName);
+    assertEquals(
+        "Should have expected rows", ImmutableList.of(row(2)), sql("SELECT id 
FROM %s", tableName));
+
+    sql("DELETE FROM %s t WHERE t.complex.c1 = 2", tableName);
+    assertEquals(
+        "Should have expected rows", ImmutableList.of(), sql("SELECT id FROM 
%s", tableName));

Review Comment:
   Could we add a case where the filter results in nothing being deleted? 



##########
api/src/test/java/org/apache/iceberg/expressions/TestStrictMetricsEvaluator.java:
##########
@@ -627,4 +638,47 @@ public void testIntegerNotIn() {
     shouldRead = new StrictMetricsEvaluator(SCHEMA, notIn("no_nulls", "abc", 
"def")).eval(FILE);
     assertThat(shouldRead).as("Should not match: no_nulls field does not have 
bounds").isFalse();
   }
+
+  @Test
+  public void testEvaluateOnNestedColumns() {
+    boolean shouldRead =
+        new StrictMetricsEvaluator(
+                SCHEMA, greaterThanOrEqual("struct.nested_col_no_stats", 
INT_MIN_VALUE))
+            .eval(FILE);
+    assertThat(shouldRead).as("Should not match: nested column").isFalse();
+
+    shouldRead =
+        new StrictMetricsEvaluator(
+                SCHEMA, lessThanOrEqual("struct.nested_col_no_stats", 
INT_MAX_VALUE))
+            .eval(FILE);
+    assertThat(shouldRead).as("Should not match: nested column").isFalse();
+
+    shouldRead =
+        new StrictMetricsEvaluator(SCHEMA, 
isNull("struct.nested_col_no_stats")).eval(FILE);
+    assertThat(shouldRead).as("Should not match: nested column").isFalse();
+
+    shouldRead =

Review Comment:
   Is it possible to separate these into 2 test methods, one for no stats and 
the other with stats? Could we also update the messages to be more precise, 
instead of just "Should not match: nested column", I think "isNull nested 
column should not match"



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

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


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

Reply via email to