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


##########
core/src/main/java/org/apache/iceberg/SingleValueParser.java:
##########
@@ -72,18 +72,24 @@ public static Object fromJson(Type type, JsonNode 
defaultValue) {
         return defaultValue.longValue();
       case FLOAT:
         Preconditions.checkArgument(
-            defaultValue.isFloatingPointNumber(),
-            "Cannot parse default as a %s value: %s",
+            defaultValue.isNumber(), "Cannot parse default as a %s value: %s", 
type, defaultValue);
+        float floatValue = defaultValue.floatValue();
+        Preconditions.checkArgument(
+            Float.isFinite(floatValue),
+            "Cannot parse default as a %s value: %s, the value is out of 
range",
             type,
             defaultValue);
-        return defaultValue.floatValue();
+        return floatValue;
       case DOUBLE:
         Preconditions.checkArgument(
-            defaultValue.isFloatingPointNumber(),
-            "Cannot parse default as a %s value: %s",
+            defaultValue.isNumber(), "Cannot parse default as a %s value: %s", 
type, defaultValue);
+        double doubleValue = defaultValue.doubleValue();
+        Preconditions.checkArgument(
+            Double.isFinite(doubleValue),
+            "Cannot parse default as a %s value: %s, the value is out of 
range",

Review Comment:
   ```suggestion
               "Cannot parse default as a %s value: %s is out of range",
   ```



##########
core/src/main/java/org/apache/iceberg/SingleValueParser.java:
##########
@@ -72,18 +72,24 @@ public static Object fromJson(Type type, JsonNode 
defaultValue) {
         return defaultValue.longValue();
       case FLOAT:
         Preconditions.checkArgument(
-            defaultValue.isFloatingPointNumber(),
-            "Cannot parse default as a %s value: %s",
+            defaultValue.isNumber(), "Cannot parse default as a %s value: %s", 
type, defaultValue);
+        float floatValue = defaultValue.floatValue();
+        Preconditions.checkArgument(
+            Float.isFinite(floatValue),
+            "Cannot parse default as a %s value: %s, the value is out of 
range",

Review Comment:
   ```suggestion
               "Cannot parse default as a %s value: %s is out of range",
   ```



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

Reply via email to