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


##########
ql/src/test/queries/clientpositive/test_unixtimestamp_for_invaild_dates.q:
##########
@@ -0,0 +1,20 @@
+DESCRIBE FUNCTION UNIX_TIMESTAMP;

Review Comment:
   Tested Without this PR, I see that : 
   1. without the pattern : UDF returns Null
   2. With pattern
   For SIMPLE:
   > u ---> Day number of week
   > y ---> Year
   
   For DateTime:
   > u ---> year
   > y ---> year-of-ear
   
   ```
   7: jdbc:hive2://localhost:10001/> set hive.datetime.formatter=SIMPLE;
   No rows affected (0.018 seconds)
   
   7: jdbc:hive2://localhost:10001/> select to_unix_timestamp('2001-02-31') ;
   +-------+
   |  _c0  |
   +-------+
   | NULL  |
   +-------+
   1 row selected (0.125 seconds)
   
   7: jdbc:hive2://localhost:10001/> select unix_timestamp('2001-02-31', 
'uuuu-MM-dd');
   +----------+
   |   _c0    |
   +----------+
   | 5270400  |
   +----------+
   1 row selected (0.147 seconds)
   
   7: jdbc:hive2://localhost:10001/> select unix_timestamp('2001-02-31', 
'yyyy-MM-dd');
   +------------+
   |    _c0     |
   +------------+
   | 983577600  |   this shows timestamp of March 3, 2001 12AM GMT
   +------------+
   1 row selected (0.131 seconds)
   
   
   7: jdbc:hive2://localhost:10001/> set hive.datetime.formatter=DATETIME;
   No rows affected (0.023 seconds)
   
   
   
   7: jdbc:hive2://localhost:10001/> select to_unix_timestamp('2001-02-31') ;
   +-------+
   |  _c0  |
   +-------+
   | NULL  |
   +-------+
   
   7: jdbc:hive2://localhost:10001/> select unix_timestamp('2001-02-31', 
'uuuu-MM-dd');
   
   +------------+
   |    _c0     |
   +------------+
   | 983318400  |  This shows time stamp of February 28, 2001 12AM GMT
   +------------+
   ```



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