Use Filtered Aggregator return null but expect 0
- Dominant language
- Java
- Stars
- 14.1k
- Forks
- 3.8k
- Avg merge
- 2d 31m
- Merged PRs (30d)
- 209
Description
I recently encountered a problem with druid. When using the filter aggregator to count the total number of times a condition is met, since there is no data that satisfies the filter condition, it returns null when LongSum is performed, but expects to return 0. I don't know if there is a solution? The version of druid used is 0.10.1.
filtered aggregator:
{
"type": "filtered",
"filter": {
"type": "selector",
"dimension": "xxx",
"value": "yyy"
},
"aggregator": {
"type": "longSum",
"name": "value",
"fieldName": "zzz"
}
}
result:
{
"version" : "v1",
"timestamp" : "2018-08-01T00:00:00.000+08:00",
"event" : {
"value" : null
}
Contributor guide
Research direction
Start by reproducing the filtered aggregator configuration with a selector that matches no rows, using the LongSum aggregator described in the issue. Trace the filtered aggregation result and compare it with the expected empty-result behavior; the issue is done when the result consistently matches the intended zero-versus-null semantics and the behavior is covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- data, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100