Github user piaozhexiu commented on a diff in the pull request:
https://github.com/apache/spark/pull/8512#discussion_r41662058
--- Diff: core/src/main/scala/org/apache/spark/rdd/UnionRDD.scala ---
@@ -62,6 +64,14 @@ class UnionRDD[T: ClassTag](
var rdds: Seq[RDD[T]])
extends RDD[T](sc, Nil) { // Nil since we implement getDependencies
+ // TODO(davies): configurable
+ if (rdds.length > 10) {
+ // prepare the partitions in parallel (will be cached)
+ val parArray = rdds.toParArray
+ parArray.tasksupport = new ForkJoinTaskSupport(new ForkJoinPool(10))
+ parArray.foreach(_.partitions)
+ }
+
--- End diff --
I actually prefer how it is because if we construct a single collection, we
will need to preserve the global order of partitions across RDDs. But since
parallel collection doesn't guarantee any order, this will be hard to
implement. However, if we cache partitions in RDDs where they belong to, we
don't have to worry about the order.
But I made this logic more explicit by defining a ``lazy val`` of ``Unit``
type that gets called by ``getPartitions``. Hopefully, this addresses your
concerns.
---
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]