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


##########
spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/actions/RewritePositionDeleteFilesSparkAction.java:
##########
@@ -404,8 +408,31 @@ private void validateAndInitOptions() {
         maxCommits,
         PARTIAL_PROGRESS_ENABLED);
 
-    Preconditions.checkArgument(
-        TableUtil.formatVersion(table) <= 2, "Cannot rewrite position deletes 
for V3 table");
+    if (TableUtil.formatVersion(table) >= 3) {
+      PositionDeletesBatchScan scan =
+          (PositionDeletesBatchScan)
+              MetadataTableUtils.createMetadataTableInstance(
+                      table, MetadataTableType.POSITION_DELETES)
+                  .newBatchScan();
+      Optional<PositionDeletesScanTask> foundPuffinFiles =
+          StreamSupport.stream(
+                  CloseableIterable.transform(
+                          scan.baseTableFilter(filter)
+                              .caseSensitive(caseSensitive)
+                              .select(PositionDeletesTable.DELETE_FILE_PATH)
+                              .ignoreResiduals()
+                              .planFiles(),
+                          task -> (PositionDeletesScanTask) task)
+                      .spliterator(),
+                  false)
+              .filter(t -> t.file().format() == FileFormat.PUFFIN)
+              .findAny();
+
+      if (foundPuffinFiles.isPresent()) {
+        throw new IllegalArgumentException(

Review Comment:
   I've updated this



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