Skip to content

Commit

Permalink
updated the evaluate logic and added slt test
Browse files Browse the repository at this point in the history
  • Loading branch information
jatin committed Sep 25, 2024
1 parent d88e4c6 commit d925061
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion datafusion/functions-aggregate/src/kurtosis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ impl Accumulator for KurtosisAccumulator {
}

fn evaluate(&mut self) -> datafusion_common::Result<ScalarValue> {
if self.count < 3 {
if self.count <= 3 {
return Ok(ScalarValue::Float64(None));
}

Expand Down
12 changes: 11 additions & 1 deletion datafusion/sqllogictest/test_files/aggregate.slt
Original file line number Diff line number Diff line change
Expand Up @@ -5934,7 +5934,7 @@ SELECT kurtosis(col) FROM VALUES (1), (10), (100), (10), (1) as tab(col);
query R
SELECT kurtosis(col) FROM VALUES (1), (2), (3), (2), (1) as tab(col);
----
-0.615384615385
-0.612244897959

query R
SELECT kurtosis(col) FROM VALUES (1.0), (10.0), (100.0), (10.0), (1.0) as tab(col);
Expand All @@ -5951,6 +5951,16 @@ SELECT kurtosis(col) FROM VALUES (1.0) as tab(col);
----
NULL

query R
SELECT kurtosis(col) FROM VALUES (1.0), (2.0) as tab(col);
----
NULL

query R
SELECT kurtosis(col) FROM VALUES (1.0), (2.0), (3.0) as tab(col);
----
NULL

query R
SELECT kurtosis(1);
----
Expand Down

0 comments on commit d925061

Please sign in to comment.