AngersZhuuuu commented on issue #26208: [WIP][SPARK-29540][SQL]Support cast 
StringType to DateType follow ansi
URL: https://github.com/apache/spark/pull/26208#issuecomment-544917289
 
 
   cc @MaxGekk @maropu 
   
   Do you know any where I can add test case for this cast?
   
   And some different, if i pass a wrong date format, spark will cast it to 
`NULL`,  PostgresSQL will return error. 
   
   Spark:
   ```
   INSERT INTO empsalary VALUES ('develop', 10, 5200, '2007-0128-01');
   SELECT * FROM  empsalary;
   
   develop      10      5200    NULL
   Time taken: 0.164 seconds, Fetched 2 row(s)
   ```
   
   PostgresSQL:
   ```
   angerszhu=# INSERT INTO empsalary VALUES ('develop', 10, 5200, 
'2007-1208-01');
   ERROR:  date/time field value out of range: "2007-1208-01"
   LINE 1: ...NSERT INTO empsalary VALUES ('develop', 10, 5200, '2007-1208...
                                                                ^
   HINT:  Perhaps you need a different "datestyle" setting.
   angerszhu=# 
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to