Updated on 2026-11-06 GMT+08:00

Creating a Function Using SQL

Description

Creates a Remote UDAF for use in Spark job development.

Syntax

1
CREATE FUNCTION [db_name.]function_name AS class_name USING FUNCTIONGRAPH 'urn'

or

1
CREATE OR REPLACE FUNCTION [db_name.]function_name AS class_name USING FUNCTIONGRAPH 'urn'

Requirements

None

Keywords

urn: On the FunctionGraph function list page, locate the function whose URN you want to copy and click Copy URN in the Operation column.

Example

Run the following command to create the UDAFDemo function:

CREATE FUNCTION UDAFDemo AS 'ExampleUDAFHandler' USING FUNCTIONGRAPH 'urn:fss:cn-north-7:330e068af1334c9782f4226acc00a2e2:function:default:test:latest'

Select the corresponding database and queue, enter the SQL statement, and click Execute.