vinodkc commented on code in PR #39449:
URL: https://github.com/apache/spark/pull/39449#discussion_r1085963701
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/maskExpressions.scala:
##########
@@ -257,19 +271,272 @@ case class Mask(
otherChar = newChildren(4))
}
-case class MaskArgument(maskChar: Char, ignore: Boolean)
+// scalastyle:off line.size.limit
+@ExpressionDescription(
+ usage =
+ """_FUNC_(input[, charCount, upperChar, lowerChar, digitChar, otherChar])
- masks the first n characters of given string value.
+ The function masks the first n characters of the value with 'X' or 'x',
and numbers with 'n'.
+ This can be useful for creating copies of tables with sensitive
information removed.
+ Error behavior: null value as replacement argument will throw
AnalysisError.
+ """,
+ arguments = """
+ Arguments:
+ * input - string value to mask. Supported types: STRING, VARCHAR,
CHAR
+ * charCount - number of characters to be masked. Default value: 4
+ * upperChar - character to replace upper-case characters with. Specify
NULL to retain original character. Default value: 'X'
+ * lowerChar - character to replace lower-case characters with. Specify
NULL to retain original character. Default value: 'x'
+ * digitChar - character to replace digit characters with. Specify NULL
to retain original character. Default value: 'n'
+ * otherChar - character to replace all other characters with. Specify
NULL to retain original character. Default value: NULL
+ """,
+ examples = """
+ Examples:
Review Comment:
This case already exists `SELECT _FUNC_('abcd-EFGH-8765-@$#', 20, 'x', 'X',
'n', 'o');`, input string length 18, request to mask 20 chars,
Result: `XXXXoxxxxonnnnoooo`
Considers all chars (18)in the input string for masking
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]