Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20141#discussion_r159579701
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/functions.scala ---
    @@ -3461,13 +3485,172 @@ object functions {
         if (nullable) udf else udf.asNonNullable()
       }
     
    +  
//////////////////////////////////////////////////////////////////////////////////////////////
    +  // Java UDF functions
    +  
//////////////////////////////////////////////////////////////////////////////////////////////
    +
    +  /**
    +   * Defines a Java UDF0 instance as user-defined function (UDF).
    +   * The caller must specify the output data type, and there is no 
automatic input type coercion.
    +   * By default the returned UDF is deterministic, to change it to 
nondeterministic, call the
    +   * API `UserDefinedFunction.asNondeterministic()`.
    +   *
    +   * @group udf_funcs
    +   * @since 2.3.0
    +   */
    +  def udf(f: UDF0[_], returnType: DataType): UserDefinedFunction = {
    +    val func = f.asInstanceOf[UDF0[Any]].call()
    +    UserDefinedFunction(() => func, returnType, inputTypes = None)
    +  }
    +
    +  /**
    +   * Defines a Java UDF1 instance as user-defined function (UDF).
    +   * The caller must specify the output data type, and there is no 
automatic input type coercion.
    +   * By default the returned UDF is deterministic, to change it to 
nondeterministic, call the
    --- End diff --
    
    Nit: `, to` -> `. To`


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to