cloud-fan commented on a change in pull request #26738: [SPARK-30082][SQL] Do 
not replace Zeros when replacing NaNs
URL: https://github.com/apache/spark/pull/26738#discussion_r353117371
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/DataFrameNaFunctions.scala
 ##########
 @@ -455,8 +455,8 @@ final class DataFrameNaFunctions private[sql](df: 
DataFrame) {
   private def replaceCol(col: StructField, replacementMap: Map[_, _]): Column 
= {
     val keyExpr = df.col(col.name).expr
     def buildExpr(v: Any) = Cast(Literal(v), keyExpr.dataType)
-    val branches = replacementMap.flatMap { case (source, target) =>
-      Seq(buildExpr(source), buildExpr(target))
+    val branches = replacementMap.flatMap { case (src, target) =>
+        Seq(Literal(src), buildExpr(target))
 
 Review comment:
   nit: the previous 2 space indentation is corrected.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to