zclllyybb commented on code in PR #47319:
URL: https://github.com/apache/doris/pull/47319#discussion_r1930060569


##########
regression-test/suites/nereids_p0/datatype/test_cast.groovy:
##########
@@ -96,6 +96,124 @@ suite("test_cast") {
         sql "select cast(true as date);"
         result([[null]])
     }
+
+    explain {
+        sql("select cast('12:00:00' as time);")
+        notContains "cast("
+    }
+
+    testFoldConst("select cast(cast('16:32:04' as time) as string);")
+
+    check_fold_consistency "cast(cast('11:11:11' as time) as bigint);"
+    check_fold_consistency "cast(cast('11:11:11' as time) as char);"
+    check_fold_consistency "cast(cast('11:11:11' as time) as double);"
+    check_fold_consistency "cast(cast('11:11:11' as time) as float);"
+    check_fold_consistency "cast(cast('11:11:11' as time) as int);"
+    check_fold_consistency "cast(cast('11:11:11' as time) as integer);"
+    check_fold_consistency "cast(cast('11:11:11' as time) as json);"
+    check_fold_consistency "cast(cast('11:11:11' as time) as jsonb);"
+    check_fold_consistency "cast(cast('11:11:11' as time) as largeint);"
+    check_fold_consistency "cast(cast('11:11:11' as time) as smallint);"
+    check_fold_consistency "cast(cast('11:11:11' as time) as string);"
+    check_fold_consistency "cast(cast('11:11:11' as time) as text);"
+    check_fold_consistency "cast(cast('11:11:11' as time) as tinyint);"
+    check_fold_consistency "cast(cast('11:11:11' as time) as varchar);"
+    check_fold_consistency "cast(cast('11:11:11' as time) as variant);"
+
+    test {
+        sql "select cast(cast('11:11:11' as time) as bitmap);"
+        exception "cannot cast"
+    }
+    test {
+        sql "select cast(cast('11:11:11' as time) as decimal);"
+        exception "cannot cast"
+    }
+    test {
+        sql "select cast(cast('11:11:11' as time) as decimalv2);"
+        exception "cannot cast"
+    }
+    test {
+        sql "select cast(cast('11:11:11' as time) as decimalv3);"
+        exception "cannot cast"
+    }
+    test {
+        sql "select cast(cast('11:11:11' as time) as hll);"
+        exception "cannot cast"
+    }
+    test {
+        sql "select cast(cast('11:11:11' as time) as quantile_state);"
+        exception "cannot cast"
+    }
+    test {
+        sql "select cast(cast('11:11:11' as time) as datetime);"
+        exception "cannot cast"
+    }
+    test {
+        sql "select cast(cast('11:11:11' as time) as date);"
+        exception "cannot cast"
+    }
+    test {
+        sql "select cast(cast('11:11:11' as time) as quantile_state);"
+        exception "cannot cast"
+    }
+
+    qt_sql "select cast(11111111 as time);"
+    qt_sql "select cast(1111111 as time);"
+    qt_sql "select cast('839:00:00' as time);"
+    qt_sql "select cast('8385959' as time);"
+    qt_sql "select cast(cast('838:59:59' as variant) as time);"

Review Comment:
   also add some value out of bound



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to