alamb commented on code in PR #6952: URL: https://github.com/apache/arrow-datafusion/pull/6952#discussion_r1262454044
########## datafusion/core/tests/sqllogictests/test_files/aggregate.slt: ########## @@ -1489,29 +1519,49 @@ create table bit_aggregate_functions ( c1 SMALLINT NOT NULL, c2 SMALLINT NOT NULL, c3 SMALLINT, + tag varchar ) as values - (5, 10, 11), - (33, 11, null), - (9, 12, null); - -# query_bit_and -query III -SELECT bit_and(c1), bit_and(c2), bit_and(c3) FROM bit_aggregate_functions ----- -1 8 11 - -# query_bit_or -query III -SELECT bit_or(c1), bit_or(c2), bit_or(c3) FROM bit_aggregate_functions ----- -45 15 11 + (5, 10, 11, 'A'), + (33, 11, null, 'B'), + (9, 12, null, 'A'); + +# query_bit_and, query_bit_or, query_bit_xor Review Comment: These also didn't have coverage for GROUP BY , so I consolidated the tests and added grouping coverage ########## datafusion/core/tests/sqllogictests/test_files/aggregate.slt: ########## @@ -1883,69 +1933,101 @@ CREATE TABLE test_table (c1 INT, c2 INT, c3 INT) # Inserting data statement ok -INSERT INTO test_table VALUES (1, 10, 50), (1, 20, 60), (2, 10, 70), (2, 20, 80), (3, 10, NULL) +INSERT INTO test_table VALUES + (1, 10, 50), + (1, 20, 60), + (2, 10, 70), + (2, 20, 80), + (3, 10, NULL) # query_group_by_with_filter -query II rowsort -SELECT c1, SUM(c2) FILTER (WHERE c2 >= 20) as result FROM test_table GROUP BY c1 ----- -1 20 -2 20 -3 NULL +query III +SELECT + c1, + SUM(c2) FILTER (WHERE c2 >= 20), + SUM(c2) FILTER (WHERE c2 < 1) -- no rows pass filter, so the output should be NULL Review Comment: added some additional coverage with filtering ########## datafusion/core/tests/sqllogictests/test_files/aggregate.slt: ########## @@ -1883,69 +1933,101 @@ CREATE TABLE test_table (c1 INT, c2 INT, c3 INT) # Inserting data statement ok -INSERT INTO test_table VALUES (1, 10, 50), (1, 20, 60), (2, 10, 70), (2, 20, 80), (3, 10, NULL) +INSERT INTO test_table VALUES + (1, 10, 50), + (1, 20, 60), + (2, 10, 70), + (2, 20, 80), + (3, 10, NULL) # query_group_by_with_filter -query II rowsort -SELECT c1, SUM(c2) FILTER (WHERE c2 >= 20) as result FROM test_table GROUP BY c1 ----- -1 20 -2 20 -3 NULL +query III +SELECT + c1, + SUM(c2) FILTER (WHERE c2 >= 20), + SUM(c2) FILTER (WHERE c2 < 1) -- no rows pass filter, so the output should be NULL +FROM test_table GROUP BY c1 +---- +1 20 NULL +2 20 NULL +3 NULL NULL # query_group_by_avg_with_filter -query IR rowsort -SELECT c1, AVG(c2) FILTER (WHERE c2 >= 20) AS avg_c2 FROM test_table GROUP BY c1 ----- -1 20 -2 20 -3 NULL +query IRR rowsort +SELECT + c1, + AVG(c2) FILTER (WHERE c2 >= 20), + AVG(c2) FILTER (WHERE c2 < 1) -- no rows pass filter, so output should be null +FROM test_table GROUP BY c1 +---- +1 20 NULL +2 20 NULL +3 NULL NULL # query_group_by_with_multiple_filters query IIR rowsort -SELECT c1, SUM(c2) FILTER (WHERE c2 >= 20) AS sum_c2, AVG(c3) FILTER (WHERE c3 <= 70) AS avg_c3 FROM test_table GROUP BY c1 Review Comment: this was just some whitespace OCD -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
