openinx commented on a change in pull request #2865:
URL: https://github.com/apache/iceberg/pull/2865#discussion_r677076862



##########
File path: core/src/main/java/org/apache/iceberg/BaseRewriteFiles.java
##########
@@ -85,4 +90,18 @@ public RewriteFiles rewriteFiles(Set<DataFile> 
dataFilesToDelete, Set<DeleteFile
 
     return this;
   }
+
+  @Override
+  public RewriteFiles validateFromSnapshot(long snapshotId) {
+    this.startingSnapshotId = snapshotId;
+    return this;
+  }
+
+  @Override
+  protected void validate(TableMetadata base) {
+    if (replacedDataFiles.size() > 0) {
+      // if there are replaced data files, there cannot be any new row-level 
deletes for those data files
+      validateNoNewDeletesForDataFiles(base, startingSnapshotId, 
replacedDataFiles);

Review comment:
       In my thought,   the data conflicts between REPLACE operation and 
APPEND/OVERWRITE/DELETE operations is because of the dependency relationship 
from positional delete files to data files. Then there will be two cases:
   
   1.  The REPLACE operation remove the data files that was relied by other 
committed APPEND/OVERWRITE/DELTE  operations ( among the three operations,  
currently only the RowDelta will introduce new positional delete files which 
reference to committed data files).  I think we handle this case perfectly in 
this PR.
   2. The APPEND/OVERWRITE/DELETE operations remove the data files that was 
relied by other committed REPLACE operation.  The above 
[comment](https://github.com/apache/iceberg/pull/2865/files#r677072072) is an 
example. 
   
   As a final solution,  I think we should handle both the cases perfectly, so 
that we won't encounter any unexpected interruption when reading the iceberg 
table.




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