Github user davies commented on a diff in the pull request: https://github.com/apache/spark/pull/7417#discussion_r38483827 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/joins/CartesianProduct.scala --- @@ -27,16 +27,27 @@ import org.apache.spark.sql.execution.{BinaryNode, SparkPlan} * :: DeveloperApi :: */ @DeveloperApi -case class CartesianProduct(left: SparkPlan, right: SparkPlan) extends BinaryNode { +case class CartesianProduct( + left: SparkPlan, + right: SparkPlan, + buildSide: BuildSide) extends BinaryNode { override def output: Seq[Attribute] = left.output ++ right.output + private val (small, big) = buildSide match { + case BuildRight => (left, right) + case BuildLeft => (right, left) + } + protected override def doExecute(): RDD[InternalRow] = { - val leftResults = left.execute().map(_.copy()) - val rightResults = right.execute().map(_.copy()) + val leftResults = small.execute().map(_.copy()) + val rightResults = big.execute().map(_.copy()) --- End diff -- I think we could use zipPartition() here, similar to ShuffleHashJoin, then we don't need to copy the bigger stream.
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org