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


##########
core/src/test/java/org/apache/iceberg/TestSchemaParser.java:
##########
@@ -155,4 +157,119 @@ public void 
testPrimitiveTypeDefaultValues(Type.PrimitiveType type, Literal<?> d
     assertThat(serialized.findField("col_with_default").writeDefault())
         .isEqualTo(defaultValue.value());
   }
+
+  private static Stream<Arguments> nonFiniteDefaults() {
+    return Stream.of(
+        Arguments.of(Types.FloatType.get(), "NaN", Float.NaN, "Infinity", 
Float.POSITIVE_INFINITY),
+        Arguments.of(
+            Types.FloatType.get(),
+            "Infinity",
+            Float.POSITIVE_INFINITY,
+            "-Infinity",
+            Float.NEGATIVE_INFINITY),
+        Arguments.of(Types.FloatType.get(), "-Infinity", 
Float.NEGATIVE_INFINITY, "NaN", Float.NaN),
+        Arguments.of(
+            Types.DoubleType.get(), "NaN", Double.NaN, "Infinity", 
Double.POSITIVE_INFINITY),
+        Arguments.of(
+            Types.DoubleType.get(),
+            "Infinity",
+            Double.POSITIVE_INFINITY,
+            "-Infinity",
+            Double.NEGATIVE_INFINITY),
+        Arguments.of(
+            Types.DoubleType.get(), "-Infinity", Double.NEGATIVE_INFINITY, 
"NaN", Double.NaN));
+  }
+
+  @ParameterizedTest
+  @MethodSource("nonFiniteDefaults")
+  public void nonFiniteDefaultValues(
+      Type.PrimitiveType type,
+      String initialDefaultJson,
+      Object initialDefault,
+      String writeDefaultJson,
+      Object writeDefault) {
+    String json =
+        schemaJsonWithDefaults(

Review Comment:
   can we write the actual `Schema` object with those values and then convert 
from `Schema` to a JSON instead here?



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