pinot-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-pinot] fx19880617 commented on a change in pull request #5033: Set alias name in resultTable schema names
Date Mon, 03 Feb 2020 21:04:43 GMT
fx19880617 commented on a change in pull request #5033: Set alias name in resultTable schema
names
URL: https://github.com/apache/incubator-pinot/pull/5033#discussion_r374340165
 
 

 ##########
 File path: pinot-core/src/main/java/org/apache/pinot/core/query/reduce/BrokerReduceService.java
 ##########
 @@ -178,7 +185,45 @@ public BrokerResponseNative reduceOnDataTable(BrokerRequest brokerRequest,
     }
 
     DataTableReducer dataTableReducer = ResultReducerFactory.getResultReducer(brokerRequest);
-    dataTableReducer.reduceAndSetResults(tableName, cachedDataSchema, dataTableMap, brokerResponseNative,
brokerMetrics);
+    dataTableReducer
+        .reduceAndSetResults(tableName, cachedDataSchema, dataTableMap, brokerResponseNative,
brokerMetrics);
+    updateAliasToSchemaName(brokerRequest, brokerResponseNative);
     return brokerResponseNative;
   }
-}
+
+  private static void updateAliasToSchemaName(BrokerRequest brokerRequest, BrokerResponseNative
brokerResponseNative) {
+    if (brokerRequest.getPinotQuery() == null) {
+      return;
+    }
+    QueryOptions queryOptions = new QueryOptions(brokerRequest.getQueryOptions());
+    if (!queryOptions.isResponseFormatSQL()) {
+      return;
+    }
+    DataSchema dataSchema = brokerResponseNative.getResultTable().getDataSchema();
+    List<Expression> selectList = brokerRequest.getPinotQuery().getSelectList();
+    String[] columnNames = dataSchema.getColumnNames();
+    if (columnNames.length != selectList.size()) {
 
 Review comment:
   Good point, will remove this logging

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Mime
View raw message