You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/10/12 03:24:36 UTC

[GitHub] [spark] leanken edited a comment on pull request #29983: [SPARK-13860][SQL] Change CentralMomentAgg to return null instead of Double.NaN when divideByZero

leanken edited a comment on pull request #29983:
URL: https://github.com/apache/spark/pull/29983#issuecomment-706833973


   > Seems plausible to me.
   
   ```
   case class CovSample(left: Expression, right: Expression) extends Covariance(left, right) {
     override val evaluateExpression: Expression = {
       If(n === 0.0, Literal.create(null, DoubleType),
         If(n === 1.0, Double.NaN, ck / (n - 1.0)))
     }
   
   case class Corr(x: Expression, y: Expression)
     extends PearsonCorrelation(x, y) {
   
     override val evaluateExpression: Expression = {
       If(n === 0.0, Literal.create(null, DoubleType),
         If(n === 1.0, Double.NaN, ck / sqrt(xMk * yMk)))
     }
   ```
   
   found two more place return Double.NaN with DivideByZero case. should I update these as well??
   and change ConfigName to `spark.sql.legacy.divideByZeroEvaluation` ??
   


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



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