This is an automated email from the ASF dual-hosted git repository.
comphead pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new 5afa801780 Minor: Add tests showing aggregate behavior for NaNs
(#10634)
5afa801780 is described below
commit 5afa8017800992437f7fb2105c2460642619e7fb
Author: Andrew Lamb <[email protected]>
AuthorDate: Mon May 27 11:50:06 2024 -0400
Minor: Add tests showing aggregate behavior for NaNs (#10634)
* Minor: Add tests showing aggregate behavior for NaNs
* Fix NaN setup
---
datafusion/sqllogictest/test_files/aggregate.slt | 35 ++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/datafusion/sqllogictest/test_files/aggregate.slt
b/datafusion/sqllogictest/test_files/aggregate.slt
index 2a220ea0a8..fec8586ee3 100644
--- a/datafusion/sqllogictest/test_files/aggregate.slt
+++ b/datafusion/sqllogictest/test_files/aggregate.slt
@@ -4653,6 +4653,41 @@ GROUP BY dummy
----
text1, text1, text1
+# Tests for aggregating with NaN values
+statement ok
+CREATE TABLE float_table (
+ col_f32 FLOAT,
+ col_f32_nan FLOAT,
+ col_f64 DOUBLE,
+ col_f64_nan DOUBLE
+) as VALUES
+( -128.2, -128.2, -128.2, -128.2 ),
+( 32768.3, arrow_cast('NAN','Float32'), 32768.3, 32768.3 ),
+( 27.3, 27.3, 27.3, arrow_cast('NAN','Float64') );
+
+query RRRRI
+select min(col_f32), max(col_f32), avg(col_f32), sum(col_f32), count(col_f32)
from float_table;
+----
+-128.2 32768.3 10889.13359451294 32667.40078353882 3
+
+query RRRRI
+select min(col_f32_nan), max(col_f32_nan), avg(col_f32_nan), sum(col_f32_nan),
count(col_f32_nan) from float_table;
+----
+-128.2 NaN NaN NaN 3
+
+query RRRRI
+select min(col_f64), max(col_f64), avg(col_f64), sum(col_f64), count(col_f64)
from float_table;
+----
+-128.2 32768.3 10889.133333333333 32667.4 3
+
+query RRRRI
+select min(col_f64_nan), max(col_f64_nan), avg(col_f64_nan), sum(col_f64_nan),
count(col_f64_nan) from float_table;
+----
+-128.2 NaN NaN NaN 3
+
+statement ok
+drop table float_table
+
# Queries with nested count(*)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]