siddharthteotia commented on a change in pull request #5605:
URL: https://github.com/apache/incubator-pinot/pull/5605#discussion_r445145735
##########
File path:
pinot-core/src/main/java/org/apache/pinot/core/query/reduce/GroupByDataTableReducer.java
##########
@@ -486,69 +447,44 @@ private void setGroupByResults(BrokerResponseNative
brokerResponseNative, boolea
finalResultMaps[i] = finalResultMap;
}
- int aggregationNumsInFinalResult = 0;
- for (int i = 0; i < _numAggregationFunctions; i++) {
- if (aggregationFunctionsSelectStatus[i]) {
- aggregationNumsInFinalResult++;
- }
- }
-
- if (aggregationNumsInFinalResult > 0) {
- String[] finalColumnNames = new String[aggregationNumsInFinalResult];
- Map<String, Comparable>[] finalOutResultMaps = new
Map[aggregationNumsInFinalResult];
- String[] finalResultTableAggNames = new
String[aggregationNumsInFinalResult];
- AggregationFunction[] finalAggregationFunctions = new
AggregationFunction[aggregationNumsInFinalResult];
- int count = 0;
- for (int i = 0; i < _numAggregationFunctions; i++) {
- if (aggregationFunctionsSelectStatus[i]) {
- finalColumnNames[count] = columnNames[i];
- finalOutResultMaps[count] = finalResultMaps[i];
- AggregationFunction aggregationFunction = _aggregationFunctions[i];
- finalResultTableAggNames[count] =
aggregationFunction.getResultColumnName();
- finalAggregationFunctions[count] = aggregationFunction;
- count++;
+ // Trim the final result maps and set them into the broker response.
+ AggregationGroupByTrimmingService aggregationGroupByTrimmingService =
+ new AggregationGroupByTrimmingService(_aggregationFunctions,
_queryContext.getLimit());
+ List<GroupByResult>[] groupByResultLists =
aggregationGroupByTrimmingService.trimFinalResults(finalResultMaps);
+
+ if (_responseFormatSql) {
Review comment:
We should actually consider deleting this. We should not mix PQL with
SQL. This code path is for PQL execution but SQL response format. We should not
let users avail that. Ideally, it should be
SQL query -> SQL execution -> SQL response
PQL query -> PQL execution -> PQL response
The functions in this class are extraordinarily large in size and the code
looks very confusing.
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]