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

    https://github.com/apache/spark/pull/8579#discussion_r38788635
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/joins/SortMergeOuterJoin.scala
 ---
    @@ -271,3 +297,203 @@ private class RightOuterIterator(
     
       override def getRow: InternalRow = resultProj(joinedRow)
     }
    +
    +private class SortMergeFullJoinScanner(
    +    leftKeyGenerator: Projection,
    +    rightKeyGenerator: Projection,
    +    keyOrdering: Ordering[InternalRow],
    +    leftIter: RowIterator,
    +    numLeftRows: LongSQLMetric,
    +    rightIter: RowIterator,
    +    numRightRows: LongSQLMetric,
    +    boundCondition: InternalRow => Boolean,
    +    leftNullRow: InternalRow,
    +    rightNullRow: InternalRow)  {
    +  private[this] val joinedRow: JoinedRow = new JoinedRow()
    +  private[this] var leftRow: InternalRow = _
    +  private[this] var leftRowKey: InternalRow = _
    +  private[this] var rightRow: InternalRow = _
    +  private[this] var rightRowKey: InternalRow = _
    +
    +  private[this] var leftIndex: Int = 0
    +  private[this] var rightIndex: Int = 0
    +  private[this] val leftMatches: ArrayBuffer[InternalRow] = new 
ArrayBuffer[InternalRow]
    +  private[this] val rightMatches: ArrayBuffer[InternalRow] = new 
ArrayBuffer[InternalRow]
    +  private[this] var leftMatched: BitSet = new BitSet(1)
    +  private[this] var rightMatched: BitSet = new BitSet(1)
    +
    +  advancedLeft()
    +  advancedRight()
    +
    +  // --- Private methods 
--------------------------------------------------------------------------
    +
    +  /**
    +   * Advance the left iterator and compute the new row's join key.
    +   * @return true if the left iterator returned a row and false otherwise.
    +   */
    +  private def advancedLeft(): Boolean = {
    +    if (leftIter.advanceNext()) {
    +      leftRow = leftIter.getRow
    +      leftRowKey = leftKeyGenerator(leftRow)
    +      numLeftRows += 1
    +      true
    +    } else {
    +      leftRow = null
    +      leftRowKey = null
    +      false
    +    }
    +  }
    +
    +  /**
    +   * Advance the right iterator and compute the new row's join key.
    +   * @return true if the right iterator returned a row and false otherwise.
    +   */
    +  private def advancedRight(): Boolean = {
    +    if (rightIter.advanceNext()) {
    +      rightRow = rightIter.getRow
    +      rightRowKey = rightKeyGenerator(rightRow)
    +      numRightRows += 1
    +      true
    +    } else {
    +      rightRow = null
    +      rightRowKey = null
    +      false
    +    }
    +  }
    +
    +  /**
    +   * Consume rows from both iterators until their key are different than 
matchingKey.
    --- End diff --
    
    until their keys are different from the provided `matchingKey`


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