mihaibudiu commented on code in PR #3947:
URL: https://github.com/apache/calcite/pull/3947#discussion_r1870052170
##########
core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java:
##########
@@ -1347,6 +1347,45 @@ void testLikeAndSimilarFails() {
.columnType("TIMESTAMP_TZ(3) NOT NULL");
}
+ @Test void testCastVariant() {
+ expr("cast(NULL as variant)")
+ .columnType("VARIANT");
+ expr("cast(1 as variant)")
+ .columnType("VARIANT NOT NULL");
+ expr("cast('abc' as variant)")
+ .columnType("VARIANT NOT NULL");
+ expr("cast(TIMESTAMP '2024-09-01 00:00:00' as variant)")
+ .columnType("VARIANT NOT NULL");
+ expr("cast(ARRAY[1,2,3] AS VARIANT)")
Review Comment:
I plan to rework a bit this PR to bring it more in line with what Snowflake
does.
In this case converting an ARRAY to a variant produces a VARIANT whose value
is an array of variant. So the elements are all recursively converted to
VARIANT. Same thing is true for MAP.
--
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]