UserDefinedFunction (Snowpark Java API Reference 1.19.0)

Package com.snowflake.snowpark_java

## Class UserDefinedFunction

- java.lang.Object
- - com.snowflake.snowpark_java.UserDefinedFunction

-     public class UserDefinedFunction
      extends java.lang.Object

  Encapsulates a user defined lambda or function that is returned by `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")));

  Since:
    0.12.0

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Column` | `apply​(Column... exprs)` | Apply the UDF to one or more columns to generate a Column expression.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### apply

          public Column apply​(Column... exprs)

      Apply the UDF to one or more columns to generate a Column expression.
      Parameters:
        `exprs` - The list of expression.
      Returns:
        The result column
      Since:
        0.12.0