simhadri-g commented on code in PR #4777:
URL: https://github.com/apache/hive/pull/4777#discussion_r1355216984


##########
ql/src/test/resources/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFToUnixTimestampEvaluateStringString.csv:
##########
@@ -1,54 +1,128 @@
-1970-01-01 00:00:00;yyyy-MM-dd HH:mm:ss;Etc/GMT;DATETIME;0
-1970-01-01 00:00:00;yyyy-MM-dd HH:mm:ss;Etc/GMT;SIMPLE;0
-1970-01-01 00:00:00;yyyy-MM-dd HH:mm:ss;Atlantic/Azores;DATETIME;3600
-1970-01-01 00:00:00;yyyy-MM-dd HH:mm:ss;Atlantic/Azores;SIMPLE;3600
-1970-01-01 00:00:00;yyyy-MM-dd HH:mm:ss;Europe/Paris;DATETIME;-3600
-1970-01-01 00:00:00;yyyy-MM-dd HH:mm:ss;Europe/Paris;SIMPLE;-3600
-1970-01-01 00:00:00 GMT;yyyy-MM-dd HH:mm:ss z;Etc/GMT;DATETIME;0
-1970-01-01 00:00:00 GMT;yyyy-MM-dd HH:mm:ss z;Etc/GMT;SIMPLE;0
-1970-01-01 00:00:00 GMT-01:00;yyyy-MM-dd HH:mm:ss z;Etc/GMT;DATETIME;3600
-1970-01-01 00:00:00 GMT-01:00;yyyy-MM-dd HH:mm:ss z;Etc/GMT;SIMPLE;3600
-1970-01-01 00:00:00 GMT+01:00;yyyy-MM-dd HH:mm:ss z;Etc/GMT;DATETIME;-3600
-1970-01-01 00:00:00 GMT+01:00;yyyy-MM-dd HH:mm:ss z;Etc/GMT;SIMPLE;-3600
-1970-01-01 00:00:00 GMT-01:00;yyyy-MM-dd HH:mm:ss z;Europe/Paris;DATETIME;3600
-1970-01-01 00:00:00 GMT-01:00;yyyy-MM-dd HH:mm:ss z;Europe/Paris;SIMPLE;3600
-1800-01-01 00:00:00;yyyy-MM-dd HH:mm:ss;Etc/GMT;DATETIME;-5364662400
-1800-01-01 00:00:00;yyyy-MM-dd HH:mm:ss;Etc/GMT;SIMPLE;-5364662400
-1800-01-01 00:00:00;yyyy-MM-dd HH:mm:ss;Asia/Kolkata;DATETIME;-5364683608
-1800-01-01 00:00:00;yyyy-MM-dd HH:mm:ss;Asia/Kolkata;SIMPLE;-5364682200
-Jul 9 2023;MMM dd yyyy;Etc/GMT;DATETIME;null
-Jul 9 2023;MMM dd yyyy;Etc/GMT;SIMPLE;1688860800
-Jul 09 2023;MMM dd yyyy;Etc/GMT;DATETIME;1688860800
-Jul 09 2023;MMM dd yyyy;Etc/GMT;SIMPLE;1688860800
-Jul 21 2023;MMM dd yyyy;Etc/GMT;DATETIME;1689897600
-Jul 21 2023;MMM dd yyyy;Etc/GMT;SIMPLE;1689897600
-2023-07-21;YYYY-MM-DD;Etc/GMT;DATETIME;null
-2023-07-21;YYYY-MM-DD;Etc/GMT;SIMPLE;1672531200
-Jul 21 2023 09:13;MMM dd yyyy HH:mm;Etc/GMT;DATETIME;1689930780
-Jul 21 2023 09:13;MMM dd yyyy HH:mm;Etc/GMT;SIMPLE;1689930780
-Jul 21 2023 9:13;MMM dd yyyy HH:mm;Etc/GMT;DATETIME;null
-Jul 21 2023 9:13;MMM dd yyyy HH:mm;Etc/GMT;SIMPLE;1689930780
-2023-07-21 09:13;yyyy-MM-dd HH:mm;Etc/GMT;DATETIME;1689930780
-2023-07-21 09:13;yyyy-MM-dd HH:mm;Etc/GMT;SIMPLE;1689930780
-2023-07-21 9:13;yyyy-MM-dd HH:mm;Etc/GMT;DATETIME;null
-2023-07-21 9:13;yyyy-MM-dd HH:mm;Etc/GMT;SIMPLE;1689930780
-2023-07-21 9:13PM;yyyy-MM-dd h:mma;Etc/GMT;DATETIME;1689973980
-2023-07-21 9:13PM;yyyy-MM-dd h:mma;Etc/GMT;SIMPLE;1689973980
-2023-07-21 09:13AM;yyyy-MM-dd HH:mmAA;Etc/GMT;DATETIME;null
-2023-07-21 09:13AM;yyyy-MM-dd HH:mmAA;Etc/GMT;SIMPLE;null
-2023-07-21 09:13AM;yyyy-MM-dd HH:mmaa;Etc/GMT;DATETIME;null
-2023-07-21 09:13AM;yyyy-MM-dd HH:mmaa;Etc/GMT;SIMPLE;1689930780
-2023-07-21 09:13AM;yyyy-MM-dd HH:mma;Etc/GMT;DATETIME;1689930780
-2023-07-21 09:13AM;yyyy-MM-dd HH:mma;Etc/GMT;SIMPLE;1689930780
-2023-07-21 09:13PM;yyyy-MM-dd HH:mma;Etc/GMT;DATETIME;null
-2023-07-21 09:13PM;yyyy-MM-dd HH:mma;Etc/GMT;SIMPLE;1689930780
-2023-07-21 09:13PM;yyyy-MM-dd hh:mmaa;Etc/GMT;DATETIME;null
-2023-07-21 09:13PM;yyyy-MM-dd hh:mmaa;Etc/GMT;SIMPLE;1689973980
-2023-07-21 09:13PM;yyyy-MM-dd hh:mma;Etc/GMT;DATETIME;1689973980
-2023-07-21 09:13PM;yyyy-MM-dd hh:mma;Etc/GMT;SIMPLE;1689973980
-2023-07-21 09:13:10;yyyy-MM-dd HH:mm:ss;Etc/GMT;DATETIME;1689930790
-2023-07-21 09:13:10;yyyy-MM-dd HH:mm:ss;Etc/GMT;SIMPLE;1689930790
-2023-07-21 09:13:10.123;yyyy-MM-dd HH:mm:ss.sss;Etc/GMT;DATETIME;null
-2023-07-21 09:13:10.123;yyyy-MM-dd HH:mm:ss.sss;Etc/GMT;SIMPLE;1689930903
-2023-07-21 09:13:10.123;yyyy-MM-dd HH:mm:ss.SSS;Etc/GMT;DATETIME;1689930790
-2023-07-21 09:13:10.123;yyyy-MM-dd HH:mm:ss.SSS;Etc/GMT;DATETIME;1689930790
+1970-01-01 00:00:00;yyyy-MM-dd HH:mm:ss;Etc/GMT;SIMPLE;SMART;0
+1970-01-01 00:00:00;yyyy-MM-dd HH:mm:ss;Etc/GMT;DATETIME;SMART;0
+1970-01-01 00:00:00;yyyy-MM-dd HH:mm:ss;Etc/GMT;DATETIME;STRICT;null
+1970-01-01 00:00:00;uuuu-MM-dd HH:mm:ss;Etc/GMT;DATETIME;STRICT;0
+1970-01-01 00:00:00;yyyy-MM-dd HH:mm:ss;Atlantic/Azores;SIMPLE;SMART;3600
+1970-01-01 00:00:00;yyyy-MM-dd HH:mm:ss;Atlantic/Azores;DATETIME;SMART;3600
+1970-01-01 00:00:00;yyyy-MM-dd HH:mm:ss;Atlantic/Azores;DATETIME;STRICT;null
+1970-01-01 00:00:00;uuuu-MM-dd HH:mm:ss;Atlantic/Azores;DATETIME;STRICT;3600
+1970-01-01 00:00:00;yyyy-MM-dd HH:mm:ss;Europe/Paris;SIMPLE;SMART;-3600
+1970-01-01 00:00:00;yyyy-MM-dd HH:mm:ss;Europe/Paris;DATETIME;SMART;-3600
+1970-01-01 00:00:00;yyyy-MM-dd HH:mm:ss;Europe/Paris;DATETIME;STRICT;null
+1970-01-01 00:00:00;uuuu-MM-dd HH:mm:ss;Europe/Paris;DATETIME;STRICT;-3600
+1970-01-01 00:00:00 GMT;yyyy-MM-dd HH:mm:ss z;Etc/GMT;SIMPLE;SMART;0
+1970-01-01 00:00:00 GMT;yyyy-MM-dd HH:mm:ss z;Etc/GMT;DATETIME;SMART;0
+1970-01-01 00:00:00 GMT;yyyy-MM-dd HH:mm:ss z;Etc/GMT;DATETIME;STRICT;null
+1970-01-01 00:00:00 GMT;uuuu-MM-dd HH:mm:ss z;Etc/GMT;DATETIME;STRICT;0
+1970-01-01 00:00:00 GMT-01:00;yyyy-MM-dd HH:mm:ss z;Etc/GMT;SIMPLE;SMART;3600
+1970-01-01 00:00:00 GMT-01:00;yyyy-MM-dd HH:mm:ss z;Etc/GMT;DATETIME;SMART;3600
+1970-01-01 00:00:00 GMT-01:00;yyyy-MM-dd HH:mm:ss 
z;Etc/GMT;DATETIME;STRICT;null
+1970-01-01 00:00:00 GMT-01:00;uuuu-MM-dd HH:mm:ss 
z;Etc/GMT;DATETIME;STRICT;3600
+1970-01-01 00:00:00 GMT+01:00;yyyy-MM-dd HH:mm:ss z;Etc/GMT;SIMPLE;SMART;-3600
+1970-01-01 00:00:00 GMT+01:00;yyyy-MM-dd HH:mm:ss 
z;Etc/GMT;DATETIME;SMART;-3600
+1970-01-01 00:00:00 GMT+01:00;yyyy-MM-dd HH:mm:ss 
z;Etc/GMT;DATETIME;STRICT;null
+1970-01-01 00:00:00 GMT+01:00;uuuu-MM-dd HH:mm:ss 
z;Etc/GMT;DATETIME;STRICT;-3600
+1970-01-01 00:00:00 GMT-01:00;yyyy-MM-dd HH:mm:ss 
z;Europe/Paris;SIMPLE;SMART;3600
+1970-01-01 00:00:00 GMT-01:00;yyyy-MM-dd HH:mm:ss 
z;Europe/Paris;DATETIME;SMART;3600
+1970-01-01 00:00:00 GMT-01:00;yyyy-MM-dd HH:mm:ss 
z;Europe/Paris;DATETIME;STRICT;null
+1970-01-01 00:00:00 GMT-01:00;uuuu-MM-dd HH:mm:ss 
z;Europe/Paris;DATETIME;STRICT;3600
+1800-01-01 00:00:00;yyyy-MM-dd HH:mm:ss;Etc/GMT;SIMPLE;SMART;-5364662400
+1800-01-01 00:00:00;yyyy-MM-dd HH:mm:ss;Etc/GMT;DATETIME;SMART;-5364662400
+1800-01-01 00:00:00;yyyy-MM-dd HH:mm:ss;Etc/GMT;DATETIME;STRICT;null
+1800-01-01 00:00:00;uuuu-MM-dd HH:mm:ss;Etc/GMT;DATETIME;STRICT;-5364662400
+1800-01-01 00:00:00;yyyy-MM-dd HH:mm:ss;Asia/Kolkata;SIMPLE;SMART;-5364682200
+1800-01-01 00:00:00;yyyy-MM-dd HH:mm:ss;Asia/Kolkata;DATETIME;SMART;-5364683608
+1800-01-01 00:00:00;yyyy-MM-dd HH:mm:ss;Asia/Kolkata;DATETIME;STRICT;null
+1800-01-01 00:00:00;uuuu-MM-dd 
HH:mm:ss;Asia/Kolkata;DATETIME;STRICT;-5364683608
+Jul 9 2023;MMM dd yyyy;Etc/GMT;SIMPLE;SMART;1688860800
+Jul 9 2023;MMM dd yyyy;Etc/GMT;DATETIME;SMART;null
+Jul 9 2023;MMM dd yyyy;Etc/GMT;DATETIME;STRICT;null
+Jul 9 2023;MMM dd uuuu;Etc/GMT;DATETIME;STRICT;null
+Jul 09 2023;MMM dd yyyy;Etc/GMT;SIMPLE;SMART;1688860800
+Jul 09 2023;MMM dd yyyy;Etc/GMT;DATETIME;SMART;1688860800
+Jul 09 2023;MMM dd yyyy;Etc/GMT;DATETIME;STRICT;null
+Jul 09 2023;MMM dd uuuu;Etc/GMT;DATETIME;STRICT;1688860800
+Jul 21 2023;MMM dd yyyy;Etc/GMT;SIMPLE;SMART;1689897600
+Jul 21 2023;MMM dd yyyy;Etc/GMT;DATETIME;SMART;1689897600
+Jul 21 2023;MMM dd yyyy;Etc/GMT;DATETIME;STRICT;null
+Jul 21 2023;MMM dd uuuu;Etc/GMT;DATETIME;STRICT;1689897600
+2023-07-21;YYYY-MM-DD;Etc/GMT;SIMPLE;SMART;1672531200
+2023-07-21;YYYY-MM-DD;Etc/GMT;DATETIME;SMART;null
+2023-07-21;YYYY-MM-DD;Etc/GMT;DATETIME;STRICT;null
+2023-07-21;UUUU-MM-DD;Etc/GMT;DATETIME;STRICT;null
+Jul 21 2023 09:13;MMM dd yyyy HH:mm;Etc/GMT;SIMPLE;SMART;1689930780
+Jul 21 2023 09:13;MMM dd yyyy HH:mm;Etc/GMT;DATETIME;SMART;1689930780
+Jul 21 2023 09:13;MMM dd yyyy HH:mm;Etc/GMT;DATETIME;STRICT;null
+Jul 21 2023 09:13;MMM dd uuuu HH:mm;Etc/GMT;DATETIME;STRICT;1689930780
+Jul 21 2023 9:13;MMM dd yyyy HH:mm;Etc/GMT;SIMPLE;SMART;1689930780
+Jul 21 2023 9:13;MMM dd yyyy HH:mm;Etc/GMT;DATETIME;SMART;null
+Jul 21 2023 9:13;MMM dd yyyy HH:mm;Etc/GMT;DATETIME;STRICT;null
+Jul 21 2023 9:13;MMM dd uuuu HH:mm;Etc/GMT;DATETIME;STRICT;null
+2023-07-21 09:13;yyyy-MM-dd HH:mm;Etc/GMT;SIMPLE;SMART;1689930780
+2023-07-21 09:13;yyyy-MM-dd HH:mm;Etc/GMT;DATETIME;SMART;1689930780
+2023-07-21 09:13;yyyy-MM-dd HH:mm;Etc/GMT;DATETIME;STRICT;null
+2023-07-21 09:13;uuuu-MM-dd HH:mm;Etc/GMT;DATETIME;STRICT;1689930780
+2023-07-21 9:13;yyyy-MM-dd HH:mm;Etc/GMT;SIMPLE;SMART;1689930780
+2023-07-21 9:13;yyyy-MM-dd HH:mm;Etc/GMT;DATETIME;SMART;null
+2023-07-21 9:13;yyyy-MM-dd HH:mm;Etc/GMT;DATETIME;STRICT;null
+2023-07-21 9:13;uuuu-MM-dd HH:mm;Etc/GMT;DATETIME;STRICT;null
+2023-07-21 9:13PM;yyyy-MM-dd h:mma;Etc/GMT;SIMPLE;SMART;1689973980
+2023-07-21 9:13PM;yyyy-MM-dd h:mma;Etc/GMT;DATETIME;SMART;1689973980
+2023-07-21 9:13PM;yyyy-MM-dd h:mma;Etc/GMT;DATETIME;STRICT;null
+2023-07-21 9:13PM;uuuu-MM-dd h:mma;Etc/GMT;DATETIME;STRICT;1689973980
+2023-07-21 09:13AM;yyyy-MM-dd HH:mmAA;Etc/GMT;SIMPLE;SMART;null
+2023-07-21 09:13AM;yyyy-MM-dd HH:mmAA;Etc/GMT;DATETIME;SMART;null
+2023-07-21 09:13AM;yyyy-MM-dd HH:mmAA;Etc/GMT;DATETIME;STRICT;null
+2023-07-21 09:13AM;uuuu-MM-dd HH:mmAA;Etc/GMT;DATETIME;STRICT;null
+2023-07-21 09:13AM;yyyy-MM-dd HH:mmaa;Etc/GMT;SIMPLE;SMART;1689930780
+2023-07-21 09:13AM;yyyy-MM-dd HH:mmaa;Etc/GMT;DATETIME;SMART;null
+2023-07-21 09:13AM;yyyy-MM-dd HH:mmaa;Etc/GMT;DATETIME;STRICT;null
+2023-07-21 09:13AM;uuuu-MM-dd HH:mmaa;Etc/GMT;DATETIME;STRICT;null
+2023-07-21 09:13AM;yyyy-MM-dd HH:mma;Etc/GMT;SIMPLE;SMART;1689930780
+2023-07-21 09:13AM;yyyy-MM-dd HH:mma;Etc/GMT;DATETIME;SMART;1689930780
+2023-07-21 09:13AM;yyyy-MM-dd HH:mma;Etc/GMT;DATETIME;STRICT;null
+2023-07-21 09:13AM;uuuu-MM-dd HH:mma;Etc/GMT;DATETIME;STRICT;1689930780
+2023-07-21 09:13PM;yyyy-MM-dd HH:mma;Etc/GMT;SIMPLE;SMART;1689930780
+2023-07-21 09:13PM;yyyy-MM-dd HH:mma;Etc/GMT;DATETIME;SMART;null
+2023-07-21 09:13PM;yyyy-MM-dd HH:mma;Etc/GMT;DATETIME;STRICT;null
+2023-07-21 09:13PM;uuuu-MM-dd HH:mma;Etc/GMT;DATETIME;STRICT;null
+2023-07-21 09:13PM;yyyy-MM-dd hh:mmaa;Etc/GMT;SIMPLE;SMART;1689973980
+2023-07-21 09:13PM;yyyy-MM-dd hh:mmaa;Etc/GMT;DATETIME;SMART;null
+2023-07-21 09:13PM;yyyy-MM-dd hh:mmaa;Etc/GMT;DATETIME;STRICT;null
+2023-07-21 09:13PM;uuuu-MM-dd hh:mmaa;Etc/GMT;DATETIME;STRICT;null
+2023-07-21 09:13PM;yyyy-MM-dd hh:mma;Etc/GMT;SIMPLE;SMART;1689973980
+2023-07-21 09:13PM;yyyy-MM-dd hh:mma;Etc/GMT;DATETIME;SMART;1689973980
+2023-07-21 09:13PM;yyyy-MM-dd hh:mma;Etc/GMT;DATETIME;STRICT;null
+2023-07-21 09:13PM;uuuu-MM-dd hh:mma;Etc/GMT;DATETIME;STRICT;1689973980
+2023-07-21 09:13:10;yyyy-MM-dd HH:mm:ss;Etc/GMT;SIMPLE;SMART;1689930790
+2023-07-21 09:13:10;yyyy-MM-dd HH:mm:ss;Etc/GMT;DATETIME;SMART;1689930790
+2023-07-21 09:13:10;yyyy-MM-dd HH:mm:ss;Etc/GMT;DATETIME;STRICT;null
+2023-07-21 09:13:10;uuuu-MM-dd HH:mm:ss;Etc/GMT;DATETIME;STRICT;1689930790
+2023-07-21 09:13:10.123;yyyy-MM-dd HH:mm:ss.sss;Etc/GMT;SIMPLE;SMART;1689930903
+2023-07-21 09:13:10.123;yyyy-MM-dd HH:mm:ss.sss;Etc/GMT;DATETIME;SMART;null
+2023-07-21 09:13:10.123;yyyy-MM-dd HH:mm:ss.sss;Etc/GMT;DATETIME;STRICT;null
+2023-07-21 09:13:10.123;uuuu-MM-dd HH:mm:ss.sss;Etc/GMT;DATETIME;STRICT;null
+2001-02-28 00:00:00;yyyy-MM-dd HH:mm:ss;Etc/GMT;SIMPLE;SMART;983318400
+2001-02-28 00:00:00;yyyy-MM-dd HH:mm:ss;Etc/GMT;DATETIME;SMART;983318400
+2001-02-28 00:00:00;yyyy-MM-dd HH:mm:ss;Etc/GMT;DATETIME;STRICT;null
+2001-02-28 00:00:00;uuuu-MM-dd HH:mm:ss;Etc/GMT;DATETIME;STRICT;983318400
+2001-02-29;yyyy-MM-dd;Etc/GMT;SIMPLE;SMART;983404800
+2001-02-29;yyyy-MM-dd;Etc/GMT;DATETIME;SMART;983318400

