jacktengg commented on code in PR #22281:
URL: https://github.com/apache/doris/pull/22281#discussion_r1276369100


##########
regression-test/suites/query_p0/sql_functions/cast_function/test_cast_string_to_array.groovy:
##########
@@ -41,5 +41,14 @@ suite("test_cast_string_to_array") {
     qt_sql """ select cast ("[1,2,3,,,]" as array<int>) """
     qt_sql """ select cast ("[a,b,c,,,]" as array<string>) """
     qt_sql """ select cast ("[1.34,2.01,,,]" as array<decimal(10, 3)>) """
+
+    sql """ ADMIN SET FRONTEND CONFIG ("enable_date_conversion" = "false"); """
+    qt_sql """ select cast ("[2022-09-01,,]" as array<date>) """
+    qt_sql """ select cast ("[2022-09-01,,]" as array<string>) """
+    qt_sql """ select cast(cast ("[2022-09-01,,]" as array<string>) as 
array<date>) """
+
+    sql """ ADMIN SET FRONTEND CONFIG ("enable_date_conversion" = "true"); """
     qt_sql """ select cast ("[2022-09-01,,]" as array<date>) """

Review Comment:
   MySQL 8.0:
   ```
   select cast("" as date);
   cast("" as date)
   --
   null
   
   select cast("" as SIGNED);
   cast("" as SIGNED)
   --
   0
   
   ```
   
   PostgreSQL15:
   ```
   SELECT CAST ('2023-07-28' AS date);
   date
   --
   2023-07-28
   
   SELECT CAST ('' AS date);
   ERROR:  invalid input syntax for type date: ""
   LINE 1: SELECT CAST ('' AS date);
   
   SELECT CAST ('' AS INTEGER);
   ERROR:  invalid input syntax for type integer: ""
   LINE 1: SELECT CAST ('' AS INTEGER);
   
   ```
   
   Doris:
   ```
   mysql [(none)]>select cast('' as int);
   +-----------------+
   | cast('' as INT) |
   +-----------------+
   |            NULL |
   +-----------------+
   1 row in set (0.02 sec)
   
   mysql [(none)]>select cast('' as date);
   +--------------------+
   | cast('' as DATEV2) |
   +--------------------+
   | NULL               |
   +--------------------+
   1 row in set (0.02 sec)
   ```
   



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