cloud-fan commented on a change in pull request #29983:
URL: https://github.com/apache/spark/pull/29983#discussion_r503094201



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/CentralMomentAgg.scala
##########
@@ -62,6 +63,9 @@ abstract class CentralMomentAgg(child: Expression)
   protected val m3 = AttributeReference("m3", DoubleType, nullable = false)()
   protected val m4 = AttributeReference("m4", DoubleType, nullable = false)()
 
+  protected val divideByZeroEvalResult: Expression =
+    if (SQLConf.get.legacyStatisticalAggregate) Double.NaN else 
Literal.create(null, DoubleType)

Review comment:
       can we move the flag to constructor parameter? e.g.
   ```
   abstract class CentralMomentAgg(child: Expression, nullOnDivideByZero: 
Boolean) {
     ...
     protected def divideByZeroEvalResult: Expression = if (nullOnDivideByZero) 
...
   }
   ```




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



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

Reply via email to