Jackie-Jiang 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_r374259052
##########
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:
How about `SELECT *`?
----------------------------------------------------------------
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
|