Help Center/
MapReduce Service/
Component Operation Guide (LTS) (Paris Region)/
Using Flink/
Using the Flink Web UI/
Managing UDFs on the Flink Web UI/
UDF Java and SQL Examples
Updated on 2022-12-14 GMT+08:00
UDF Java and SQL Examples
UDF Java Example
package com.xxx.udf; import org.apache.flink.table.functions.ScalarFunction; public class UdfClass_UDF extends ScalarFunction { public int eval(String s) { return s.length(); } }
UDF SQL Example
CREATE TEMPORARY FUNCTION udf as 'com.xxx.udf.UdfClass_UDF'; CREATE TABLE udfSource (a VARCHAR) WITH ('connector' = 'datagen','rows-per-second'='1'); CREATE TABLE udfSink (a VARCHAR,b int) WITH ('connector' = 'print'); INSERT INTO udfSink SELECT a, udf(a) FROM udfSource;
Parent topic: Managing UDFs on the Flink Web UI
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot