cloud-fan commented on a change in pull request #27937: [SPARK-30127][SQL] 
Support case class parameter for typed Scala UDF
URL: https://github.com/apache/spark/pull/27937#discussion_r395490695
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/UDFRegistration.scala
 ##########
 @@ -200,8 +200,8 @@ class UDFRegistration private[sql] (functionRegistry: 
FunctionRegistry) extends
    */
   def register[RT: TypeTag, A1: TypeTag](name: String, func: Function1[A1, 
RT]): UserDefinedFunction = {
     val ScalaReflection.Schema(dataType, nullable) = 
ScalaReflection.schemaFor[RT]
-    val inputSchemas: Seq[Option[ScalaReflection.Schema]] = 
Try(ScalaReflection.schemaFor[A1]).toOption :: Nil
-    val udf = SparkUserDefinedFunction(func, dataType, 
inputSchemas).withName(name)
+    val inputEncoders: Seq[Option[ExpressionEncoder[_]]] = 
Try(ExpressionEncoder[A1]()).toOption :: Nil
 
 Review comment:
   maybe we can remove `applyOption`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to