zabetak commented on code in PR #4675:
URL: https://github.com/apache/hive/pull/4675#discussion_r1322802657


##########
ql/src/test/resources/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFDateFormatEvaluate.csv:
##########
@@ -0,0 +1,39 @@
+1970-01-01 00:00:00;yyyy-MM-dd HH:mm:ss;Etc/GMT;DATETIME;1970-01-01 00:00:00
+1970-01-01 00:00:00;yyyy-MM-dd HH:mm:ss;Etc/GMT;SIMPLE;1970-01-01 00:00:00
+1970-01-01 00:00:00;yyyy-MM-dd HH:mm:ss;Atlantic/Azores;DATETIME;1970-01-01 
00:00:00
+1970-01-01 00:00:00;yyyy-MM-dd HH:mm:ss;Atlantic/Azores;SIMPLE;1970-01-01 
00:00:00
+1970-01-01 00:00:00;yyyy-MM-dd HH:mm:ss z;Etc/GMT;DATETIME;1970-01-01 00:00:00 
GMT
+1970-01-01 00:00:00;yyyy-MM-dd HH:mm:ss z;Etc/GMT;SIMPLE;1970-01-01 00:00:00 
GMT
+1970-01-01 00:00:00;yyyy-MM-dd HH:mm:ss z;Atlantic/Azores;DATETIME;1970-01-01 
00:00:00 AZOT
+1970-01-01 00:00:00;yyyy-MM-dd HH:mm:ss z;Atlantic/Azores;SIMPLE;1970-01-01 
00:00:00 AZOT
+1970-01-01 00:00:00 GMT-01:00;yyyy-MM-dd HH:mm:ss 
z;Etc/GMT;DATETIME;1970-01-01 00:00:00 GMT
+1970-01-01 00:00:00 GMT-01:00;yyyy-MM-dd HH:mm:ss z;Etc/GMT;SIMPLE;1970-01-01 
00:00:00 GMT
+1800-01-01 00:00:00;yyyy-MM-dd HH:mm:ss;Etc/GMT;DATETIME;1800-01-01 00:00:00
+1800-01-01 00:00:00;yyyy-MM-dd HH:mm:ss;Etc/GMT;SIMPLE;1800-01-01 00:00:00
+1800-01-01 00:00:00;yyyy-MM-dd HH:mm:ss;Asia/Kolkata;DATETIME;1800-01-01 
00:00:00
+1800-01-01 00:00:00;yyyy-MM-dd HH:mm:ss;Asia/Kolkata;SIMPLE;1799-12-31 23:36:32
+Jul 9 2023;MMM dd yyyy;Etc/GMT;DATETIME;null
+Jul 9 2023;MMM dd yyyy;Etc/GMT;SIMPLE;null

Review Comment:
   This falls to "Invalid date inputs (Jul 9 2023) that cannot be parsed" case 
mentioned above. Note that the pattern parameter that is used in `date_format` 
only affects formatting and it does not have any effect in parsing. 
   
   In this case, the parsing is done using the default parsing logic for 
dates/timestamps. We have a string input that needs to be transformed to date 
(before it is formatted) so there is somekind of implicit cast resulting in 
`date_format(CAST('Jul 9 2023' AS DATE), 'MMM dd yyyy')`. The `CAST` expression 
returns null since the accepted patterns are very limited and not configurable.



-- 
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: gitbox-unsubscr...@hive.apache.org

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


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

Reply via email to