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


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

Review Comment:
   With this PR: 
   a) without the pattern : UDF returns Null  ->same as before
   b) With pattern
   1. For SIMPLE and SMART:  Same behavior as before this fix
   2. For DATETIME and SMART: Same behavior as before this fix
   3. For DATETIME and STRICT: Invalid dates are returned as null
   4. For DATETIME and LENIENT : Matches the output of SIMPLE  (but the symbol 
uuuu represents year instead of Day number of week)
   
   ```
   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');
   No rows affected (0.018 seconds)
   +-------+
   |  _c0  |
   +-------+
   | NULL  |
   +-------+
   1 row selected (0.21 seconds)
   
   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;
   No rows affected (0.011 seconds)
   8: jdbc:hive2://localhost:10001/> set hive.datetime.resolver.style=SMART;
   No rows affected (0.016 seconds)
   8: jdbc:hive2://localhost:10001/> select unix_timestamp('2001-02-31');
   +-------+
   |  _c0  |
   +-------+
   | NULL  |
   +-------+
   1 row selected (0.195 seconds)
   8: jdbc:hive2://localhost:10001/> select unix_timestamp('2001-02-31', 
'uuuu-MM-dd');
   +------------+
   |    _c0     |
   +------------+
   | 983318400  |
   +------------+
   1 row selected (0.123 seconds)
   
   
   8: jdbc:hive2://localhost:10001/> select unix_timestamp('2001-02-31', 
'yyyy-MM-dd');
   +------------+
   |    _c0     |
   +------------+
   | 983318400  |
   +------------+
   1 row selected (0.132 seconds)
   
   
   8: jdbc:hive2://localhost:10001/> set hive.datetime.resolver.style=STRICT;
   No rows affected (0.019 seconds)
   
   8: jdbc:hive2://localhost:10001/> select unix_timestamp('2001-02-31');
   +-------+
   |  _c0  |
   +-------+
   | NULL  |
   +-------+
   1 row selected (0.122 seconds)
   
   8: jdbc:hive2://localhost:10001/> select unix_timestamp('2001-02-31', 
'uuuu-MM-dd');
   +-------+
   |  _c0  |
   +-------+
   | NULL  |
   +-------+
   1 row selected (0.277 seconds)
   
   8: jdbc:hive2://localhost:10001/> select unix_timestamp('2001-02-31', 
'yyyy-MM-dd');
   +-------+
   |  _c0  |
   +-------+
   | NULL  |
   +-------+
   1 row selected (0.125 seconds)
   
   
   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