public class UserDefinedFunction extends Object
UDFRegistration.registerTemporary, UDFRegistration.registerPermanent, or Functions.udf.
Use UserDefinedFunction.apply to generate Column expressions from an instance.
import com.snowflake.snowpark_java.functions;
import com.snowflake.snowpark_java.types.DataTypes;
UserDefinedFunction myUdf = Functions.udf(
(Integer x, Integer y) -> x + y,
new DataType[]{DataTypes.IntegerType, DataTypes.IntegerType},
DataTypes.IntegerType
);
df.select(myUdf.apply(df.col("col2"), df.col("col2")));
| Modifier and Type | Method and Description |
|---|---|
Column |
apply(Column... exprs)
Apply the UDF to one or more columns to generate a Column expression.
|
© 2023 Snowflake Inc. All Rights Reserved