Github user rxin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/993#discussion_r15334051
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/joins.scala ---
    @@ -300,8 +298,16 @@ case class LeftSemiJoinBNL(
     case class CartesianProduct(left: SparkPlan, right: SparkPlan) extends 
BinaryNode {
       def output = left.output ++ right.output
     
    -  def execute() = 
left.execute().map(_.copy()).cartesian(right.execute().map(_.copy())).map {
    -    case (l: Row, r: Row) => buildRow(l ++ r)
    +  def execute() = {
    +    val leftResults = left.execute().map(_.copy())
    +    val rightResults = right.execute().map(_.copy())
    +
    +    leftResults.cartesian(rightResults).mapPartitions { iter =>
    +      val joinedRow = new JoinedRow
    +      iter.map {
    +        case (l: Row, r: Row) => joinedRow(l, r)
    --- End diff --
    
    maybe perf doesn't matter too much here since it is a cartesian product 
already, but you can remove the pattern matching to improve perf.


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

Reply via email to