deniskuzZ commented on code in PR #6202:
URL: https://github.com/apache/hive/pull/6202#discussion_r2595392690


##########
ql/src/java/org/apache/hadoop/hive/ql/optimizer/LimitPushdownOptimizer.java:
##########
@@ -117,18 +118,31 @@ private static class TopNReducer implements 
SemanticNodeProcessor {
     @Override
     public Object process(Node nd, Stack<Node> stack,
                           NodeProcessorCtx procCtx, Object... nodeOutputs) 
throws SemanticException {
+      boolean hasOnlyOrderByLimit = true;
       ReduceSinkOperator rs = null;
+      boolean shouldBreak = false;

Review Comment:
   Could you please rewrite code without the break flag
   ````
   if (op instanceof GroupByOperator || op instanceof JoinOperator) {
       hasOnlyOrderByLimit = false;
   
       if (rs != null) {
           break; // RS already seen → stop
       }
   
       // No RS yet, skip RS-handling for this iteration
   } else {
       // Case: not GBY/JOIN and RS not yet found
       if (rs == null) {
           if (op.getNumChild() != 1) {
               return false; // multi-GBY single-RS (TODO)
           }
   
           if (op instanceof ReduceSinkOperator) {
               rs = (ReduceSinkOperator) op;
           } else if (!op.acceptLimitPushdown()) {
               return false;
           }
       }
   }
   ````



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