Skip to content

Commit

Permalink
Add generic tests for filter after aggregation
Browse files Browse the repository at this point in the history
Having such cases would have caught a problem in the ongoing Iceberg
aggregation pushdown PR, which means these are useful to have.
  • Loading branch information
findepi committed Oct 17, 2023
1 parent 5d07c8b commit 7530cd5
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,13 @@ public void testAggregation()
assertQuery(
"SELECT count(*) FROM (SELECT count(*) FROM nation UNION ALL SELECT count(*) FROM region)",
"VALUES 2");

// HAVING, i.e. filter after aggregation
assertQuery("SELECT count(*) FROM nation HAVING count(*) = 25");
assertQuery("SELECT regionkey, count(*) FROM nation GROUP BY regionkey HAVING count(*) = 5");
assertQuery(
"SELECT regionkey, count(*) FROM nation GROUP BY GROUPING SETS ((), (regionkey)) HAVING count(*) IN (5, 25)",
"(SELECT NULL, count(*) FROM nation) UNION ALL (SELECT regionkey, count(*) FROM nation GROUP BY regionkey)");
}

@Test
Expand Down

0 comments on commit 7530cd5

Please sign in to comment.