Jackie-Jiang commented on a change in pull request #7959:
URL: https://github.com/apache/pinot/pull/7959#discussion_r796107897
##########
File path:
pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java
##########
@@ -1487,6 +1498,33 @@ static void updateColumnNames(String rawTableName,
PinotQuery pinotQuery, boolea
}
}
+ private static void expandStarExpressionsToActualColumns(PinotQuery
pinotQuery, Map<String, String> columnNameMap,
+ Expression selectStarExpr) {
+ List<Expression> originalSelections = pinotQuery.getSelectList();
+ //expand '*'
+ List<Expression> expandedSelections = new ArrayList<>();
+ for (String tableCol : columnNameMap.values()) {
+ Expression newSelection =
RequestUtils.createIdentifierExpression(tableCol);
+ //we exclude default virtual columns
+ if (tableCol.charAt(0) != '$') {
+ expandedSelections.add(newSelection);
+ }
+ }
+ //sort naturally
+ expandedSelections.sort(null);
+ ListIterator<Expression> li = originalSelections.listIterator();
Review comment:
Modifying the existing list can be expensive (keep shifting the values).
We can create a new list to replace the original one
##########
File path:
pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java
##########
@@ -1459,8 +1460,18 @@ static void updateColumnNames(String rawTableName,
PinotQuery pinotQuery, boolea
Map<String, String> columnNameMap) {
Map<String, String> aliasMap = new HashMap<>();
if (pinotQuery != null) {
+ Expression selectStarExpr = null;
Review comment:
No need to store and pass this expression. This can be changed to a
boolean field `hasSelectStar`. We can add a constant for `*` identifier, and
the compare can be simplified to `expression.equals(STAR)`
##########
File path:
pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java
##########
@@ -1487,6 +1498,33 @@ static void updateColumnNames(String rawTableName,
PinotQuery pinotQuery, boolea
}
}
+ private static void expandStarExpressionsToActualColumns(PinotQuery
pinotQuery, Map<String, String> columnNameMap,
+ Expression selectStarExpr) {
Review comment:
Same here, no need to pass in this expression. Use constant instead
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]