You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@asterixdb.apache.org by Dmitry Lychagin <dm...@couchbase.com.INVALID> on 2020/08/08 03:10:12 UTC

New syntax for CREATE FUNCTION/ADAPTER

All,

I just merged the change that modifies CREATE FUNCTION syntax for external functions.
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/7483

Here’s the summary.

  1.  LANGUAGE specification has been remove because the implementation language is a property of the corresponding library, so there’s no need to duplicate it in CREATE FUNCTION.
  2.  Library name is no longer specified in the AS subclause, it has been moved to its own AT subclause.
Also, it’s now an identifier, not a string literal.
E.g. previously: CREATE FUNCTION … AS “testlib”, “package.class.name”
is now specified as:  CREATE FUNCTION … AS “package.class.name” AT testlib
  3.  There’s a new external identifier format for functions written in Python that refer to methods inside classes.
It used to be “module:class”, “method”. Now it’s “module”, “class.method”
E.g. previously: CREATE FUNCTION … LANGUAGE PYTHON AS “testlib”, “module:class”, “method”
Now: CREATE FUNCTION … AS “module”, “class.method” AT testlib
  4.  DETERMINISTIC modifier has been moved into WITH subclause while previous contents of the WITH clause which were user-defined now specified by the “resources” field.
E.g. previously: CREATE FUNCTION …. DETERMINISTIC AS … WITH { "textFieldName": "text" }
Now: CREATE FUNCTION … AS … WITH { “deterministic”: true, “resources”: { "textFieldName": "text" } }

For more information and examples please see the documentation diff:
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/7483/2/asterixdb/asterix-doc/src/main/user-defined_function/udf.md

CREATE ADAPTER syntax has been updated in the same manner:
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/7483/2/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/feeds/feed-with-external-adapter/feed-with-external-adapter.2.ddl.sqlpp

Please update your DDL statements if you were using external functions, and let me know if you have any questions.

Thanks,
-- Dmitry