<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: How to Mask the Hive columns data in Join operator, due to data criticality in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-Mask-the-Hive-columns-data-in-Join-operator-due-to/m-p/169751#M57736</link>
    <description>&lt;P&gt;@zkfs, mask_show_last_n udf can be used for the scenario you mentioned. &lt;/P&gt;&lt;P&gt;You can run this query from the beeline to get additional details about udf:&lt;/P&gt;&lt;PRE&gt;DESCRIBE FUNCTION extended mask_show_last_n;

+---------------------------------------------------------------------------------------------------------------------------------+--+

|                                                            tab_name                                                             |

+---------------------------------------------------------------------------------------------------------------------------------+--+

| masks all but last n characters of the value                                                                                    |

| Examples:                                                                                                                       |

|    mask_show_last_n(ccn, &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt;                                                                                                     |

|    mask_show_last_n(ccn, 8, 'x', 'x', 'x')                                                                                      |

|  Arguments:                                                                                                                     |

|    mask_show_last_n(value, charCount, upperChar, lowerChar, digitChar, otherChar, numberChar)                                   |

|      value      - value to mask. Supported types: TINYINT, SMALLINT, INT, BIGINT, STRING, VARCHAR, CHAR                         |

|      charCount  - number of characters. Default value: 4                                                                        |

|      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'                           |

| NULL                                                                                                                            |

+---------------------------------------------------------------------------------------------------------------------------------+--+

&lt;/PRE&gt;&lt;P&gt;Following query returns string with all the characters masked except last 4:&lt;/P&gt;&lt;PRE&gt;select mask_show_last_n('AAbb1234567', 4, 'X', 'X', 'X');
+--------------+--+

|     _c0      |

+--------------+--+

| XXXXXXX4567  |

+--------------+--+

1 row selected (0.085 seconds

&lt;/PRE&gt;</description>
    <pubDate>Fri, 24 Mar 2017 01:22:51 GMT</pubDate>
    <dc:creator>jvaria</dc:creator>
    <dc:date>2017-03-24T01:22:51Z</dc:date>
    <item>
      <title>How to Mask the Hive columns data in Join operator, due to data criticality</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-Mask-the-Hive-columns-data-in-Join-operator-due-to/m-p/169748#M57733</link>
      <description>&lt;P&gt;Scenario as below &lt;/P&gt;&lt;P&gt;1) Have two tables A and B , having the column  Account_Number.&lt;/P&gt;&lt;P&gt;2) If we did the join it should run fine and give result with Account_Number.&lt;/P&gt;&lt;P&gt;3) However this Account_number to be masked in out put ( its critical data ).&lt;/P&gt;&lt;P&gt;4) we have get out put, Account_number should not display all data, its should be like XXXXXX12345.&lt;/P&gt;&lt;P&gt;Solition 1: In Ranger we can disable the Account_number colum name, if we did it join objeration will fail.  &lt;/P&gt;&lt;P style="margin-left: 60px;"&gt;  &lt;STRONG&gt;Join has to run on Account_number only and this data need to masked ?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Is it possible to do.&lt;/P&gt;&lt;P&gt;Your concerns are appriciated.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2017 16:53:52 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-Mask-the-Hive-columns-data-in-Join-operator-due-to/m-p/169748#M57733</guid>
      <dc:creator>shivkumar82015</dc:creator>
      <dc:date>2017-03-22T16:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to Mask the Hive columns data in Join operator, due to data criticality</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-Mask-the-Hive-columns-data-in-Join-operator-due-to/m-p/169749#M57734</link>
      <description>&lt;P&gt;You can use data masking udfs instead of disabling the column. &lt;/P&gt;&lt;P&gt;You can find more details from here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF#LanguageManualUDF-DataMaskingFunctions" target="_blank"&gt;https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF#LanguageManualUDF-DataMaskingFunctions&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://issues.apache.org/jira/browse/HIVE-13568" target="_blank"&gt;https://issues.apache.org/jira/browse/HIVE-13568&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2017 00:47:41 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-Mask-the-Hive-columns-data-in-Join-operator-due-to/m-p/169749#M57734</guid>
      <dc:creator>jvaria</dc:creator>
      <dc:date>2017-03-23T00:47:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to Mask the Hive columns data in Join operator, due to data criticality</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-Mask-the-Hive-columns-data-in-Join-operator-due-to/m-p/169750#M57735</link>
      <description>&lt;P&gt;thanks for your reply.&lt;/P&gt;&lt;P&gt;Have you implemented the UDF for this Masking the columnn, if yes please share sample code..&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2017 16:23:57 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-Mask-the-Hive-columns-data-in-Join-operator-due-to/m-p/169750#M57735</guid>
      <dc:creator>shivkumar82015</dc:creator>
      <dc:date>2017-03-23T16:23:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to Mask the Hive columns data in Join operator, due to data criticality</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-Mask-the-Hive-columns-data-in-Join-operator-due-to/m-p/169751#M57736</link>
      <description>&lt;P&gt;@zkfs, mask_show_last_n udf can be used for the scenario you mentioned. &lt;/P&gt;&lt;P&gt;You can run this query from the beeline to get additional details about udf:&lt;/P&gt;&lt;PRE&gt;DESCRIBE FUNCTION extended mask_show_last_n;

+---------------------------------------------------------------------------------------------------------------------------------+--+

|                                                            tab_name                                                             |

+---------------------------------------------------------------------------------------------------------------------------------+--+

| masks all but last n characters of the value                                                                                    |

| Examples:                                                                                                                       |

|    mask_show_last_n(ccn, &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt;                                                                                                     |

|    mask_show_last_n(ccn, 8, 'x', 'x', 'x')                                                                                      |

|  Arguments:                                                                                                                     |

|    mask_show_last_n(value, charCount, upperChar, lowerChar, digitChar, otherChar, numberChar)                                   |

|      value      - value to mask. Supported types: TINYINT, SMALLINT, INT, BIGINT, STRING, VARCHAR, CHAR                         |

|      charCount  - number of characters. Default value: 4                                                                        |

|      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'                           |

| NULL                                                                                                                            |

+---------------------------------------------------------------------------------------------------------------------------------+--+

&lt;/PRE&gt;&lt;P&gt;Following query returns string with all the characters masked except last 4:&lt;/P&gt;&lt;PRE&gt;select mask_show_last_n('AAbb1234567', 4, 'X', 'X', 'X');
+--------------+--+

|     _c0      |

+--------------+--+

| XXXXXXX4567  |

+--------------+--+

1 row selected (0.085 seconds

&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Mar 2017 01:22:51 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-Mask-the-Hive-columns-data-in-Join-operator-due-to/m-p/169751#M57736</guid>
      <dc:creator>jvaria</dc:creator>
      <dc:date>2017-03-24T01:22:51Z</dc:date>
    </item>
  </channel>
</rss>

