comphead commented on code in PR #10634: URL: https://github.com/apache/datafusion/pull/10634#discussion_r1615314056
########## datafusion/sqllogictest/test_files/aggregate.slt: ########## @@ -4626,6 +4626,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 Review Comment: What concerns me is below: ``` DataFusion CLI v38.0.0 > 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') ); 0 row(s) fetched. Elapsed 0.028 seconds. > select min(col_f32), max(col_f32), avg(col_f32), sum(col_f32), count(col_f32) from float_table; +--------------------------+--------------------------+--------------------------+--------------------------+----------------------------+ | MIN(float_table.col_f32) | MAX(float_table.col_f32) | AVG(float_table.col_f32) | SUM(float_table.col_f32) | COUNT(float_table.col_f32) | +--------------------------+--------------------------+--------------------------+--------------------------+----------------------------+ | -128.2 | 32768.3 | 10889.13359451294 | 32667.40078353882 | 3 | +--------------------------+--------------------------+--------------------------+--------------------------+----------------------------+ 1 row(s) fetched. Elapsed 0.011 seconds. ``` but in both duckdb and postgres ``` > > select -128.2 col_f32, -128.2 col_f32_nan, -128.2 col_f64, -128.2 col_f64_nan union all > select 32768.3, 'NaN'::DOUBLE PRECISION, 32768.3, 32768.3 union all > select 27.3, 27.3, 27.3, 'NaN'::DOUBLE PRECISION) x > ; ┌──────────────┬──────────────┬────────────────────┬───────────────┬────────────────┐ │ min(col_f32) │ max(col_f32) │ avg(col_f32) │ sum(col_f32) │ count(col_f32) │ │ decimal(6,1) │ decimal(6,1) │ double │ decimal(38,1) │ int64 │ ├──────────────┼──────────────┼────────────────────┼───────────────┼────────────────┤ │ -128.2 │ 32768.3 │ 10889.133333333333 │ 32667.4 │ 3 │ └──────────────┴──────────────┴────────────────────┴───────────────┴────────────────┘ ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org