This is an automated email from the ASF dual-hosted git repository.
jinsongzhou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/amoro.git
The following commit(s) were added to refs/heads/master by this push:
new 0cc052995 [AMORO-3391] Fix minor optimizing repeated issue (#3392)
0cc052995 is described below
commit 0cc0529955ac034b1392723e8547642915fd7a96
Author: ZhouJinsong <[email protected]>
AuthorDate: Mon Jan 6 10:11:58 2025 +0800
[AMORO-3391] Fix minor optimizing repeated issue (#3392)
* Fix minor optimizing repeated issue
* Fix segmentShouldRewritePos issue
---
.../optimizing/plan/CommonPartitionEvaluator.java | 25 ++++++++++++++++------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git
a/amoro-format-iceberg/src/main/java/org/apache/amoro/optimizing/plan/CommonPartitionEvaluator.java
b/amoro-format-iceberg/src/main/java/org/apache/amoro/optimizing/plan/CommonPartitionEvaluator.java
index a69704978..fe7fc4271 100644
---
a/amoro-format-iceberg/src/main/java/org/apache/amoro/optimizing/plan/CommonPartitionEvaluator.java
+++
b/amoro-format-iceberg/src/main/java/org/apache/amoro/optimizing/plan/CommonPartitionEvaluator.java
@@ -235,16 +235,27 @@ public class CommonPartitionEvaluator implements
PartitionEvaluator {
public boolean segmentShouldRewritePos(DataFile dataFile,
List<ContentFile<?>> deletes) {
Preconditions.checkArgument(!isFragmentFile(dataFile), "Unsupported
fragment file.");
- long posDeleteFileCount =
- deletes.stream().filter(delete -> delete.content() ==
FileContent.POSITION_DELETES).count();
- if (posDeleteFileCount == 1) {
- return !TableFileUtil.isOptimizingPosDeleteFile(
- dataFile.path().toString(), deletes.get(0).path().toString());
- } else if (posDeleteFileCount > 1) {
+ long equalDeleteFileCount = 0;
+ long posDeleteFileCount = 0;
+
+ for (ContentFile<?> delete : deletes) {
+ if (delete.content() == FileContent.EQUALITY_DELETES) {
+ equalDeleteFileCount++;
+ } else if (delete.content() == FileContent.POSITION_DELETES) {
+ posDeleteFileCount++;
+ }
+ }
+ if (posDeleteFileCount > 1) {
combinePosSegmentFileCount++;
return true;
+ } else if (equalDeleteFileCount > 0) {
+ return true;
+ } else if (posDeleteFileCount == 1) {
+ return !TableFileUtil.isOptimizingPosDeleteFile(
+ dataFile.path().toString(), deletes.get(0).path().toString());
+ } else {
+ return false;
}
- return deletes.stream().anyMatch(delete -> delete.content() ==
FileContent.EQUALITY_DELETES);
}
protected boolean isFullOptimizing() {