[jira] [Commented] (CALCITE-2046) Support "CREATE FUNCTION" DDL
[ https://issues.apache.org/jira/browse/CALCITE-2046?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16399432#comment-16399432 ] Shuyi Chen commented on CALCITE-2046: - I think we need another Jira [CREATE FUNCTION|https://my.vertica.com/docs/7.2.x/HTML/index.htm#Authoring/SQLReferenceManual/Statements/CREATEFUNCTIONUDF.htm] support. Also, to load external libraries for code generation when compiling, do you have any suggestions? I look through the documentation and code, the only solution I can find is to use the ICookable.setParentClassLoader to replace the classloader with another one that has the external libraries loaded. I'll appreciate your insight. > Support "CREATE FUNCTION" DDL > - > > Key: CALCITE-2046 > URL: https://issues.apache.org/jira/browse/CALCITE-2046 > Project: Calcite > Issue Type: New Feature >Reporter: Shuyi Chen >Assignee: Shuyi Chen >Priority: Major > > We want to add DDL support for creating external function like Apache Drill > ([https://drill.apache.org/docs/create-function-using-jar/]). > {code:java} > CREATE FUNCTION USING JAR '.jar'; > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-2046) Support "CREATE FUNCTION" DDL
[ https://issues.apache.org/jira/browse/CALCITE-2046?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16399228#comment-16399228 ] Julian Hyde commented on CALCITE-2046: -- Maybe we don't need JAR or JARS. Following [Vertica|https://my.vertica.com/docs/7.2.x/HTML/index.htm#Authoring/SQLReferenceManual/Statements/CREATELIBRARY.htm], let's have: {code}CREATE [OR REPLACE] LIBRARY [schema.]library-name AS 'library-path' [ DEPENDS 'support-path' [, 'support-path' ]* ] [ LANGUAGE 'language' ]{code} (as Vertica, but allowing more than one support path) for example: {code}CREATE OR REPLACE mySchema.myLib AS '/foo/myLib.jar' DEPENDS '/foo/guava-23.0.jar', '/foo/jackson-2.9.jar' LANGUAGE 'Java'{code} > Support "CREATE FUNCTION" DDL > - > > Key: CALCITE-2046 > URL: https://issues.apache.org/jira/browse/CALCITE-2046 > Project: Calcite > Issue Type: New Feature >Reporter: Shuyi Chen >Assignee: Shuyi Chen >Priority: Major > > We want to add DDL support for creating external function like Apache Drill > ([https://drill.apache.org/docs/create-function-using-jar/]). > {code:java} > CREATE FUNCTION USING JAR '.jar'; > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-2046) Support "CREATE FUNCTION" DDL
[ https://issues.apache.org/jira/browse/CALCITE-2046?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16397769#comment-16397769 ] Shuyi Chen commented on CALCITE-2046: - Also keyword seems to be somehow reserved that I can't use for CREATE LIBRARY. I will use instead. What do you think? > Support "CREATE FUNCTION" DDL > - > > Key: CALCITE-2046 > URL: https://issues.apache.org/jira/browse/CALCITE-2046 > Project: Calcite > Issue Type: New Feature >Reporter: Shuyi Chen >Assignee: Shuyi Chen >Priority: Major > > We want to add DDL support for creating external function like Apache Drill > ([https://drill.apache.org/docs/create-function-using-jar/]). > {code:java} > CREATE FUNCTION USING JAR '.jar'; > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-2046) Support "CREATE FUNCTION" DDL
[ https://issues.apache.org/jira/browse/CALCITE-2046?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16383271#comment-16383271 ] Shuyi Chen commented on CALCITE-2046: - Hi [~julianhyde], similar to "CREATE TYPE", I am thinking maybe we need add library into the JSON model as well, and keep the fullClassPath for each library added, and this is used to remove all added functions when drop or alter is invoked. What do you think? > Support "CREATE FUNCTION" DDL > - > > Key: CALCITE-2046 > URL: https://issues.apache.org/jira/browse/CALCITE-2046 > Project: Calcite > Issue Type: New Feature >Reporter: Shuyi Chen >Assignee: Shuyi Chen >Priority: Major > > We want to add DDL support for creating external function like Apache Drill > ([https://drill.apache.org/docs/create-function-using-jar/]). > {code:java} > CREATE FUNCTION USING JAR '.jar'; > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-2046) Support "CREATE FUNCTION" DDL
[ https://issues.apache.org/jira/browse/CALCITE-2046?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16361279#comment-16361279 ] Julian Hyde commented on CALCITE-2046: -- Yes, at some point. I think that two cases are higher priority: (1) loading all functions from an external library (self-describing, so we don't need DDL for each individual function), (2) CREATE FUNCTION with SQL as the language (since it's SQL it can just be inlined into the query). But I wouldn't turn down a pull request for "CREATE FUNCTION ... AS LANGUAGE ..."! > Support "CREATE FUNCTION" DDL > - > > Key: CALCITE-2046 > URL: https://issues.apache.org/jira/browse/CALCITE-2046 > Project: Calcite > Issue Type: New Feature >Reporter: Shuyi Chen >Assignee: Shuyi Chen >Priority: Major > > We want to add DDL support for creating external function like Apache Drill > ([https://drill.apache.org/docs/create-function-using-jar/]). > {code:java} > CREATE FUNCTION USING JAR '.jar'; > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-2046) Support "CREATE FUNCTION" DDL
[ https://issues.apache.org/jira/browse/CALCITE-2046?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16347775#comment-16347775 ] Julian Hyde commented on CALCITE-2046: -- We already have Function, ScalarFunction, AggregateFunction and TableFunction in org.apache.calcite.schema. Are they sufficient? (There is some documentation in http://calcite.apache.org/docs/adapter.html#functions-and-operators, but to really understand how to use them, read UdfTest.) We can also load classes and methods as UDFs even if they do not implement an interface. Perhaps we could add an interface Extension and add some annotations to indicate which methods to load as functions. (This should be a secondary task.) As I said previously, I don't like {{CREATE FUNCTION ... USING JAR}} because it doesn't create one function, it creates several. Oracle has {{CREATE LIBRARY}}, so how about the following? {code}CREATE LIBRARY libraryName AS fullClassPath USING JAR 'jarPath' [, 'jarPath' ]...{code} It creates a named object so we could add {{ALTER LIBRARY}} and {{DROP LIBRARY}} later, to implement a full life-cycle. > Support "CREATE FUNCTION" DDL > - > > Key: CALCITE-2046 > URL: https://issues.apache.org/jira/browse/CALCITE-2046 > Project: Calcite > Issue Type: New Feature >Reporter: Shuyi Chen >Assignee: Julian Hyde >Priority: Major > > We want to add DDL support for creating external function like Apache Drill > ([https://drill.apache.org/docs/create-function-using-jar/]). > {code:java} > CREATE FUNCTION USING JAR '.jar'; > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-2046) Support "CREATE FUNCTION" DDL
[ https://issues.apache.org/jira/browse/CALCITE-2046?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16275140#comment-16275140 ] Julian Hyde commented on CALCITE-2046: -- By the way, I think we should also support a more traditional "CREATE FUNCTION", e.g. {code} CREATE FUNCTION plus(INTEGER x, INTEGER y) RETURNS INTEGER AS BEGIN RETURN x + y; END; {code} > Support "CREATE FUNCTION" DDL > - > > Key: CALCITE-2046 > URL: https://issues.apache.org/jira/browse/CALCITE-2046 > Project: Calcite > Issue Type: New Feature >Reporter: Shuyi Chen >Assignee: Julian Hyde > > We want to add DDL support for creating external function like Apache Drill > ([https://drill.apache.org/docs/create-function-using-jar/]). > {code:java} > CREATE FUNCTION USING JAR '.jar'; > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (CALCITE-2046) Support "CREATE FUNCTION" DDL
[ https://issues.apache.org/jira/browse/CALCITE-2046?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16275138#comment-16275138 ] Julian Hyde commented on CALCITE-2046: -- The functionality in {{CREATE FUNCTION USING JAR}} is reasonable but it's not the syntax I would have chosen - because it creates lots of functions, not one. Are there other DBs besides Drill that allow you to import functions (or other plug-ins) from a JAR, and if so, what syntax do they use? Also, how would you propose to implement this? Would you use a class-loader which reads from a modified class-path, or would you copy from the jar into the existing class-path? How would Calcite scan the JAR file to find UDFs? Is some kind of manifest required in the JAR file? > Support "CREATE FUNCTION" DDL > - > > Key: CALCITE-2046 > URL: https://issues.apache.org/jira/browse/CALCITE-2046 > Project: Calcite > Issue Type: New Feature >Reporter: Shuyi Chen >Assignee: Julian Hyde > > We want to add DDL support for creating external function like Apache Drill > ([https://drill.apache.org/docs/create-function-using-jar/]). > {code:java} > CREATE FUNCTION USING JAR '.jar'; > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (CALCITE-2046) Support "CREATE FUNCTION" DDL
[ https://issues.apache.org/jira/browse/CALCITE-2046?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16272218#comment-16272218 ] Shuyi Chen commented on CALCITE-2046: - Hi [~julianhyde], any thought on this? > Support "CREATE FUNCTION" DDL > - > > Key: CALCITE-2046 > URL: https://issues.apache.org/jira/browse/CALCITE-2046 > Project: Calcite > Issue Type: New Feature >Reporter: Shuyi Chen >Assignee: Julian Hyde > > We want to add DDL support for creating external function like Apache Drill > ([https://drill.apache.org/docs/create-function-using-jar/]). > {code:java} > CREATE FUNCTION USING JAR '.jar'; > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (CALCITE-2046) Support "CREATE FUNCTION" DDL
[ https://issues.apache.org/jira/browse/CALCITE-2046?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16248806#comment-16248806 ] Julian Hyde commented on CALCITE-2046: -- As CALCITE-2045, it makes sense do add it to the "server" module and parser being added in CALCITE-707. > Support "CREATE FUNCTION" DDL > - > > Key: CALCITE-2046 > URL: https://issues.apache.org/jira/browse/CALCITE-2046 > Project: Calcite > Issue Type: New Feature >Reporter: Shuyi Chen >Assignee: Julian Hyde > -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (CALCITE-2046) Support "CREATE FUNCTION" DDL
[ https://issues.apache.org/jira/browse/CALCITE-2046?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16248030#comment-16248030 ] Shuyi Chen commented on CALCITE-2046: - Hi [~julianhyde], what do you think of supporting this in Calcite DDL? > Support "CREATE FUNCTION" DDL > - > > Key: CALCITE-2046 > URL: https://issues.apache.org/jira/browse/CALCITE-2046 > Project: Calcite > Issue Type: New Feature >Reporter: Shuyi Chen >Assignee: Julian Hyde > -- This message was sent by Atlassian JIRA (v6.4.14#64029)