dongjoon-hyun 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_r353013375
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/DataFrameNaFunctions.scala
 ##########
 @@ -456,11 +456,23 @@ final class DataFrameNaFunctions private[sql](df: 
DataFrame) {
     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))
+      if (isNaN(source) || isNaN(target)) {
+        col.dataType match {
+          case IntegerType | LongType | ShortType | ByteType => Seq.empty
 
 Review comment:
   Thank you for your guide, @cloud-fan !

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