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

    https://github.com/apache/spark/pull/18820#discussion_r131535534
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/DataFrameNaFunctions.scala ---
    @@ -366,11 +370,15 @@ final class DataFrameNaFunctions private[sql](df: 
DataFrame) {
           return df
         }
     
    -    // replacementMap is either Map[String, String] or Map[Double, Double] 
or Map[Boolean,Boolean]
    -    val replacementMap: Map[_, _] = replacement.head._2 match {
    -      case v: String => replacement
    -      case v: Boolean => replacement
    -      case _ => replacement.map { case (k, v) => (convertToDouble(k), 
convertToDouble(v)) }
    +    // replacementMap is either Map[String, String], Map[Double, Double], 
Map[Boolean,Boolean]
    +    // while value can have null
    +    val replacementMap: Map[_, _] = replacement.map {
    +      case (k, v: String) => (k, v)
    +      case (k, v: Boolean) => (k, v)
    +      case (k: String, null) => (k, null)
    +      case (k: Boolean, null) => (k, null)
    +      case (k, null) => (convertToDouble(k), null)
    +      case _ @(k, v) => (convertToDouble(k), convertToDouble(v))
    --- End diff --
    
    Could we use `case (k, v) =>` instead of `case _ @(k, v) =>` ?


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to