You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Madhan Neethiraj (JIRA)" <ji...@apache.org> on 2016/05/28 10:48:12 UTC

[jira] [Comment Edited] (HIVE-13859) mask() UDF not retaining day and month field values

    [ https://issues.apache.org/jira/browse/HIVE-13859?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15305279#comment-15305279 ] 

Madhan Neethiraj edited comment on HIVE-13859 at 5/28/16 10:47 AM:
-------------------------------------------------------------------

Fixed mask() UDF implementation to retain day and month field values when '-1' is specified as masked value.

CC: [~ashutoshc], [~hagleitn]


was (Author: madhan.neethiraj):
Fixed mask() UDF implementation to retain day and month field values when '-1' is specified as masked value.

> 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
>
>         Attachments: HIVE-13859.patch
>
>
> 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)