anishshri-db commented on a change in pull request #36002:
URL: https://github.com/apache/spark/pull/36002#discussion_r840105969
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/StreamingSymmetricHashJoinExec.scala
##########
@@ -324,17 +324,21 @@ case class StreamingSymmetricHashJoinExec(
}
}
+ val initIterFn = { () =>
+ val removedRowIter = leftSideJoiner.removeOldState()
+ removedRowIter.filterNot { kv =>
+ stateFormatVersion match {
+ case 1 => matchesWithRightSideState(new UnsafeRowPair(kv.key,
kv.value))
+ case 2 => kv.matched
+ case _ => throwBadStateFormatVersionException()
+ }
+ }.map(pair => joinedRow.withLeft(pair.value).withRight(nullRight))
+ }
+
// NOTE: we need to make sure `outerOutputIter` is evaluated "after"
exhausting all of
- // elements in `innerOutputIter`, because evaluation of
`innerOutputIter` may update
+ // elements in `hashJoinOutputIter`, because evaluation of
`hashJoinOutputIter` may update
Review comment:
Nit: Do you think we should tag/mention the spark JIRA ticket
(https://issues.apache.org/jira/browse/SPARK-38684) in the comment here and
below? Also, should we mention some of the PR description you added here, to
elaborate the issue further? :
```
More specifically, if updates are performed during processing input rows and
somehow updates the number of values for grouping key, the update is not seen
in SymmetricHashJoinStateManager.removeByValueCondition, and the method does
the eviction with the number of values in out of sync.
Making it more worse, if the method performs the eviction and updates the
number of values for grouping key, it "overwrites" the number of value,
effectively drop all rows being inserted in the same batch.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]