Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor: Improve aggregate test coverage more #6952

Merged
merged 3 commits into from
Jul 19, 2023

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Jul 13, 2023

Which issue does this PR close?

Follow on to #6939
Related to #6889

Rationale for this change

I almost merged code that had incorrect aggregate null handling and the tests didn't catch it

This is my attempt to improve coverage

What changes are included in this PR?

Add some more tests of aggregates (several types were missing coverage with GROUP BY). I'll comment inline

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions bot added core Core DataFusion crate sqllogictest SQL Logic Tests (.slt) labels Jul 13, 2023
statement ok
CREATE TABLE empty (column1 bigint, column2 int);

# no group by column
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The null tests didn't originally have coverage for the no group by case so I added that and consolidated some tests

(33, 11, null, 'B'),
(9, 12, null, 'A');

# query_bit_and, query_bit_or, query_bit_xor
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These also didn't have coverage for GROUP BY , so I consolidated the tests and added grouping coverage

SELECT
c1,
SUM(c2) FILTER (WHERE c2 >= 20),
SUM(c2) FILTER (WHERE c2 < 1) -- no rows pass filter, so the output should be NULL
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added some additional coverage with filtering


# 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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was just some whitespace OCD

@alamb
Copy link
Contributor Author

alamb commented Jul 13, 2023

And this found a bug #6955 🎉

@alamb alamb force-pushed the alamb/more_aggregate_tests branch from 94e8212 to 5f01044 Compare July 13, 2023 17:21
@alamb
Copy link
Contributor Author

alamb commented Jul 19, 2023

I think this is important coverage to add so I am merging it in

@alamb alamb merged commit 44008d7 into apache:main Jul 19, 2023
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core DataFusion crate sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant