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


##########
fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4:
##########
@@ -119,6 +119,12 @@ sortItem
     :  expression ordering = (ASC | DESC)?
     ;
 
+limitClause
+    : (LIMIT limit=INTEGER_VALUE)?
+    | (LIMIT limit=INTEGER_VALUE OFFSET offset=INTEGER_VALUE)?
+    | (LIMIT offset=INTEGER_VALUE COMMA limit=INTEGER_VALUE)?
+    ;

Review Comment:
   why not set sortClause and limitClause to optional?
   so you don't have to check limit is present in visitLimitClause
   ```antlr4
   queryOrganization
       : sortClause? limitClause?
       ;
   
   sortClause
       : (ORDER BY sortItem (',' sortItem)*)
       ;
   
   sortItem
       :  expression ordering = (ASC | DESC)
       ;
   
   limitClause
       : (LIMIT limit=INTEGER_VALUE)
       | (LIMIT limit=INTEGER_VALUE OFFSET offset=INTEGER_VALUE)
       | (LIMIT offset=INTEGER_VALUE COMMA limit=INTEGER_VALUE)
       ;
   ```



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