[
https://issues.apache.org/jira/browse/HIVE-22699?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17009721#comment-17009721
]
Quanlong Huang commented on HIVE-22699:
---------------------------------------
Hi [~Rajkumar Singh], the doc I mean is the result of "describe function
extended mask":
{code:java}
masks the given value
Examples:
mask(ccn)
mask(ccn, 'X', 'x', '0')
mask(ccn, 'x', 'x', 'x')
Arguments:
mask(value, upperChar, lowerChar, digitChar, otherChar, numberChar,
dayValue, monthValue, yearValue)
value - value to mask. Supported types: TINYINT, SMALLINT, INT,
BIGINT, STRING, VARCHAR, CHAR, DATE
upperChar - character to replace upper-case characters with. Specify -1
to retain original character. Default value: 'X'
lowerChar - character to replace lower-case characters with. Specify -1
to retain original character. Default value: 'x'
digitChar - character to replace digit characters with. Specify -1 to
retain original character. Default value: 'n'
otherChar - character to replace all other characters with. Specify -1 to
retain original character. Default value: -1
numberChar - character to replace digits in a number with. Valid values:
0-9. Default value: '1'
dayValue - value to replace day field in a date with. Specify -1 to
retain original value. Valid values: 1-31. Default value: 1
monthValue - value to replace month field in a date with. Specify -1 to
retain original value. Valid values: 0-11. Default value: 0
yearValue - value to replace year field in a date with. Specify -1 to
retain original value. Default value: 0 {code}
You are trying the argument in STRING type. If you try any numeric types
(TINYINT, SMALLINT, INT, BIGINT) with value 0, you can find the result is
always 0. It should be masked to 'numberChar' which defaults to 1.
> Mask UDFs should mask numeric value 0
> -------------------------------------
>
> Key: HIVE-22699
> URL: https://issues.apache.org/jira/browse/HIVE-22699
> Project: Hive
> Issue Type: Bug
> Reporter: Quanlong Huang
> Priority: Major
>
> These queries all return 0:
> {code:java}
> select mask(0);
> select mask_first_n(0);
> select mask_last_n(0);
> select mask_show_first_n(0, 0);
> select mask_show_last_n(0, 0);{code}
> According to the doc, they should return 1.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)