raminqaf commented on code in PR #29092:
URL: https://github.com/apache/flink/pull/29092#discussion_r3943661578
##########
flink-table/flink-table-common/src/test/java/org/apache/flink/table/types/LogicalTypeCastsTest.java:
##########
@@ -307,6 +308,23 @@ private static Stream<Arguments> testData() {
YearMonthIntervalType.YearMonthResolution.MONTH)),
false,
false),
+ // A variant object casts to ROW or STRUCTURED when every
field is castable; an
+ // empty
+ // row is vacuously castable and matching is by name
+ Arguments.of(new VariantType(), new RowType(List.of()), false,
true),
+ Arguments.of(
+ new VariantType(),
+ new RowType(
+ List.of(
+ new RowField("f0", new IntType()),
+ new RowField("f1",
VarCharType.STRING_TYPE))),
+ false,
+ true),
+ Arguments.of(
+ new VariantType(),
+ new RowType(List.of(new RowField("f0", new
TimeType()))),
+ false,
+ false),
Review Comment:
Good catch replaced with INTEVAL
##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/functions/casting/AbstractVariantToConstructedCastRule.java:
##########
@@ -30,9 +30,9 @@
* a shape check at each level, so the recursion bottoms out at the same
scalar cast the primitive
* and string rules perform and no new leaf semantics are introduced.
*
- * <p>A constructed cast can always fail, on a shape mismatch, an unreadable
leaf, or a missing
- * {@code NOT NULL} field, so {@code TRY_CAST} wraps the whole value and
returns {@code NULL} for
- * any failure rather than a partial result.
+ * <p>A constructed cast can always fail, on a shape mismatch, an unreadable
leaf, a missing field,
+ * or a JSON {@code null} in a {@code NOT NULL} position, so {@code TRY_CAST}
wraps the whole value
Review Comment:
Changed all JSON to 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]