szehon-ho commented on code in PR #11437:
URL: https://github.com/apache/iceberg/pull/11437#discussion_r1826110743


##########
core/src/main/java/org/apache/iceberg/util/PropertyUtil.java:
##########
@@ -100,6 +123,28 @@ public static String propertyAsString(
     return defaultValue;
   }
 
+  /**
+   * Validate the table commit related properties to have non-negative integer 
on table creation to
+   * prevent commit failure
+   */
+  public static void validateCommitProperties(Map<String, String> properties) {
+    for (String commitProperty : COMMIT_PROPERTIES) {
+      if (properties.containsKey(commitProperty)) {

Review Comment:
   how about doing it the way you do in the above method?  I think slightly 
less calls to properties?
   
   int value = properties.get()
   if (value != null) {
     int parsedValue;
     ...
   }



##########
core/src/main/java/org/apache/iceberg/util/PropertyUtil.java:
##########
@@ -57,6 +67,19 @@ public static double propertyAsDouble(
     return defaultValue;
   }
 
+  public static int propertyTryAsInt(
+      Map<String, String> properties, String property, int defaultValue) {
+    String value = properties.get(property);
+    if (value != null) {
+      try {
+        return Integer.parseInt(value);
+      } catch (NumberFormatException e) {
+        return defaultValue;

Review Comment:
   Nit: can we remove this line and fall to the same return later?



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