LuciferYang commented on a change in pull request #29434:
URL: https://github.com/apache/spark/pull/29434#discussion_r471067768



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/Row.scala
##########
@@ -314,7 +314,7 @@ trait Row extends Serializable {
    *
    * @throws ClassCastException when data type does not match.
    */
-  def getSeq[T](i: Int): Seq[T] = getAs[Seq[T]](i)
+  def getSeq[T](i: Int): scala.collection.Seq[T] = 
getAs[scala.collection.Seq[T]](i)

Review comment:
       The return type or convert type?There are some things that need to be 
discussed. There are 2 major changes related to scala 2.13:
   
   - Seq` alias representative `scala.collection.immutable.Seq`,  not  
`scala.collection.Seq`
   
   - `WrappedArray.make` method produce `mutable.ArraySeq` instance, not 
`WrappedArray`
   
   Explicit use cast type as `getAs[scala.collection.Seq[T]](i)` because 
`ArrayTpye` all mapped to `scala.collection.Seq` in `RowEncoder`, otherwise, 
the cast will fail because of the actual data type is `mutable.ArraySeq`, the 
affected cases are `RowEncoder should support primitive arrays` and `RowEncoder 
should support primitive arrays` in `RowEncoderSuite`.
   
   Explicit appoint return type to `scala.collection.Seq` because we promise a 
`scala.collection.Seq` in Scala 2.12 and use `Seq` alias will trigger a `toSeq` 
operation, but it can be removed if we are sure  covert to 
`scala.collection.immutable.Seq` doesn't affect the caller's perception.
   
   




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