tencent cloud

Stream Compute Service

Releases Notes and Announcements
Release Notes
Product Introduction
Overview
Strengths
Use Cases
Purchase Guide
Billing Overview
Billing Mode
Refund
Configuration Adjustments
Getting Started
Preparations
Creating a Private Cluster
Creating a SQL Job
Creating a JAR Job
Creating an ETL Job
Creating a Python Job
Operation Guide
Managing Jobs
Developing Jobs
Monitoring Jobs
Job Logs
Events and Diagnosis
Managing Metadata
Managing Checkpoints
Tuning Jobs
Managing Dependencies
Managing Clusters
Managing Permissions
SQL Developer Guide
Overview
Glossary and Data Types
DDL Statements
DML Statements
Merging MySQL CDC Sources
Connectors
SET Statement
Operators and Built-in Functions
Identifiers and Reserved Words
Python Developer Guide
ETL Developer Guide
Overview
Glossary
Connectors
FAQ
Contact Us

CREATE FUNCTION

PDF
포커스 모드
폰트 크기
마지막 업데이트 시간: 2023-11-08 15:12:12
For a SQL job, you can upload a custom package and reference this package when configuring parameters for the job in the console. You can either upload a local package or use resources in the COS buckets (must be in the same region) of the current account.
The package can be used as additional connector features. You can also use it to create user-defined functions (UDFs).

Syntax

Currently, Stream Compute Service supports packages written in Java and Scala. After uploading a custom package and referencing it in the console, you can use the following CREATE FUNCTION statement to declare it:
CREATE TEMPORARY SYSTEM FUNCTION function name
AS 'Full function class name' [LANGUAGE JAVA|SCALA]
You can determine your own function name. Make sure it is unique. Full function class name should be the full name of a Java or Scala class, such as 'com.example.flink.MyCustomFunction'.

Overwriting in case of identical names

If there is a built-in function with the same name, it will be overwritten by the UDF created using the above statement. Therefore, please avoid using a function name that is identical to a built-in function, unless you intend to overwrite the built-in function.

Function types

Flink supports the following functions.

Scalar function

A user-defined scalar function converts one value to another value (one-to-one). Examples include the built-in string handling functions SUBSTRING and REPLACE.

Table function

A user-defined table function converts a value to a row of data (one-to-many) so that it can be used as the right table in JOIN operations.

Aggregate function

A user-defined aggregate function aggregates a set of values from multiple data rows into one value (many-to-one). Examples include the built-in functions MAX, MIN, and AVG.

Table aggregate function

A table aggregate function aggregates a set of values from multiple data rows into a new set of data rows (many-to-many).

Async table function

An async table function can be used as a special data source. For example, you can use it to connect to an external database or storage.

UDF development

Flink updates its APIs and documentation on a regular basis. For details, see the Flink document User-defined Functions. Stream Compute Service is compatible with the APIs of the open-source Flink 1.11.

도움말 및 지원

문제 해결에 도움이 되었나요?

피드백