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


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/linearRegression.scala:
##########
@@ -271,8 +271,13 @@ case class RegrSlope(left: Expression, right: Expression) 
extends DeclarativeAgg
 
   override lazy val initialValues: Seq[Expression] = covarPop.initialValues ++ 
varPop.initialValues
 
-  override lazy val updateExpressions: Seq[Expression] =
-    covarPop.updateExpressions ++ varPop.updateExpressions
+  override lazy val updateExpressions: Seq[Expression] = {
+    val isNull = left.isNull || right.isNull
+    val updateResult = covarPop.updateExpressions ++ varPop.updateExpressions
+    aggBufferAttributes.zip(updateResult).map { case (oldValue, newValue) =>
+      If(isNull, oldValue, newValue)

Review Comment:
   we only need to add this for `varPop.updateExpressions`



-- 
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-unsubscr...@spark.apache.org

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