Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/5514#discussion_r28446291
  
    --- Diff: core/src/main/scala/org/apache/spark/SparkConf.scala ---
    @@ -443,61 +461,55 @@ private[spark] object SparkConf extends Logging {
       }
     
       /**
    -   * Translate the configuration key if it is deprecated and has a 
replacement, otherwise just
    -   * returns the provided key.
    -   *
    -   * @param userKey Configuration key from the user / caller.
    -   * @param warn Whether to print a warning if the key is deprecated. 
Warnings will be printed
    -   *             only once for each key.
    +   * Looks for available deprecated keys for the given config option, and 
return the first
    +   * value available.
        */
    -  private def translateConfKey(userKey: String, warn: Boolean = false): 
String = {
    -    deprecatedConfigs.get(userKey)
    -      .map { deprecatedKey =>
    -        if (warn) {
    -          deprecatedKey.warn()
    -        }
    -        deprecatedKey.newName.getOrElse(userKey)
    -      }.getOrElse(userKey)
    +  def getDeprecatedConfig(key: String, conf: SparkConf): Option[String] = {
    +    configsWithAlternatives.get(key).flatMap(
    +      _.collectFirst {
    +        case x if conf.contains(x.key) =>
    +          val value = conf.get(x.key)
    +          x.translation.map(_(value)).getOrElse(value)
    +      })
    --- End diff --
    
    how about
    ```
    configsWithAlternatives.get(key).flatMap { alternatives =>
      alternatives.collectFirst { case alt if conf.contains(alt.key) =>
        alt.translate(conf.get(alt.key))
      }
    }
    ```
    and then define a `translate` method in `AlternateConfig`


---
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]

Reply via email to