panbingkun commented on code in PR #44591:
URL: https://github.com/apache/spark/pull/44591#discussion_r1444118744


##########
sql/core/src/test/scala/org/apache/spark/sql/UDFSuite.scala:
##########
@@ -830,6 +831,22 @@ class UDFSuite extends QueryTest with SharedSparkSession {
       Row(ArrayBuffer(100)))
   }
 
+  test("SPARK-46586: UDF should not fail on immutable.ArraySeq") {
+    val myUdf1 = udf((a: immutable.ArraySeq[Int]) =>
+      immutable.ArraySeq.unsafeWrapArray[Int](Array(a.head + 99)))
+    checkAnswer(Seq(Array(1))
+      .toDF("col")
+      .select(myUdf1(Column("col"))),
+    Row(ArrayBuffer(100)))
+
+     val myUdf2 = udf((a: immutable.ArraySeq[Int]) =>
+      
immutable.ArraySeq.unsafeWrapArray[Int](a.appended(5).appended(6).toArray))

Review Comment:
   Okay, let me improve it.



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

To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to