Review Comment:
   > I am curious if the LENIENT value allows the SIMPLE and DATETIME parser to 
output the same result for invalid dates. 
   
   Yes it returns the same values ( but one difference is the symbol for year 
is different )
   
   
   ```
   8: jdbc:hive2://localhost:10001/> set hive.datetime.formatter=SIMPLE;
   No rows affected (0.048 seconds)
   
   8: jdbc:hive2://localhost:10001/> set hive.datetime.resolver.style=SMART;
   
   
   8: jdbc:hive2://localhost:10001/> select unix_timestamp('2001-02-31', 
'uuuu-MM-dd');
   +----------+
   |   _c0    |
   +----------+
   | 5270400  |
   +----------+
   1 row selected (0.141 seconds)
   8: jdbc:hive2://localhost:10001/> select unix_timestamp('2001-02-31', 
'yyyy-MM-dd');
   +------------+
   |    _c0     |
   +------------+
   | 983577600  |
   +------------+
   1 row selected (0.135 seconds)
   
   8: jdbc:hive2://localhost:10001/> set hive.datetime.formatter=DATETIME;
   8: jdbc:hive2://localhost:10001/> set hive.datetime.resolver.style=LENIENT;
   No rows affected (0.024 seconds)
   
   8: jdbc:hive2://localhost:10001/> select unix_timestamp('2001-02-31', 
'yyyy-MM-dd');
   +------------+
   |    _c0     |
   +------------+
   | 983577600  |
   +------------+
   1 row selected (0.124 seconds)
   
   8: jdbc:hive2://localhost:10001/> select unix_timestamp('2001-02-31', 
'uuuu-MM-dd');
   +------------+
   |    _c0     |
   +------------+
   | 983577600  |
   +------------+
   1 row selected (0.101 seconds)
   8:
   
   
   ```



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