LuciferYang commented on code in PR #44618:
URL: https://github.com/apache/spark/pull/44618#discussion_r1444238701


##########
connector/connect/common/src/main/scala/org/apache/spark/sql/connect/client/arrow/ScalaCollectionUtils.scala:
##########
@@ -34,4 +34,8 @@ private[arrow] object ScalaCollectionUtils {
   def wrap[T](array: AnyRef): mutable.ArraySeq[T] = {
     mutable.ArraySeq.make(array.asInstanceOf[Array[T]])
   }
+
+  def toImmutableArraySeq[T](array: AnyRef): immutable.ArraySeq[T] = {

Review Comment:
   nit: Perhaps we can directly use the implicit conversion defined in 
`ArrayImplicits` instead of add this new function, which is now a more generic 
conversion way in Spark code.



##########
connector/connect/client/jvm/src/test/scala/org/apache/spark/sql/SQLImplicitsTestSuite.scala:
##########
@@ -84,64 +86,74 @@ class SQLImplicitsTestSuite extends ConnectFunSuite with 
BeforeAndAfterAll {
     testImplicit(booleans)
     testImplicit(booleans.toSeq)
     testImplicit(booleans.toSeq)(newBooleanSeqEncoder)
+    testImplicit(immutable.ArraySeq.unsafeWrapArray(booleans))

Review Comment:
   we can just
   ```
   import org.apache.spark.util.ArrayImplicits._
   ```
   at the file header,  and then
   ```
   testImplicit(booleans.toImmutableArraySeq)
   testImplicit(shorts.toImmutableArraySeq)
   ...
   ```



##########
sql/core/src/test/scala/org/apache/spark/sql/UDFSuite.scala:
##########
@@ -840,7 +840,7 @@ class UDFSuite extends QueryTest with SharedSparkSession {
     Row(ArrayBuffer(100)))
 
      val myUdf2 = udf((a: immutable.ArraySeq[Int]) =>
-      
immutable.ArraySeq.unsafeWrapArray[Int](a.appended(5).appended(6).toArray))
+      immutable.ArraySeq.unsafeWrapArray[Int]((a :+ 5 :+ 6).toArray))

Review Comment:
   I think this show be a follow up of 
https://github.com/apache/spark/pull/44591



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

Reply via email to