korlov42 commented on code in PR #5603:
URL: https://github.com/apache/ignite-3/pull/5603#discussion_r2042073042


##########
modules/sql-engine/src/main/codegen/includes/parserImpls.ftl:
##########
@@ -787,3 +787,39 @@ Boolean SqlKillNoWait():
         return noWait;
     }
 }
+
+/**
+ * Parses an EXPLAIN PLAN statement.
+ */
+SqlNode SqlIgniteExplain() :
+{
+    SqlNode stmt;
+    SqlExplainLevel detailLevel = SqlExplainLevel.EXPPLAN_ATTRIBUTES;
+    SqlExplain.Depth depth;
+    Span s;
+    final SqlExplainFormat format;
+}
+{
+    <EXPLAIN> { s = span(); } <PLAN>
+    [ detailLevel = ExplainDetailLevel() ]
+    depth = ExplainDepth()
+    (
+        LOOKAHEAD(2)
+        <AS> <XML> { format = SqlExplainFormat.XML; }
+    |
+        LOOKAHEAD(2)
+        <AS> <JSON> { format = SqlExplainFormat.JSON; }
+    |
+        <AS> <DOT_FORMAT> { format = SqlExplainFormat.DOT; }

Review Comment:
   It's enough to use it for first two options.
   
   LOOKAHEAD is used when you have several options with the same prefix. For 
instance, without LA(2) parser will choose `<AS> <XML>` as soon as it see 
`<AS>` token. With LA(2) it check the next token as well. Given that there is 
nothing to choose from after `<AS> <DOT_FORMAT>` it is OK to omit LA(2)



-- 
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: notifications-unsubscr...@ignite.apache.org

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

Reply via email to