Create Function


This documentation has been retired and might not be updated. The products, services, or technologies mentioned in this content are no longer supported. See CREATE FUNCTION (SQL and Python).

CREATE [TEMPORARY] FUNCTION [db_name.]function_name AS class_name
  [USING resource [, ...] ]

  : [JAR|FILE|ARCHIVE] file_uri

Create a function. The specified class for the function must extend either UDF or UDAF in org.apache.hadoop.hive.ql.exec, or one of AbstractGenericUDAFResolver, GenericUDF, or GenericUDTF in org.apache.hadoop.hive.ql.udf.generic. If a function with the same name already exists in the database, an exception will be thrown.


This command is supported only when Hive support is enabled.


The created function is available only in this session and is not be persisted to the underlying metastore, if any. No database name can be specified for temporary functions.

USING resource

The resources that must be loaded to support this function. A list of JAR, file, or archive URIs.