nastra commented on code in PR #14859:
URL: https://github.com/apache/iceberg/pull/14859#discussion_r2626449143
##########
spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/actions/RewriteTablePathSparkAction.java:
##########
@@ -662,18 +663,27 @@ private void rewritePositionDeletes(Set<DeleteFile>
toRewrite) {
return;
}
+ Set<DeleteFile> uniqueDeleteFiles =
deduplicateDeleteFilesByLocation(toRewrite);
Encoder<DeleteFile> deleteFileEncoder =
Encoders.javaSerialization(DeleteFile.class);
Dataset<DeleteFile> deleteFileDs =
- spark().createDataset(Lists.newArrayList(toRewrite),
deleteFileEncoder);
+ spark().createDataset(Lists.newArrayList(uniqueDeleteFiles),
deleteFileEncoder);
PositionDeleteReaderWriter posDeleteReaderWriter = new
SparkPositionDeleteReaderWriter();
deleteFileDs
- .repartition(toRewrite.size())
+ .repartition(uniqueDeleteFiles.size())
.foreach(
rewritePositionDelete(
tableBroadcast(), sourcePrefix, targetPrefix, stagingDir,
posDeleteReaderWriter));
}
+ @VisibleForTesting
+ Set<DeleteFile> deduplicateDeleteFilesByLocation(Set<DeleteFile>
deleteFiles) {
Review Comment:
this isn't really needed and also wouldn't work for V3 delete files. We have
`DeleteFileSet` that can properly deduplicate
--
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]