Github user srowen commented on the issue:

    https://github.com/apache/spark/pull/16276
  
    Yes you're hitting a key point, that `flatten` only makes sense on an RDD 
of `TraversableOnce`. I think we'd implement this in the way that 
`DoubleRDDFunctions` adds operations for only RDDs of doubles instead of adding 
this implicit transformation.
    
    In that case you can get an `iterator` directly from each element, and then 
concatenating them. I think it goes something like:
    
    ```
    iter => iter.foldLeft(Iterator.empty)((a,b) => a ++ b.toIterator)
    ```
    
    ... but I'm sure that's not 100% correct.
    
    Anyway the complexity makes me wonder if it's worth doing unless the lack 
of a direct method is a bottleneck. (We could also look at whether Spark 
internally could replace flatMap(x => x) with the new method)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to