danny0405 commented on a change in pull request #1138: [CALCITE-1581] UDTF like 
in hive
URL: https://github.com/apache/calcite/pull/1138#discussion_r316586419
 
 

 ##########
 File path: core/src/main/codegen/templates/Parser.jj
 ##########
 @@ -1579,15 +1579,38 @@ List<SqlNode> SelectList() :
 SqlNode SelectItem() :
 {
     SqlNode e;
-    final SqlIdentifier id;
+    SqlIdentifier id;
+    final List<SqlNode> ids = new ArrayList();
+    final Span s = span();
 }
 {
     e = SelectExpression()
     [
         [ <AS> ]
-        id = SimpleIdentifier() {
-            e = SqlStdOperatorTable.AS.createCall(span().end(e), e, id);
-        }
+        (
+            (
+              id = SimpleIdentifier()
+              {
+                  e = SqlStdOperatorTable.AS.createCall(s.end(e), e, id);
+              }
+            )
+            |
+            (
+              <LPAREN>
+                 id = SimpleIdentifier()
+                 {
+                    ids.add(id);
+                 }
+                 ( <COMMA> id = SimpleIdentifier() { ids.add(id);} )*
+              <RPAREN>
+              {
+                  if (!this.conformance.allowSelectTableFunction()) {
+                    throw new 
ParseException(RESOURCE.notAllowTableFunctionInSelect().str());
+                  }
 
 Review comment:
   Please do not throw ParseException directly, instead use 
`SqlUtil.newContextException` to have more detailed error message.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to