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

    https://github.com/apache/spark/pull/7480#discussion_r35156207
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/joins/HashSemiJoin.scala 
---
    @@ -67,25 +78,34 @@ trait HashSemiJoin {
       }
     
       protected def hashSemiJoin(
    -      streamIter: Iterator[InternalRow],
    -      hashedRelation: HashedRelation): Iterator[InternalRow] = {
    -    val joinKeys = leftKeyGenerator()
    -    val joinedRow = new JoinedRow
    +    streamIter: Iterator[InternalRow],
    +    hashSet: java.util.Set[InternalRow]): Iterator[InternalRow] = {
    +    val joinKeys = leftKeyGenerator
         streamIter.filter(current => {
    -      lazy val rowBuffer = hashedRelation.get(joinKeys.currentValue)
    -      !joinKeys(current).anyNull && rowBuffer != null && rowBuffer.exists {
    -        (build: InternalRow) => boundCondition(joinedRow(current, build))
    -      }
    +      val key = joinKeys(current)
    +      !key.anyNull && hashSet.contains(key)
         })
       }
     
    +  protected def buildHashRelation(buildIter: Iterator[InternalRow]): 
HashedRelation = {
    +    if (supportUnsafe) {
    +      UnsafeHashedRelation(buildIter, rightKeys, right)
    +    } else {
    +      HashedRelation(buildIter, newProjection(rightKeys, right.output))
    +    }
    +  }
    +
       protected def hashSemiJoin(
           streamIter: Iterator[InternalRow],
    -      hashSet: java.util.Set[InternalRow]): Iterator[InternalRow] = {
    -    val joinKeys = leftKeyGenerator()
    +      hashedRelation: HashedRelation): Iterator[InternalRow] = {
    +    val joinKeys = leftKeyGenerator
         val joinedRow = new JoinedRow
         streamIter.filter(current => {
    --- End diff --
    
    Minor style nit, but as long as you're changing this could you update it so 
that `filter` uses `{` brackets, e.g. `.filter { current => `?


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