raminqaf commented on code in PR #29073:
URL: https://github.com/apache/flink/pull/29073#discussion_r3924850425
##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/logical/utils/LogicalTypeCasts.java:
##########
@@ -666,6 +668,12 @@ private static boolean supportsCasting(
return supportsStructuredCasting(
sourceType, targetType, (s, t) -> supportsCasting(s, t,
allowExplicit));
+ } else if (sourceRoot == VARIANT && targetRoot == ARRAY) {
+ // A variant array casts to ARRAY<T> when VARIANT casts to the
single element type T.
+ // Explicit only, so no accidental coercion. Each runtime element
is cast to T by the
+ // array cast rule; a per-element mismatch fails there, not here.
+ return allowExplicit
+ && supportsCasting(sourceType, ((ArrayType)
targetType).getElementType(), true);
Review Comment:
We should keep the `allowExplicit` so the user must write `CAST(v AS
ARRAY<...>)` the cast to an ARRAY from a variant is explicit.
--
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]