canner-udf-example provides example for writing scalar UDF in Canner. A scalar function is a function that returns one value per invocation; in most cases, you can think of this as returning one value per row
- In DataMasking.java
mask_column(varchar):varchar
mask_email(varchar,bigint):varchar
- In EncryptDecryptWithKey.java
encrypt(varchar):varbinary
decrypt(varbinary):varchar
In ExtendedHashFunction.java
ripemd_160(varchar):varchar
- In MathOperation.java
math_op(bigint,bigint):bigint
- In TimestampSeqNo.java
seq_no(timestamp(p)):varchar
- In TimestampWithTZSeqNo.java
seq_no(timestamp(p) with time zone):varchar
resources/META-INF/services/io.trino.spi.Plugin
is needed for canner to load the plugin. And the content of this file is the full class name of the plugin class. (i.e. com.canner.udf.UdfPlugin in this example project)- Note that all udf classes (i.e. DataMasking.class, EncryptDecryptWithKey, etc.) are added in
UdfPlugin#getFunctions
. Doing this will make the udfs available in Canner.
- JDK Version: 11+
- run
mvn clean package
- in
{project-root}/target
, you will findudf-1.0-SNAPSHOT-jar-with-dependencies.jar
please rename this file (replace-
with_
) and upload it to the User-Defined Function ( UDF) page