Description
Supported engines: Presto and SparkSQL
Purpose: Create a function that is implemented by the class name.
Statement
CREATE FUNCTION [db_name.]function_name AS class_name
[USING JAR|FILE|ARCHIVE 'file_uri' [, JAR|FILE|ARCHIVE 'file_uri'] ];
CREATE FUNCTION [db_name].function_udtf AS class_name
[USING JAR|FILE|ARCHIVE 'file_uri' [, JAR|FILE|ARCHIVE 'file_uri'] ];
Parameter
[db_name.]function_name
: Function name. The namespace is specified to be in the database represented by db_name
during function creation.
class_name
: Implementation class of the function.
USING JAR|FILE|ARCHIVE 'file_uri'
: Path to resources used for function creation.
Example
CREATE FUNCTION `MYFUNC` AS 'myclass' USING JAR 'hdfs:///path/to/jar'
CREATE FUNCTION `MYFUNC` AS 'myclass' USING JAR 'hdfs:///path/to/jar', FILE 'file:///usr/local/'
Was this page helpful?