Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Incorporated some review comments in the masking section

...

Return Type

Name(Signature)

Description

string

mask(string str[, string string upper[, string lower[, string number]]])

Returns a masked version of str (as of Hive 2.1.0). By default, upper case letters are converted to '"X'", lower case letters are converted to '"x' " and numbers are converted to '"n'". For example mask("abcd-EFGH-8765-4321") results in xxxx-XXXX-nnnn-nnnn. You can override the caracters used in the mask by supplying additional arguments: the second argument controls the mask character for upper case letters, the third argument for lower case letters and the fourth argument for numbers. For example, mask("abcd-EFGH-8765-4321", '"U'", '"l'", '"#'") results in llll-UUUU-####-####.

stringmask_first_n(string str[, int n])Returns a masked version of str with up to the first n values masked (as of Hive 2.1.0). Upper case letters are converted to '"X'", lower case letters are converted to '"x' " and numbers are converted to '"n'". For example, mask_first_n("1234-5678-8765-4321", 4) results in nnnn-5678-8765-4321.
stringmask_last_n(string str[, int n])Returns a masked version of str with up to the last n values masked (as of Hive 2.1.0). Upper case letters are converted to '"X'", lower case letters are converted to '"x' " and numbers are converted to '"n'". For example, mask_last_n("1234-5678-8765-4321", 4) results in 1234-5678-8765-nnnn.
stringmask_show_first_n(string str[, int n])Returns a masked version of str, showing up to the first n characters unmasked (as of Hive 2.1.0). Upper case letters are converted to '"X'", lower case letters are converted to '"x' " and numbers are converted to '"n'". For example, mask_show_first_n("1234-5678-8765-4321", 4) results in 1234-nnnn-nnnn-nnnn.
stringmask_show_last_n(string str[, int n])Returns a masked version of str, showing up to the last n characters unmasked (as of Hive 2.1.0). Upper case letters are converted to '"X'", lower case letters are converted to '"x' " and numbers are converted to '"n'". For example, mask_show_last_n("1234-5678-8765-4321", 4) results in nnnn-nnnn-nnnn-4321.
stringmask_hash(string|char|varchar str)Returns a hashed value based on str (as of Hive 2.1.0). The hash is consistent and can be used to join masked values together across tables. This function returns null for non-string types.

...