yangshangqing95 commented on code in PR #17346:
URL: https://github.com/apache/iceberg/pull/17346#discussion_r3691647649


##########
core/src/test/java/org/apache/iceberg/TestMetadataTableScans.java:
##########
@@ -467,6 +467,125 @@ public void testAllManifestsTableHonorsIgnoreResiduals() 
throws IOException {
     validateTaskScanResiduals(scan2, true);
   }
 
+  @TestTemplate
+  public void testAllManifestsTableNegatedPredicateOnNonSnapshotColumn() 
throws IOException {
+    // Snapshots 1,2,3,4
+    preparePartitionedTableData();
+
+    Table allManifestsTable = new AllManifestsTable(table);
+    TableScan scan =
+        allManifestsTable
+            .newScan()
+            .filter(Expressions.not(Expressions.equal("content", 
ManifestContent.DATA.id())));
+
+    assertThat(scannedPaths(scan))
+        .as("A negated predicate on content must not prune snapshots")
+        .isEqualTo(expectedManifestListPaths(table.snapshots(), 1L, 2L, 3L, 
4L));
+  }
+
+  @TestTemplate
+  public void testAllManifestsTableNotEqualPredicateOnNonSnapshotColumn() 
throws IOException {
+    // Snapshots 1,2,3,4
+    preparePartitionedTableData();
+
+    Table allManifestsTable = new AllManifestsTable(table);
+    TableScan scan =
+        allManifestsTable
+            .newScan()
+            .filter(Expressions.notEqual("content", 
ManifestContent.DATA.id()));
+
+    assertThat(scannedPaths(scan))
+        .as("A not-equal predicate on content must not prune snapshots")
+        .isEqualTo(expectedManifestListPaths(table.snapshots(), 1L, 2L, 3L, 
4L));
+  }
+
+  @TestTemplate
+  public void testAllManifestsTableNegatedOrPredicate() throws IOException {
+    // Snapshots 1,2,3,4
+    preparePartitionedTableData();
+
+    Table allManifestsTable = new AllManifestsTable(table);
+    TableScan scan =
+        allManifestsTable
+            .newScan()
+            .filter(
+                Expressions.not(
+                    Expressions.or(
+                        Expressions.equal("reference_snapshot_id", 1L),
+                        Expressions.equal("content", 
ManifestContent.DELETES.id()))));
+
+    /*
+     * NOT(reference_snapshot_id = firstSnapshotId OR content = DELETES)
+     *
+     * is rewritten as:
+     *
+     * reference_snapshot_id != firstSnapshotId

Review Comment:
   done



##########
core/src/test/java/org/apache/iceberg/TestMetadataTableScans.java:
##########
@@ -467,6 +467,125 @@ public void testAllManifestsTableHonorsIgnoreResiduals() 
throws IOException {
     validateTaskScanResiduals(scan2, true);
   }
 
+  @TestTemplate
+  public void testAllManifestsTableNegatedPredicateOnNonSnapshotColumn() 
throws IOException {

Review Comment:
   Yes, this exception was caused by the legacy helper method. It should have 
been removed together with the helper method, but it was overlooked. Fixed.



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