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/02/28 14:46:09 UTC

[GitHub] [spark] cloud-fan commented on a change in pull request #34882: [SPARK-37623][SQL] Support ANSI Aggregate Function: regr_slope & regr_intercept

cloud-fan commented on a change in pull request #34882:
URL: https://github.com/apache/spark/pull/34882#discussion_r815953323



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/linearRegression.scala
##########
@@ -105,3 +106,100 @@ case class RegrAvgY(left: Expression, right: Expression)
       newLeft: Expression, newRight: Expression): RegrAvgY =
     this.copy(left = newLeft, right = newRight)
 }
+
+abstract class Regression
+  extends DeclarativeAggregate with ImplicitCastInputTypes with BinaryLike[Expression] {
+
+  override def nullable: Boolean = true
+  override def dataType: DataType = DoubleType
+  override def inputTypes: Seq[AbstractDataType] = Seq(DoubleType, DoubleType)
+
+  protected val count = AttributeReference("count", DoubleType)()
+  protected val meanX = AttributeReference("meanX", DoubleType)()
+  protected val meanY = AttributeReference("meanY", DoubleType)()
+  protected val c2 = AttributeReference("c2", DoubleType)()
+  protected val m2X = AttributeReference("m2X", DoubleType)()

Review comment:
       can you refer to some doc/wiki about the algorithm? otherwise it's hard to understand `c2` and `m2x`




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