npawar commented on a change in pull request #4877: Results in ResultTable if 
responseFormat=sql
URL: https://github.com/apache/incubator-pinot/pull/4877#discussion_r353523914
 
 

 ##########
 File path: 
pinot-core/src/main/java/org/apache/pinot/core/query/reduce/AggregationDataTableReducer.java
 ##########
 @@ -41,33 +45,46 @@
 public class AggregationDataTableReducer implements DataTableReducer {
 
   private final AggregationFunction[] _aggregationFunctions;
+  private final List<AggregationInfo> _aggregationInfos;
+  private final int _numAggregationFunctions;
   private final boolean _preserveType;
+  private boolean _responseFormatSql;
 
   AggregationDataTableReducer(BrokerRequest brokerRequest, 
AggregationFunction[] aggregationFunctions,
       QueryOptions queryOptions) {
     _aggregationFunctions = aggregationFunctions;
+    _aggregationInfos = brokerRequest.getAggregationsInfo();
+    _numAggregationFunctions = aggregationFunctions.length;
     _preserveType = queryOptions.isPreserveType();
+    _responseFormatSql = queryOptions.isResponseFormatSQL();
   }
 
   /**
-   * Reduces data tables and sets aggregations results into 
BrokerResponseNative::AggregationResults
+   * Reduces data tables and sets aggregations results into
+   * 1. ResultTable if _responseFormatSql is true
+   * 2. AggregationResults by default
    */
   @Override
-  public void reduceAndSetResults(String tableName, DataSchema dataSchema, 
Map<ServerRoutingInstance, DataTable> dataTableMap,
-      BrokerResponseNative brokerResponseNative, BrokerMetrics brokerMetrics) {
+  public void reduceAndSetResults(String tableName, DataSchema dataSchema,
+      Map<ServerRoutingInstance, DataTable> dataTableMap, BrokerResponseNative 
brokerResponseNative,
+      BrokerMetrics brokerMetrics) {
+
     if (dataTableMap.isEmpty()) {
+      if (_responseFormatSql) {
 
 Review comment:
   I tried to add another layer of abstraction for sql vs pql. The group by 
code got very messy. There's a lot of code that needs to be shared across the 
two. 
   I can try it again, but would prefer to revisit after this much is merged. 
That'll make it easier to code and also review

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