dongjoon-hyun commented on a change in pull request #24800: [SPARK-27947][SQL] 
Enhance redactOptions to accept any Map type
URL: https://github.com/apache/spark/pull/24800#discussion_r291864939
 
 

 ##########
 File path: core/src/main/scala/org/apache/spark/util/Utils.scala
 ##########
 @@ -2632,11 +2632,18 @@ private[spark] object Utils extends Logging {
     // arbitrary property contained the term 'password', we may redact the 
value from the UI and
     // logs. In order to work around it, user would have to make the 
spark.redaction.regex property
     // more specific.
-    kvs.map { case (key, value) =>
-      redactionPattern.findFirstIn(key)
-        .orElse(redactionPattern.findFirstIn(value))
-        .map { _ => (key, REDACTION_REPLACEMENT_TEXT) }
-        .getOrElse((key, value))
+    kvs.map {
+      case (key: String, value: String) =>
+        redactionPattern.findFirstIn(key)
+          .orElse(redactionPattern.findFirstIn(value))
+          .map { _ => (key.asInstanceOf[K], 
REDACTION_REPLACEMENT_TEXT.asInstanceOf[V]) }
+          .getOrElse((key.asInstanceOf[K], value.asInstanceOf[V]))
+      case (key, value: String) =>
+        redactionPattern.findFirstIn(value)
+          .map { _ => (key, REDACTION_REPLACEMENT_TEXT.asInstanceOf[V]) }
+          .getOrElse((key, value.asInstanceOf[V]))
+      case (key, value) =>
+        (key, value)
 
 Review comment:
   Just out of curiosity, why not to 1 as I gave?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to