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 2022/07/09 01:49:49 UTC

[GitHub] [spark] beliefer commented on a diff in pull request #37137: [SPARK-37623][SPARK-39230][SQL][FOLLOW-UP] Make regr_slope and regr_intercept safe with ANSI mode

beliefer commented on code in PR #37137:
URL: https://github.com/apache/spark/pull/37137#discussion_r917205859


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/linearRegression.scala:
##########
@@ -278,7 +278,8 @@ case class RegrSlope(left: Expression, right: Expression) extends DeclarativeAgg
     covarPop.mergeExpressions ++ varPop.mergeExpressions
 
   override lazy val evaluateExpression: Expression = {
-    If(covarPop.n === 0.0, Literal.create(null, DoubleType), covarPop.ck / varPop.m2)
+    If(Or(covarPop.n === 0.0, varPop.m2 === 0.0),

Review Comment:
   At first, I think if the `covarPop.n === 0.0` means `varPop.n === 0.0` and `varPop.m2 === 0.0`.
   It seems `varPop.m2 === 0.0` not determined by `varPop.n === 0.0`.



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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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