kishoreg commented on a change in pull request #5635:
URL: https://github.com/apache/incubator-pinot/pull/5635#discussion_r446690712



##########
File path: 
pinot-core/src/main/java/org/apache/pinot/core/query/request/context/utils/QueryContextUtils.java
##########
@@ -75,6 +78,14 @@ public static boolean isAggregationQuery(QueryContext query) 
{
         return true;
       }
     }
+    if(query.getOrderByExpressions() != null) {

Review comment:
       Since we are adding to aggregationInfo already, we should probably check 
for aggregation info

##########
File path: 
pinot-common/src/main/java/org/apache/pinot/pql/parsers/PinotQuery2BrokerRequestConverter.java
##########
@@ -83,15 +83,30 @@ private void convertOrderBy(PinotQuery pinotQuery, 
BrokerRequest brokerRequest)
       return;
     }
     List<SelectionSort> sortSequenceList = new ArrayList<>();
+    List<AggregationInfo> aggregationInfoList = 
brokerRequest.getAggregationsInfo();
     final List<Expression> orderByList = pinotQuery.getOrderByList();
     for (Expression orderByExpr : orderByList) {
       SelectionSort selectionSort = new SelectionSort();
       //order by is always a function (ASC or DESC)
       Function functionCall = orderByExpr.getFunctionCall();
       
selectionSort.setIsAsc(functionCall.getOperator().equalsIgnoreCase(OrderByAstNode.ASCENDING_ORDER));
-      
selectionSort.setColumn(ParserUtils.standardizeExpression(functionCall.getOperands().get(0),
 true));
+      Expression expression = functionCall.getOperands().get(0);
+      selectionSort.setColumn(ParserUtils.standardizeExpression(expression, 
true));
       sortSequenceList.add(selectionSort);
+
+      if (expression.getType().equals(ExpressionType.FUNCTION) && 
FunctionDefinitionRegistry
+          .isAggFunc(expression.getFunctionCall().getOperator())) {
+        AggregationInfo aggInfo = 
buildAggregationInfo(expression.getFunctionCall());
+        if (aggregationInfoList == null) {
+          aggregationInfoList = new ArrayList<>();
+          aggregationInfoList.add(aggInfo);
+          brokerRequest.setAggregationsInfo(aggregationInfoList);
+        } else if (!aggregationInfoList.contains(aggInfo)) {

Review comment:
       Does this call work?




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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to