siddharthteotia commented on a change in pull request #5154: Fix the NPE for 
DISTINCT aggregation function when no record is selected
URL: https://github.com/apache/incubator-pinot/pull/5154#discussion_r394907891
 
 

 ##########
 File path: 
pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/AggregationFunctionFactory.java
 ##########
 @@ -112,8 +111,10 @@ public static AggregationFunction 
getAggregationFunction(AggregationInfo aggrega
           case DISTINCTCOUNTRAWHLLMV:
             return new DistinctCountRawHLLMVAggregationFunction();
           case DISTINCT:
+            Preconditions.checkState(brokerRequest != null,
+                "Broker request must be provided for 'DISTINCT' aggregation 
function");
             return new 
DistinctAggregationFunction(AggregationFunctionUtils.getColumn(aggregationInfo),
-                brokerRequest != null ? brokerRequest.getLimit() : 
SelectAstNode.DEFAULT_RECORD_LIMIT, brokerRequest.getOrderBy());
+                brokerRequest.getOrderBy(), brokerRequest.getLimit());
 
 Review comment:
   I am unable to recall why I had this if check. I think there was a code-path 
where null broker request could have been passed. It is not possible right?

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


With regards,
Apache Git Services

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

Reply via email to