apache / apache/pinot

Aggregation query's shouldn't return rows when there isn't any data

Open
#9,531 12 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
6.1k
Forks
1.5k
Avg merge
2d 55m
Merged PRs (30d)
182

Description

We noticed that there is inconsistency in the way aggregation function queries return data.
For example
```
select sum(count_field) from table where application='xxxx'
```
This will return **1 row with value 0,** even when I make up a application value that doesn't exist.
If however, I added a time filter to this,
```
select created_15min, sum(count_field) from table where application = 'xxxx' and created_15min >= 1664582400000
group by 1
```
this returns **0 rows.**

I believe the correct response here should be zero rows, especially since for that first query for example, `numDocsScanned` is 0

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the two aggregation queries from the issue against Apache Pinot, comparing results when the filter matches no data and checking the reported numDocsScanned value. Trace the aggregation query path to identify where the no-data result differs, then add regression coverage showing the expected empty result and verify both query forms.

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
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.