Jackie-Jiang commented on a change in pull request #5661: URL: https://github.com/apache/incubator-pinot/pull/5661#discussion_r451152552
########## File path: pinot-core/src/main/java/org/apache/pinot/core/operator/query/SelectionOrderByOperator.java ########## @@ -143,24 +167,134 @@ public SelectionOrderByOperator(IndexSegment indexSegment, QueryContext queryCon @Override protected IntermediateResultsBlock getNextBlock() { - TransformBlock transformBlock; - while ((transformBlock = _transformOperator.nextBlock()) != null) { - int numExpressions = _expressions.size(); + int numExpressions = _expressions.size(); + int numOrderByExpressions = _orderByExpressions.size(); + + if (numExpressions == numOrderByExpressions) { Review comment: Both order-by and selected expressions can be identifiers or functions. Expressions here are order-by expressions followed by non-order-by expressions (deduplicated, see `SelectionOperatorUtils.extractExpressions()` for more details. ---------------------------------------------------------------- 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: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org