dang-stripe commented on PR #18471:
URL: https://github.com/apache/pinot/pull/18471#issuecomment-4434310684

   @yashmayya @Jackie-Jiang wanted to discuss if there's a better fix that 
doesn't require updating all aggregation functions for null handling. i checked 
postgres and all functions return null except count-based functions.
   
   https://www.postgresql.org/docs/current/functions-aggregate.html
   > It should be noted that except for count, these functions return a null 
value when no rows are selected. In particular, sum of no rows returns null, 
not zero as one might expect, and array_agg returns null rather than an empty 
array when there are no input rows. `
   
   so we could do something like this in 
[`getResult()`](https://github.com/apache/pinot/pull/18471/changes/a35065a3791907542b30ad4da9a442b036aebc6f#diff-eefbc1d36655ab2f6aac7311054a129590eff37343378382f34b3ee2abfcc154R99).
 what do you think?
   ```
     case FINAL:
         Object intermediate = _mergeResultHolder[i];
         if (intermediate == null) {
             value = isCountFamily(aggFunction.getType()) ? 0L : null;
         } else {
             value = aggFunction.extractFinalResult(intermediate);
         }
   ```


-- 
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.

To unsubscribe, e-mail: [email protected]

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