924060929 commented on code in PR #44604:
URL: https://github.com/apache/doris/pull/44604#discussion_r1857868045


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalWindow.java:
##########
@@ -215,13 +218,34 @@ && child(0).child(0) instanceof LogicalPartitionTopN)) {
         long chosenPartitionLimit = Long.MAX_VALUE;
         long chosenRowNumberPartitionLimit = Long.MAX_VALUE;
         boolean hasRowNumber = false;
+        long atLeastLimit = -1;
         for (NamedExpression windowExpr : windowExpressions) {
             if (windowExpr == null || windowExpr.children().size() != 1
                     || !(windowExpr.child(0) instanceof WindowExpression)) {
                 continue;
             }
             WindowExpression windowFunc = (WindowExpression) 
windowExpr.child(0);
 
+            Optional<WindowFrame> windowFrame = windowFunc.getWindowFrame();
+            if (windowFrame.isPresent()) {
+                WindowFrame frame = windowFrame.get();
+                FrameUnitsType frameUnits = frame.getFrameUnits();
+                FrameBoundary rightBoundary = frame.getRightBoundary();
+                if (rightBoundary.getFrameBoundType() == 
FrameBoundType.UNBOUNDED_FOLLOWING) {
+                    return null;
+                } else if (frameUnits == FrameUnitsType.ROWS

Review Comment:
   range frame only support `RANGE CURRENT UNBOUNDED PRECEDING AND UNBOUNDED 
FOLLOWING` , `RANGE CURRENT ROW AND UNBOUNDED FOLLOWING` and `RANGE UNBOUNDED 
PRECEDING AND CURRENT ROW`, we should skip in the first two cases



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to