Madhan Neethiraj created HIVE-13859:
---------------------------------------

             Summary: mask() UDF not retaining day and month field values
                 Key: HIVE-13859
                 URL: https://issues.apache.org/jira/browse/HIVE-13859
             Project: Hive
          Issue Type: Bug
          Components: UDF
    Affects Versions: 2.1.0
            Reporter: Madhan Neethiraj
             Fix For: 2.1.0


For date type parameters, mask() UDF replaces year/month/day field values with 
the values given in arguments to the UDF. Argument value -1 is treated as 
special, to specify that mask() should retain the value in the parameter. This 
allows to selectively mask only year/month/day fields.

Specifying "-1" does not retain the values for day/month fields; however the 
year value is retained, as shown below.

{code}
0: jdbc:hive2://localhost:10000> select id, join_date from employee where id < 
4;
+-----+-------------+--+
| id  |  join_date  |
+-----+-------------+--+
| 1   | 2012-01-01  |
| 2   | 2014-02-01  |
| 3   | 2013-03-01  |
+-----+-------------+--+
3 rows selected (0.435 seconds)
0: jdbc:hive2://localhost:10000> select id, mask(join_date, -1, -1, -1, -1,-1, 
-1,-1,-1) join_date from employee where id < 4;
+-----+-------------+--+
| id  |  join_date  |
+-----+-------------+--+
| 1   | 2012-01-01  |
| 2   | 2014-01-01  |
| 3   | 2013-01-01  |
+-----+-------------+--+
3 rows selected (0.344 seconds)
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to