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


##########
core/src/main/java/org/apache/iceberg/actions/SizeBasedDataRewriter.java:
##########
@@ -60,13 +76,26 @@ public Set<String> validOptions() {
     return ImmutableSet.<String>builder()
         .addAll(super.validOptions())
         .add(DELETE_FILE_THRESHOLD)
+        .add(DELETE_RATIO_THRESHOLD)
         .build();
   }
 
   @Override
   public void init(Map<String, String> options) {
     super.init(options);
     this.deleteFileThreshold = deleteFileThreshold(options);
+    this.deleteRatioThreshold = getDeleteRatioThreshold(options);
+  }
+
+  private double getDeleteRatioThreshold(Map<String, String> options) {
+    double value =
+        PropertyUtil.propertyAsDouble(
+            options, DELETE_RATIO_THRESHOLD, DELETE_RATIO_THRESHOLD_DEFAULT);
+    Preconditions.checkArgument(
+        value >= 0, "'%s' is set to negative but must be >= 0", 
DELETE_RATIO_THRESHOLD);

Review Comment:
   ```suggestion
           value >= 0, "'%s' is set to %s but must be > 0", 
DELETE_RATIO_THRESHOLD, value);
   ```



##########
core/src/main/java/org/apache/iceberg/actions/SizeBasedDataRewriter.java:
##########
@@ -60,13 +76,26 @@ public Set<String> validOptions() {
     return ImmutableSet.<String>builder()
         .addAll(super.validOptions())
         .add(DELETE_FILE_THRESHOLD)
+        .add(DELETE_RATIO_THRESHOLD)
         .build();
   }
 
   @Override
   public void init(Map<String, String> options) {
     super.init(options);
     this.deleteFileThreshold = deleteFileThreshold(options);
+    this.deleteRatioThreshold = getDeleteRatioThreshold(options);
+  }
+
+  private double getDeleteRatioThreshold(Map<String, String> options) {
+    double value =
+        PropertyUtil.propertyAsDouble(
+            options, DELETE_RATIO_THRESHOLD, DELETE_RATIO_THRESHOLD_DEFAULT);
+    Preconditions.checkArgument(
+        value >= 0, "'%s' is set to negative but must be >= 0", 
DELETE_RATIO_THRESHOLD);
+    Preconditions.checkArgument(
+        value <= 1, "'%s' is greater than 1 but must be <= 1", 
DELETE_RATIO_THRESHOLD);

Review Comment:
   ```suggestion
           value <= 1, "'%s' is set to %s but must be <= 1", 
DELETE_RATIO_THRESHOLD, value);
   ```



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to