apache / apache/druid

Union queries with group by clause failure

Open
#11,612 0 comments 0 reactions 0 assignees View on GitHub
Area - SQL
Dominant language
Java
Stars
14.1k
Forks
3.8k
Avg merge
2d 58m
Merged PRs (30d)
233

Description

### Affected Version
0.21.1

### Description
This query is working in version 0.19.0
SELECT count(*) as cnt
0 as a
0 as b
0 as c
FROM "datasource"
WHERE FLOOR(__time TO HOUR) >= '2021-08-15 00:00:00' AND FLOOR(__time TO HOUR) <= '2021-08-15 23:00:00'
GROUP BY item_id
UNION ALL
SELECT 0 as cnt
sum(a) as a
sum(b) as b
sum(c) as c
FROM "datasource"
WHERE FLOOR(__time TO HOUR) >= '2021-08-15 00:00:00' AND FLOOR(__time TO HOUR) <= '2021-08-15 23:00:00'

but in later version we're getting the following error:
Error: Unknown exception
Error while applying rule DruidQueryRule(AGGREGATE_PROJECT), args [rel#170209:LogicalProject.NONE.[

Tested in various clusters from 1 data node up to 6 data nodes

Thanks

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the supplied UNION ALL query against Apache Druid 0.21.1 and comparing it with 0.19.0. Trace the reported DruidQueryRule(AGGREGATE_PROJECT) failure to identify the regression; done means the query no longer fails and its prior behavior is covered by a regression check.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.