damnMeddlingKid opened a new issue #10644:
URL: https://github.com/apache/druid/issues/10644


   ### Affected Version
   
   Tested on 0.20.0
   
   ### Description
   
   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
   
   1) set druid.generic.useDefaultValueForNull=true
   2) 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.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to