Jackie-Jiang commented on code in PR #12047:
URL: https://github.com/apache/pinot/pull/12047#discussion_r1411204796


##########
pinot-common/src/main/java/org/apache/pinot/sql/parsers/rewriter/ExprMinMaxRewriter.java:
##########
@@ -107,7 +108,8 @@ private void appendParentExprMinMaxFunctions(boolean isMax, 
List<Expression> sel
       operands.add(RequestUtils.getLiteralExpression((int) 
exprMinMaxFunctionIDMap.get(measuringColumns)));
       operands.add(RequestUtils.getLiteralExpression(measuringColumns.size()));
       operands.addAll(measuringColumns);
-      operands.addAll(projectionColumns);
+      Set<Expression> sortedProjectionColumns = new 
TreeSet<>(projectionColumns);

Review Comment:
   This is adding overhead to production code. Since the set is in general 
small, you may directly create `TreeSet` at first place (on line 169). To be 
more concise, you may change the code as following:
   ```
       boolean added = 
exprMinMaxFunctionMap.computeIfAbsent(exprMinMaxMeasuringExpressions, k -> new 
TreeSet<>())
           .add(exprMinMaxProjectionExpression);
   ```



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

Reply via email to