Quanlong Huang created HIVE-24641:
-------------------------------------
Summary: mask_first_n, mask_last_n, mask_show_first_n,
mask_show_last_n not deal with DATE type correctly
Key: HIVE-24641
URL: https://issues.apache.org/jira/browse/HIVE-24641
Project: Hive
Issue Type: Bug
Reporter: Quanlong Huang
It's unexpected that mask_first_n etc. always mask a DATE value to 0001-01-01
which inherits the behavior of mask().
{code:java}
0: jdbc:hive2://localhost:11050> select mask_first_n(current_date(), 4);
0001-01-01 # masking only the year part (4-digits) makes more sense
0: jdbc:hive2://localhost:11050> select mask_last_n(current_date(), 4);
0001-01-01 # masking only the month and day parts (4-digits) makes more sense
0: jdbc:hive2://localhost:11050> select mask_show_first_n(current_date(), 4);
0001-01-01 # masking except the year part makes more sense
0: jdbc:hive2://localhost:11050> select mask_show_last_n(current_date(), 4);
0001-01-01 # masking except the month and day parts makes more sense{code}
For masking the year part, currently we can only use
{code:java}
hive> select mask(current_date(), -1, -1, -1, -1, -1, -1, -1);
0001-01-15
{code}
For masking the month and day part, currently we can only use
{code:java}
hive> select mask(current_date(), -1, -1, -1, -1, -1, 0, 0, -1);
2021-01-01{code}
These are more inconvient than using the mask_first_n etc. functions.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)