dongjoon-hyun commented on code in PR #52693:
URL: https://github.com/apache/spark/pull/52693#discussion_r2456385435
##########
core/src/main/scala/org/apache/spark/SparkConf.scala:
##########
@@ -504,8 +503,16 @@ class SparkConf(loadDefaults: Boolean)
* Get all parameters that start with `prefix`
*/
def getAllWithPrefix(prefix: String): Array[(String, String)] = {
- getAll.filter { case (k, v) => k.startsWith(prefix) }
- .map { case (k, v) => (k.substring(prefix.length), v) }
+ val f = (k: String) => k.substring(prefix.length)
+ getAllWithPrefix(prefix, f)
+ }
+
+ /**
+ * Get all parameters that start with `prefix` and apply f.
+ */
+ def getAllWithPrefix[K](prefix: String, f: String => K): Array[(K, String)]
= {
Review Comment:
This new API looks good to me. Shall we add this simply without touching
other existing code?
--
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]