Github user sethah commented on a diff in the pull request:
https://github.com/apache/spark/pull/9380#discussion_r43662570
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/functions.scala
---
@@ -1135,7 +992,76 @@ abstract class CentralMomentAgg(child: Expression)
extends ImperativeAggregate w
moments(4) = buffer.getDouble(fourthMomentOffset)
}
- getStatistic(n, mean, moments)
+ if (n == 0.0) null
+ else if (n == 1.0) 0.0
--- End diff --
I don't believe we want this behavior, since these edge cases should be
handled in the `getStatistic` implementation. If you see [previous
PR](https://github.com/apache/spark/pull/9003) we established that `Skewness`
and `Kurtosis` should yield `Double.NaN` when `n == 1.0` but other functions
like `VariancePop` should yield 0.0.
---
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]