Aleksandr Efimov created IMPALA-15703:
-----------------------------------------
Summary: Grouping sets lose the grand-total row on empty input
Key: IMPALA-15703
URL: https://issues.apache.org/jira/browse/IMPALA-15703
Project: IMPALA
Issue Type: Bug
Components: Frontend
Reporter: Aleksandr Efimov
Assignee: Aleksandr Efimov
Both planners lose the grand-total row when GROUPING SETS includes an empty
grouping set and the input produces no rows.
{code:sql}
SELECT a ka, b kb, c kc, grouping_id(a,b,c) gid, count(*) n
FROM (
SELECT * FROM (
SELECT cast(1 AS int) a, cast(2 AS int) b, cast(3 AS int) c,
cast(NULL AS bigint) v
UNION ALL SELECT 2, 3, 4, cast(NULL AS bigint)
) base
ORDER BY a LIMIT 1 OFFSET 100
) t
GROUP BY GROUPING SETS ((a,b,c), ());
{code}
Actual: no rows.
Expected: one row (NULL, NULL, NULL, 7, 0).
The keyed grouping set should remain empty. The empty set must emit its grand
total even when unused aggregate outputs are projected away.
This is separate from IMPALA-15698, which covers Calcite logical empty-input
pruning. The shared aggregation defect also affects the original planner.
Reproduced on master 234bd0001e33.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)