Affected Version
Tested on 0.20.0
Description
Not sure if this is a bug
When executing a filtered aggregate that doesn't match any rows druid will return the init value of the aggregate involved. For example for the LongMaxVectorAggregator druid will return Long.MIN as the result of the aggregation because this is what the aggregator was initialized to https://github.com/apache/druid/blob/master/processing/src/main/java/org/apache/druid/query/aggregation/LongMaxVectorAggregator.java#L39
Steps to reproduce
- set druid.generic.useDefaultValueForNull=true
- Run a query like
SELECT MAX(__time) as t1, MAX(__time) FILTER(WHERE dim1 = 'non_existing') as t2 FROM druid.foo
this is a filtered aggregate on a time column where the filter doesn't match anything. I'm not sure what the expected result should be here, but i was surprised to find that the actual result is
"t1":"2001-01-03T00:00:00.000Z", "t2":"-292275055-05-16T16:47:04.192Z"
It sounds like according to the documentation LongMax should return 0 as a default value when theres nothing to aggregate.
Affected Version
Tested on 0.20.0
Description
Not sure if this is a bug
When executing a filtered aggregate that doesn't match any rows druid will return the init value of the aggregate involved. For example for the LongMaxVectorAggregator druid will return Long.MIN as the result of the aggregation because this is what the aggregator was initialized to https://github.com/apache/druid/blob/master/processing/src/main/java/org/apache/druid/query/aggregation/LongMaxVectorAggregator.java#L39
Steps to reproduce
this is a filtered aggregate on a time column where the filter doesn't match anything. I'm not sure what the expected result should be here, but i was surprised to find that the actual result is
It sounds like according to the documentation LongMax should return 0 as a default value when theres nothing to aggregate.