raminqaf commented on code in PR #29311:
URL: https://github.com/apache/flink/pull/29311#discussion_r4152612216


##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/logical/utils/LogicalTypeCasts.java:
##########
@@ -403,6 +403,33 @@ public final class LogicalTypeCasts {
                 .explicitFromFamily(EXACT_NUMERIC, CHARACTER_STRING)
                 .build();
 
+        // 
-----------------------------------------------------------------------------------------
+        // VARIANT type
+        // 
-----------------------------------------------------------------------------------------
+
+        // Only a type with a VARIANT kind that holds its value without loss 
casts to VARIANT.
+        castTo(VARIANT)

Review Comment:
   Intended, and I kept it. It's the usual element-wise behavior of constructed 
casts, the same as `ARRAY<INT>` to `ARRAY<BIGINT>`. It works at any depth, for 
example `ARRAY<ROW<..>>` or `MAP<STRING, ARRAY<..>>`, and a NULL element stays 
a SQL NULL. I added tests in `LogicalTypeCastsTest`, `CastRuleProviderTest`, 
`CastRulesTest`, and `CastFunctionITCase`, and a docs bullet. Casting a whole 
ARRAY, MAP, or ROW into one VARIANT is still rejected at validation and stays 
in FLINK-40826.



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