yashmayya opened a new pull request, #17750:
URL: https://github.com/apache/pinot/pull/17750

   - Currently, if we run a query like `SELECT DISTINCT_COUNT(xyz) FROM 
myEmptyTable`, it returns an error like: `Cannot invoke "java.util.Set.size()" 
because "intermediateResult" is null `.
   - The bug is in how the multi-stage query engine handles empty tables during 
the `FINAL` aggregation stage. Two code paths interact to cause the NPE:
     - `processMerge()` skips null intermediate results. When a table is empty, 
the leaf stage produces null intermediate results. The merge stage skips all of 
them, so the merge result holders remain null.
   
     - `extractFinalResult()` doesn't handle `null` in various different 
aggregation functions.
   - This patch fixes all the aggregation functions that don't currently handle 
null intermediate results appropriately. While we could also patch the 
multi-stage aggregation executor to first call `extractAggregationResult()` 
before calling `extractFinalResult()` in these situations, it's more robust to 
make sure that the aggregation functions' `extractFinalResult()` method 
implementations  also handle `null` values appropriately. 
   


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