Skip to content


Creating Instance

SortMergeJoinScanner takes the following to be created:

  • streamedKeyGenerator Projection
  • bufferedKeyGenerator Projection
  • Key Ordering[InternalRow]
  • Streamed RowIterator
  • Buffered RowIterator
  • inMemoryThreshold
  • spillThreshold
  • eagerCleanupResources (() => Unit)
  • onlyBufferFirstMatch flag (default: false)

SortMergeJoinScanner is created when:

  • SortMergeJoinExec physical operator is requested to doExecute (for InnerLike, LeftOuter, RightOuter, LeftSemi, LeftAnti, ExistenceJoin joins)


SortMergeJoinScanner creates an ExternalAppendOnlyUnsafeRowArray (with the given inMemoryThreshold and spillThreshold thresholds) when created.

The ExternalAppendOnlyUnsafeRowArray is requested to add an UnsafeRow in bufferMatchingRows.

The ExternalAppendOnlyUnsafeRowArray is cleared in findNextInnerJoinRows, findNextOuterJoinRows and bufferMatchingRows.


getBufferedMatches: ExternalAppendOnlyUnsafeRowArray

getBufferedMatches returns the bufferedMatches.

getBufferedMatches is used when:


bufferMatchingRows(): Unit


bufferMatchingRows is used when:

Back to top