cloud-fan commented on code in PR #37137:
URL: https://github.com/apache/spark/pull/37137#discussion_r916796035


##########
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:
   This is a behavior change in ANSI mode but looks reasonable. The two 
functions are new in 3.4 so no breaking change. @beliefer can you double-check 
the formular? I'm wondering why we only checked `covarPop.n === 0.0` at the 
first place.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to