Github user davies commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10960#discussion_r51607516
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/CentralMomentAgg.scala
 ---
    @@ -52,178 +50,162 @@ abstract class CentralMomentAgg(child: Expression) 
extends ImperativeAggregate w
       protected def momentOrder: Int
     
       override def children: Seq[Expression] = Seq(child)
    -
       override def nullable: Boolean = true
    -
       override def dataType: DataType = DoubleType
    +  override def inputTypes: Seq[AbstractDataType] = Seq(DoubleType)
    +
    +  protected val n = AttributeReference("n", DoubleType, nullable = false)()
    +  protected val avg = AttributeReference("avg", DoubleType, nullable = 
false)()
    +  protected val m2 = AttributeReference("m2", DoubleType, nullable = 
false)()
    +  protected val m3 = AttributeReference("m3", DoubleType, nullable = 
false)()
    +  protected val m4 = AttributeReference("m4", DoubleType, nullable = 
false)()
    +
    +  private def trimHigherOrder[T](expressions: Seq[T]) = 
expressions.take(momentOrder + 1)
    +
    +  override val aggBufferAttributes = trimHigherOrder(Seq(n, avg, m2, m3, 
m4))
    +
    +  override val initialValues: Seq[Expression] =
    +    trimHigherOrder(Seq(Literal(0.0), Literal(0.0), Literal(0.0), 
Literal(0.0), Literal(0.0)))
    --- End diff --
    
    There is no difference for these initial values, the order does not matter 
here. Do you still think we should keep those comments? Or should I change to 
use `fill()`?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to