Github user markgrover commented on a diff in the pull request:
https://github.com/apache/spark/pull/17047#discussion_r103367049
--- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
@@ -2574,13 +2575,30 @@ private[spark] object Utils extends Logging {
def redact(conf: SparkConf, kvs: Seq[(String, String)]): Seq[(String,
String)] = {
val redactionPattern = conf.get(SECRET_REDACTION_PATTERN).r
+ redact(redactionPattern, kvs)
+ }
+
+ private def redact(redactionPattern: Regex, kvs: Seq[(String, String)]):
Seq[(String, String)] = {
kvs.map { kv =>
redactionPattern.findFirstIn(kv._1)
.map { ignore => (kv._1, REDACTION_REPLACEMENT_TEXT) }
.getOrElse(kv)
}
}
+ /**
+ * Looks up the redaction regex from within the key value pairs and uses
it to redact the rest
+ * of the key value pairs. No care is taken to make sure the redaction
property itself is not
+ * redacted. So theoretically, the property itself could be configured
to redact its own value
+ * when printing.
+ * @param kvs
+ * @return
+ */
+ def redact(kvs: Map[String, String]): Seq[(String, String)] = {
--- End diff --
Correct, that's exactly the use case - where there isn't a conf object
available yet. I will update the Javadoc. Thanks for reviewing!
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]