Github user mengxr commented on a diff in the pull request:
https://github.com/apache/spark/pull/10960#discussion_r51533698
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/CentralMomentAgg.scala
---
@@ -57,173 +55,170 @@ abstract class CentralMomentAgg(child: Expression)
extends ImperativeAggregate w
override def dataType: DataType = DoubleType
- override def inputTypes: Seq[AbstractDataType] = Seq(NumericType)
+ override def inputTypes: Seq[AbstractDataType] = Seq(DoubleType)
+
+ protected val count = AttributeReference("count", 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)()
+
+ override val aggBufferAttributes = Seq(count, avg, m2, m3,
m4).take(momentOrder + 1)
--- End diff --
Shall we make `.take(momentOrder + 1)` a private method
(`trimHigherOrder`?) and have it documented?
---
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]