fivetran-ahmadalhour commented on code in PR #19143:
URL: https://github.com/apache/iceberg/pull/19143#discussion_r4741786139


##########
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:
   Done. I kept literal JSON only for the invalid-input, single-attribute and 
string-field tests, since those cover inputs the writer doesn't produce. 
Reading metadata written before this fix is still covered separately by the 
fixture test in `TestTableMetadata`, which uses metadata produced by unpatched 
main.
   
   Let me know what you think! 🙏 



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