twalthr commented on code in PR #29466:
URL: https://github.com/apache/flink/pull/29466#discussion_r4259436819


##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/CastFunctionITCase.java:
##########
@@ -1155,7 +1162,42 @@ private static List<TestSetSpec> variantRowCasts() {
                                         FIELD(
                                                 "user",
                                                 ROW(FIELD("id", INT()), 
FIELD("since", STRING()))),
-                                        FIELD("tags", ARRAY(STRING())))));
+                                        FIELD("tags", ARRAY(STRING())))),
+                // A ROW cast from VARIANT compares field by field, like a ROW 
built with ROW(...):
+                // NaN never equals NaN, and 0.0 equals -0.0. PARSE_JSON 
rejects NaN and
+                // infinities, so each VARIANT is built from a row of strings. 
Each pair spells its
+                // value differently, because the planner merges equal inputs 
and folds x = x to
+                // TRUE.
+                TestSetSpec.forExpression("Compare ROW values cast from 
VARIANT")
+                        .onFieldsWithData(
+                                Row.of("NaN"),
+                                Row.of("nan"),
+                                Row.of("0.0"),
+                                Row.of("-0.0"),
+                                Row.of("Infinity"),
+                                Row.of("inf"),
+                                Row.of("-Infinity"))
+                        .andDataTypes(
+                                stringRow, stringRow, stringRow, stringRow, 
stringRow, stringRow,
+                                stringRow)
+                        // NaN = NaN
+                        .testSqlResult(variantRowsEqual("f0", "f1"), false, 
BOOLEAN())

Review Comment:
   Is this consistent also for two regular fields containing NaN? Not just 
variant?



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

Reply via email to