apache / apache/druid

Druid v33 gives null value for each column in aggregation that does not have a value in the query time range

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

Description

### Affected Version

v33

### Description

Hi, this may be intentional from Druid, but we are just trying to see if there are any settings we can turn on to avoid this behavior. We have gone through https://druid.apache.org/docs/latest/tutorials/tutorial-sql-null/ but don't see much about this behavior.

Specifically: when there is completely no data in a query time range, and when applying aggregation such as SUM(payment_amount), the column for that aggregation will be NULL. Please see a screenshot attached.

Now we can add NVL to every aggregated column, but we are wondering if there is an easier way to do this (as adding NVL requires code change for our API). Thanks.

Image

Contributor guide

Open the contributing guide

Research direction

Start with the Druid v33 behavior described in the issue and read the linked SQL NULL tutorial. Reproduce SUM(payment_amount) over a time range with no data, then investigate whether a setting changes the NULL result; done requires a confirmed explanation and, if applicable, a documented configuration or code change.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.