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

    https://github.com/apache/spark/pull/17712#discussion_r112801078
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/expressions/UserDefinedFunction.scala
 ---
    @@ -45,14 +45,33 @@ import org.apache.spark.sql.types.DataType
     case class UserDefinedFunction protected[sql] (
         f: AnyRef,
         dataType: DataType,
    -    inputTypes: Option[Seq[DataType]]) {
    +    inputTypes: Option[Seq[DataType]],
    +    name: Option[String]) {
    +
    +  // Optionally used for printing an UDF name in EXPLAIN
    +  def withName(name: String): UserDefinedFunction = {
    +    UserDefinedFunction(f, dataType, inputTypes, Option(name))
    +  }
     
       /**
        * Returns an expression that invokes the UDF, using the given arguments.
        *
        * @since 1.3.0
        */
       def apply(exprs: Column*): Column = {
    -    Column(ScalaUDF(f, dataType, exprs.map(_.expr), 
inputTypes.getOrElse(Nil)))
    +    Column(ScalaUDF(f, dataType, exprs.map(_.expr), 
inputTypes.getOrElse(Nil), name))
    +  }
    +}
    +
    +object UserDefinedFunction {
    --- End diff --
    
    oh, it seems we couldn't add `unapply` there because:
    ```
    [error] 
/Users/maropu/IdeaProjects/spark/spark-master/sql/core/src/main/scala/org/apache/spark/sql/expressions/UserDefinedFunction.scala:45:
 method unapply is defined twic
    e
    [error]   conflicting symbols both originated in file 
'/Users/maropu/IdeaProjects/spark/spark-master/sql/core/src/main/scala/org/apache/spark/sql/expressions/UserDefinedFu
    nction.scala'
    [error] case class UserDefinedFunction protected[sql] (
    [error]            ^
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to