yashmayya commented on code in PR #17750:
URL: https://github.com/apache/pinot/pull/17750#discussion_r2843474597


##########
pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/DistinctCountAggregationFunction.java:
##########
@@ -82,7 +82,7 @@ public ColumnDataType getFinalResultColumnType() {
 
   @Override
   public Integer extractFinalResult(Set intermediateResult) {
-    return intermediateResult.size();
+    return intermediateResult == null ? 0 : intermediateResult.size();

Review Comment:
   I followed the pattern from here - 
https://github.com/apache/pinot/blob/739043c09b41d1ce69310f2688204da6fcade8d7/pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/DistinctCountSmartHLLPlusAggregationFunction.java#L332-L334
   
   Even Postgres returns 0 for distinct count on an empty table. Are you 
thinking about the null handling case where there's no non-null data? Postgres 
returns 0 for that case too.



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