HAWQ-985. Add feature test for agg with groupingsets and null.
Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/d73117ed Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/d73117ed Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/d73117ed Branch: refs/heads/master Commit: d73117ed9f76830427491e9ef455c84e164f441b Parents: 1774432 Author: ztao1987 <[email protected]> Authored: Tue Aug 9 06:25:13 2016 +0800 Committer: ztao1987 <[email protected]> Committed: Tue Aug 9 10:19:24 2016 +0800 ---------------------------------------------------------------------- src/test/feature/query/test_aggregate.cpp | 12 ++++++ .../expected/aggregate_with_groupingsets.out | 39 -------------------- src/test/regress/expected/aggregates_null.out | 27 -------------- src/test/regress/known_good_schedule | 2 - .../regress/sql/aggregate_with_groupingsets.sql | 32 ---------------- src/test/regress/sql/aggregates_null.sql | 24 ------------ 6 files changed, 12 insertions(+), 124 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/d73117ed/src/test/feature/query/test_aggregate.cpp ---------------------------------------------------------------------- diff --git a/src/test/feature/query/test_aggregate.cpp b/src/test/feature/query/test_aggregate.cpp index 4f07689..fedb8c2 100644 --- a/src/test/feature/query/test_aggregate.cpp +++ b/src/test/feature/query/test_aggregate.cpp @@ -60,4 +60,16 @@ TEST_F(TestAggregate, TestAggregateWithGroupingsets) { " sum_c;", "1|aa|10|\n1|bb|20|\n2|cc|20|\n|aa|10|\n|bb|20|\n|cc|20|\n"); } +TEST_F(TestAggregate, TestAggregateWithNull) { + hawq::test::SQLUtility util; + util.execute("drop table if exists t"); + hawq::test::DataGenerator dGen(&util); + dGen.genTableWithNull("t"); + + util.query( + "select SUM(CASE WHEN a = 15 THEN 1 ELSE 0 END), b ,c from t group by " + "b,c", + "1||aa|\n0||WET|\n0|51||\n"); +} + http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/d73117ed/src/test/regress/expected/aggregate_with_groupingsets.out ---------------------------------------------------------------------- diff --git a/src/test/regress/expected/aggregate_with_groupingsets.out b/src/test/regress/expected/aggregate_with_groupingsets.out deleted file mode 100644 index 2bc4545..0000000 --- a/src/test/regress/expected/aggregate_with_groupingsets.out +++ /dev/null @@ -1,39 +0,0 @@ ---- ---- Drop existing table ---- -DROP TABLE IF EXISTS foo; -NOTICE: table "foo" does not exist, skipping ---- ---- Create new table foo ---- -CREATE TABLE foo(type INTEGER, prod VARCHAR, quantity NUMERIC); ---- ---- Insert some value ---- -INSERT INTO foo VALUES(1, 'Table', 100); -INSERT INTO foo VALUES(2, 'Chair', 250); -INSERT INTO foo VALUES(3, 'Bed', 300); ---- ---- Select query with grouping sets ---- -SELECT type, prod, sum(quantity) s_quant -FROM -( - SELECT type, prod, quantity - FROM foo F1 - LIMIT 3 -) F2 GROUP BY GROUPING SETS((type, prod), (prod)) ORDER BY type, s_quant; - type | prod | s_quant -------+-------+--------- - 1 | Table | 100 - 2 | Chair | 250 - 3 | Bed | 300 - | Table | 100 - | Chair | 250 - | Bed | 300 -(6 rows) - ---- ---- Drop created table ---- -DROP TABLE IF EXISTS foo;
