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 0c7734ef0 [AMORO-3620][Improvement]: Fix the error in the calculation 
of the health score of table (#3621)
0c7734ef0 is described below

commit 0c7734ef07e55b1b26d30719a631ed33a09c893f
Author: cxxiii <[email protected]>
AuthorDate: Tue Jun 17 19:22:23 2025 +0800

    [AMORO-3620][Improvement]: Fix the error in the calculation of the health 
score of table (#3621)
    
    * Change the url of quickstart
    
    * Change the url of quickstart
    
    * Add the log output function of the StandaloneOptimizer module
    
    * Fix formatting issues
    
    * Correct some configuration information and reduce unnecessary log output
    
    * Fix the issue where the health score calculation is incorrect when the 
table is empty.
    
    * Fix the issue where the health score calculation is incorrect when the 
table is empty.
    
    * Fix the issue where the health score calculation is incorrect when the 
table is empty.
    
    * revise the caculation of averageDataFileSize
    
    ---------
    
    Co-authored-by: ZhouJinsong <[email protected]>
---
 .../org/apache/amoro/optimizing/plan/AbstractOptimizingEvaluator.java | 2 +-
 .../org/apache/amoro/optimizing/plan/CommonPartitionEvaluator.java    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/amoro-format-iceberg/src/main/java/org/apache/amoro/optimizing/plan/AbstractOptimizingEvaluator.java
 
b/amoro-format-iceberg/src/main/java/org/apache/amoro/optimizing/plan/AbstractOptimizingEvaluator.java
index 6dfdf89ea..16ecd5c68 100644
--- 
a/amoro-format-iceberg/src/main/java/org/apache/amoro/optimizing/plan/AbstractOptimizingEvaluator.java
+++ 
b/amoro-format-iceberg/src/main/java/org/apache/amoro/optimizing/plan/AbstractOptimizingEvaluator.java
@@ -245,7 +245,7 @@ public abstract class AbstractOptimizingEvaluator {
 
     private int avgHealthScore(double totalHealthScore, int partitionCount) {
       if (partitionCount == 0) {
-        return 0;
+        return 100;
       }
       return (int) Math.ceil(totalHealthScore / partitionCount);
     }
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 fe7fc4271..1b064ce33 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
@@ -397,7 +397,7 @@ public class CommonPartitionEvaluator implements 
PartitionEvaluator {
     long dataFiles = getFragmentFileCount() + getSegmentFileCount();
     long dataRecords = getFragmentFileRecords() + getSegmentFileRecords();
 
-    double averageDataFileSize = getNormalizedRatio(dataFilesSize, dataFiles);
+    double averageDataFileSize = dataFilesSize / dataFiles;
     double eqDeleteRatio = getNormalizedRatio(equalityDeleteFileRecords, 
dataRecords);
     double posDeleteRatio = getNormalizedRatio(posDeleteFileRecords, 
dataRecords);
 
@@ -434,7 +434,7 @@ public class CommonPartitionEvaluator implements 
PartitionEvaluator {
     // The small table has very little impact on performance,
     // so there is only a small penalty
     return getNormalizedRatio(dataFiles, config.getMinorLeastFileCount())
-        * getNormalizedRatio(dataFilesSize, config.getTargetSize());
+        * getNormalizedRatio(dataFilesSize, minTargetSize);
   }
 
   private double getNormalizedRatio(double numerator, double denominator) {

Reply via email to