Jirawech Siwawut
02/02/2023, 2:04 AM./bin/sql-client.sh --help
-j,--jar <JAR file> A JAR file to be imported into the
session. The file might contain
user-defined classes needed for the
execution of statements such as
functions, table sources, or sinks.
Can be used multiple times.
For example myudf.jar
import org.apache.flink.table.api.*;
import org.apache.flink.table.functions.ScalarFunction;
import static org.apache.flink.table.api.Expressions.*;
// define function logic
public static class SubstringFunction extends ScalarFunction {
public String eval(String s, Integer begin, Integer end) {
return s.substring(begin, end);
}
}
TableEnvironment env = TableEnvironment.create(...);
// register function
env.createTemporarySystemFunction("SubstringFunction", SubstringFunction.class);Reme Ajayi
02/02/2023, 2:18 AMJirawech Siwawut
02/02/2023, 3:55 AM