srowen commented on code in PR #37137:
URL: https://github.com/apache/spark/pull/37137#discussion_r916811045
##########
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:
I think we need to remove the check on covarPop - it's fine if that is 0,
the slope is just 0. I think it was a typo and was meant to be only varPop.m2
checked for 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: [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]