HuangZhenQiu commented on a change in pull request #10240: [FLINK-14841][table] 
add create and drop function ddl in SQL parser
URL: https://github.com/apache/flink/pull/10240#discussion_r347725667
 
 

 ##########
 File path: 
flink-table/flink-sql-parser/src/main/codegen/includes/parserImpls.ftl
 ##########
 @@ -177,6 +177,87 @@ SqlDescribeDatabase SqlDescribeDatabase() :
 
 }
 
+SqlCreate SqlCreateFunction(Span s, boolean replace) :
+{
+    SqlIdentifier functionName = null;
+    SqlCharStringLiteral functionClassName = null;
+    String functionLanguage = null;
+    boolean ifNotExists = false;
+    boolean hasTemporary = false;
+    boolean isSystemFunction = false;
+}
+{
+    [
+        <TEMPORARY>   {hasTemporary = true;}
+        (
+            <SYSTEM>   { isSystemFunction = true; }
+        |
+            {isSystemFunction = false; }
+        )
+    ]
+    <FUNCTION>
+    (
+        <IF> <NOT> <EXISTS> { ifNotExists = true; }
+    |
+        { ifNotExists = false; }
+    )
+    functionName = CompoundIdentifier()
+    <AS> <QUOTED_STRING> {
+        String p = SqlParserUtil.parseString(token.image);
+        functionClassName = SqlLiteral.createCharString(p, getPos());
+    }
+    [<LANGUAGE>
+        (
+            <JAVA>  { functionLanguage = "JAVA"; }
+        |
+            <SCALA> { functionLanguage = "SCALA"; }
+        |
+            <SQL>   { functionLanguage = "SQL"; }
+        )
+    ]
+    {
+        return new SqlCreateFunction(s.pos(), functionName, functionClassName, 
functionLanguage,
+                ifNotExists, hasTemporary, isSystemFunction);
+    }
+}
+
+SqlDrop SqlDropFunction(Span s, boolean replace) :
+{
+    SqlIdentifier functionName = null;
+    String functionLanguage = null;
+    boolean ifExists = false;
+    boolean hasTemporary = false;
 
 Review comment:
   Yes

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