cloud-fan commented on code in PR #44591:
URL: https://github.com/apache/spark/pull/44591#discussion_r1443045581
##########
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:
super nit: isn't it more common to use `:+` to create new immutable
collection with new elements?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]