Github user mengxr commented on a diff in the pull request:
https://github.com/apache/spark/pull/9705#discussion_r45131538
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/Kurtosis.scala
---
@@ -37,13 +37,16 @@ case class Kurtosis(child: Expression,
override protected val momentOrder = 4
// NOTE: this is the formula for excess kurtosis, which is default for R
and SciPy
- override def getStatistic(n: Double, mean: Double, moments:
Array[Double]): Double = {
+ override def getStatistic(n: Double, mean: Double, moments:
Array[Double]): Any = {
require(moments.length == momentOrder + 1,
s"$prettyName requires ${momentOrder + 1} central moments, received:
${moments.length}")
val m2 = moments(2)
val m4 = moments(4)
- if (n == 0.0 || m2 == 0.0) {
+ if (n == 0.0) {
+ null
+ }
+ else if (m2 == 0.0) {
--- End diff --
minor: @JihongMA Could you update your code formatter to put `}` and `else`
on the same line?
---
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]