mayankshriv commented on a change in pull request #4602: First pass of GROUP BY with ORDER BY support URL: https://github.com/apache/incubator-pinot/pull/4602#discussion_r325806695
########## File path: pinot-core/src/main/java/org/apache/pinot/core/query/reduce/BrokerReduceService.java ########## @@ -246,22 +264,46 @@ public BrokerResponseNative reduceOnDataTable(@Nonnull BrokerRequest brokerReque // Aggregation query. AggregationFunction[] aggregationFunctions = AggregationFunctionUtils.getAggregationFunctions(brokerRequest.getAggregationsInfo()); + if (!brokerRequest.isSetGroupBy()) { // Aggregation only query. setAggregationResults(brokerResponseNative, aggregationFunctions, dataTableMap, cachedDataSchema, preserveType); - } else { - // Aggregation group-by query. - boolean[] aggregationFunctionSelectStatus = - AggregationFunctionUtils.getAggregationFunctionsSelectStatus(brokerRequest.getAggregationsInfo()); - setGroupByHavingResults(brokerResponseNative, aggregationFunctions, aggregationFunctionSelectStatus, - brokerRequest.getGroupBy(), dataTableMap, brokerRequest.getHavingFilterQuery(), - brokerRequest.getHavingFilterSubQueryMap(), preserveType); - if (brokerMetrics != null && (!brokerResponseNative.getAggregationResults().isEmpty())) { - // We emit the group by size when the result isn't empty. All the sizes among group-by results should be the same. - // Thus, we can just emit the one from the 1st result. - brokerMetrics.addMeteredQueryValue(brokerRequest, BrokerMeter.GROUP_BY_SIZE, - brokerResponseNative.getAggregationResults().get(0).getGroupByResult().size()); + } else { // Aggregation group-by query. Review comment: May be factorize this as a utility function? ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org