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

Lukas Rytz commented on SPARK-27683:
------------------------------------

bq. This makes it hard to create an API method that works in both

Do you see a problem, in genral, if the 2.12 flatMap takes a {{T => 
TraversableOnce[U]}}, while the 2.13 API takes a {{T => IterableOnce[U]}}? I 
think this should be the preferred solution. It might seems simpler if both 
2.12 and 2.13 use the "same" type, e.g. {{scala.collection.Iterable}}, but in 
reality they are not the same either, due to the collections rewrite, and due 
to major-version-incompatibilities in general. And it would change / restrict 
the API for no good reason.

Using {{TraversableOnce}} / {{IterableOnce}} can be achieved either with a type 
alias, or by having separate source files for 2.12 and 2.13. As you mention, 
there's already the {{scala.collection.compat.IterableOnce}} alias in the 
compat library. Alternatively you can use the deprecated 
{{scala.collection.TraversableOnce}} alias that exists in the 2.13 standard 
library. Or you can define your own.

As far as I can see, the disadvantage of using an alias is that it shows up in 
Scaladocs, the API, and in source code. So it's an indirection that users have 
to go through when looking at the API. Version-specific source files would 
avoid that.


> Remove usage of TraversableOnce
> -------------------------------
>
>                 Key: SPARK-27683
>                 URL: https://issues.apache.org/jira/browse/SPARK-27683
>             Project: Spark
>          Issue Type: Sub-task
>          Components: ML, Spark Core, SQL, Structured Streaming
>    Affects Versions: 3.0.0
>            Reporter: Sean Owen
>            Assignee: Sean Owen
>            Priority: Major
>
> As with {{Traversable}}, {{TraversableOnce}} is going away in Scala 2.13. We 
> should use {{IterableOnce}} instead. This one is a bigger change as there are 
> more API methods with the existing signature.



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