[ 
https://issues.apache.org/jira/browse/SPARK-27681?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16839280#comment-16839280
 ] 

Lukas Rytz commented on SPARK-27681:
------------------------------------

I think the best solution for 2.13, if we forget about 2.12, would be to look 
at uses of {{scala.Seq}} individually.

Methods with a Seq parameter can continue to accept {{collection.Seq}} if that 
makes sense, i.e., if the implementation can work fine with mutable Seqs. If 
that's not the case and {{collection.Seq}} was used accidentally, the method 
should probably be deprecated.

When used as result type, it would be better to replace it by {{immutable.Seq}} 
if the result is actually immutable. A more precise type is good in general, 
and it makes sure that the result is still compatible with {{scala.Seq}}, which 
a user might expect, as noted by [~vanzin] above.

Unfortunately, changing the result type is *not* binary compatible, so it 
cannot be done in a 2.12 minor release of Spark. If there will be separate 
source files for 2.12 and 2.13, you could use a type alias that points to 
{{collection.Seq}} in 2.12, and to {{immutable.Seq}} in 2.13, and use  it in 
these cases. Otherwise, the only solution is to use {{collection.Seq}} 
everywhere.

Or maybe the Spark version that will actually cross-build with 2.13 does need 
to be binary compatible on 2.12? In this case, using a more precise return type 
would be good for 2.12 as well.

> Use scala.collection.Seq explicitly instead of scala.Seq alias
> --------------------------------------------------------------
>
>                 Key: SPARK-27681
>                 URL: https://issues.apache.org/jira/browse/SPARK-27681
>             Project: Spark
>          Issue Type: Sub-task
>          Components: ML, MLlib, Spark Core, SQL, Structured Streaming
>    Affects Versions: 3.0.0
>            Reporter: Sean Owen
>            Assignee: Sean Owen
>            Priority: Major
>
> {{scala.Seq}} is widely used in the code, and is an alias for 
> {{scala.collection.Seq}} in Scala 2.12. It will become an alias for 
> {{scala.collection.immutable.Seq}} in Scala 2.13. In many cases, this will be 
> fine, as Spark users using Scala 2.13 will also have this changed alias. In 
> some cases it may be undesirable, as it will cause some code to compile in 
> 2.12 but not in 2.13. In some cases, making the type {{scala.collection.Seq}} 
> explicit so that it doesn't vary can help avoid this, so that Spark apps 
> might cross-compile for 2.12 and 2.13 with the same source.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to