vldpyatkov commented on code in PR #13366:
URL: https://github.com/apache/ignite/pull/13366#discussion_r3712614068


##########
modules/calcite/src/main/codegen/includes/parserImpls.ftl:
##########
@@ -816,3 +816,66 @@ SqlDrop SqlDropView(Span s, boolean replace) :
         return SqlDdlNodes.dropView(s.end(this), ifExists, id);
     }
 }
+
+/**
+ * Parses a query optionally followed by FOR UPDATE [OF col [, col ...]] [WAIT 
n | NOWAIT].
+ *
+ * When FOR UPDATE is absent the inner query node is returned unchanged, so 
this rule
+ * transparently handles all queries that reach the StatementParser.
+ */
+SqlNode SqlSelectForUpdate() :
+{
+    final Span s;
+    SqlNode qry;
+    SqlNodeList ofList = null;
+    List<SqlNode> ofCols = null;
+    SqlIdentifier col;
+    Long waitSeconds = null;
+    String waitValue;
+}
+{
+    qry = OrderedQueryOrExpr(ExprContext.ACCEPT_QUERY) { s = span(); }
+    [
+        LOOKAHEAD(<FOR> <UPDATE>)
+        <FOR> <UPDATE>
+        [
+            LOOKAHEAD(<OF>)
+            <OF>
+            {
+                ofCols = new ArrayList<SqlNode>();
+            }
+            col = CompoundIdentifier() { ofCols.add(col); }
+            (
+                <COMMA> col = CompoundIdentifier() { ofCols.add(col); }
+            )*
+            { ofList = new SqlNodeList(ofCols, s.pos()); }
+        ]
+        [
+            LOOKAHEAD(<WAIT>)
+            <WAIT> <UNSIGNED_INTEGER_LITERAL>
+            {
+                waitValue = token.image;
+
+                try {
+                    waitSeconds = Long.parseLong(waitValue);
+                }

Review Comment:
   The previous variant is fit for existing code, but I can rewrite this close 
as you wish)



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

Reply via email to