Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/6454#discussion_r31230729
  
    --- Diff: core/src/main/scala/org/apache/spark/rdd/RDD.scala ---
    @@ -580,7 +580,18 @@ abstract class RDD[T: ClassTag](
        * elements (a, b) where a is in `this` and b is in `other`.
        */
       def cartesian[U: ClassTag](other: RDD[U]): RDD[(T, U)] = withScope {
    -    new CartesianRDD(sc, this, other)
    +    val numPartitions = {
    +      val numExecutors = System.getProperty("spark.executor.instances")
    +
    +      if (numExecutors != null) {
    +        numExecutors.toInt
    +      } else {
    +        sc.defaultMinPartitions
    +      }
    +    }
    +    val coalesced = coalesce(numPartitions, shuffle = true)
    +    val coalescedOther = other.coalesce(numPartitions, shuffle = true)
    +    new CartesianRDD(sc, coalesced, coalescedOther)
    --- End diff --
    
    Have you tried not do `coalesce` before `cartesian`? It seems to me that we 
may slow down due to these 2 extra shuffles.


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