koertkuipers commented on a change in pull request #28645:
URL: https://github.com/apache/spark/pull/28645#discussion_r430571279



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/UDFSuite.scala
##########
@@ -581,4 +581,40 @@ class UDFSuite extends QueryTest with SharedSparkSession {
       .toDF("col1", "col2")
     checkAnswer(df.select(myUdf(Column("col1"), Column("col2"))), Row(2020) :: 
Nil)
   }
+
+  test("case class as element type of Seq/Array") {

Review comment:
       some option tests would be good too. 
   
   option in a simple seq:
   `Seq(Seq(Some(1), None)).toDF.withColumn("value", udf{ s: Seq[Option[Int]] 
=> s.map(_.map(_ + 1)) }.apply(col("value")) )`
   
   option for function argument:
   `Seq(None, Some(1), None).toDF.withColumn("value", udf{ o: Option[Int] => 
o.map(_ + 1) }.apply(col("value")))`
   
   note that the top level option to express nullability is a very common use 
case in particular and supported by encoders. the equivalent in Dataset is:
   `Seq(None, Some(1), None).toDS.map{ o: Option[Int] => o.map(_ + 1) }`
   




----------------------------------------------------------------
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]



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

Reply via email to