Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Return Type

Name(Signature)

Description

OSS

string

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

Returns a masked version of str. By default, upper case letters are converted to "X", lower case letters are converted to "x" and numbers are converted to "n". Example: mask("abcd-EFGH-8765-4321") results in xxxx-XXXX-nnnn-nnnn. You can override the characters 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-####-####.

GenericUDFMask

stringmask_first_n(string str[, int n])Returns a masked version of str with the first n values masked. 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.GenericUDFMaskFirstN
stringmask_last_n(string str[, int n])Returns a masked version of str with the last n values masked. 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.GenericUDFMaskLastN
stringmask_show_first_n(string str[, int n])Returns a masked version of str, showing the first n characters unmasked. 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.GenericUDFMaskShowFirstN
stringmask_show_last_n(string str[, int n])Returns a masked version of str, showing the last n characters unmasked. 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.GenericUDFMaskShowLastN
stringmask_hash(string|char|varchar str)Returns a hashed value based on str. The hash is consistent and can be used to join masked values together across tables. This function returns null for non-string types.GenericUDFMaskHash

Miscellaneous Functions

In Hive several built-in functions do not belong to any categories above. These are the special functions that Hive has.

...