eason-yuchen-liu commented on code in PR #59629:
URL: https://github.com/apache/spark/pull/59629#discussion_r4340488350


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/operators/stateful/join/StreamingSymmetricHashJoinHelper.scala:
##########
@@ -243,20 +243,32 @@ object StreamingSymmetricHashJoinHelper extends Logging {
           JoinStateKeyWatermarkPredicate(
             e,
             eventTimeWatermarkForEviction.get,
-            eventTimeWatermarkForLateEvents)
+            // V4 can skip keys at or below the previous watermark only if 
late-input filtering

Review Comment:
   The scaladoc for `prevStateWatermark` at the top of this file, and 
`startTimestamp` in `SupportsEvictByTimestamp`, still only say entries at or 
below it were already evicted. After this PR it also has to mean no newly 
admitted row can land there, and `None` now covers that case too. Can we update 
them? The "first batch after restart" example for `None` is stale as well, 
since the bound is applied after restart.



##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/operators/stateful/join/StreamingSymmetricHashJoinHelper.scala:
##########
@@ -243,20 +243,32 @@ object StreamingSymmetricHashJoinHelper extends Logging {
           JoinStateKeyWatermarkPredicate(
             e,
             eventTimeWatermarkForEviction.get,
-            eventTimeWatermarkForLateEvents)
+            // V4 can skip keys at or below the previous watermark only if 
late-input filtering
+            // rejects new rows in that range on this same key. A watermark on 
the other input's
+            // equality key can drive eviction even when this input has no 
watermark, or has one
+            // on a different column. New rows can then pass late-input 
filtering with keys
+            // already eligible for eviction. V4 must scan from the beginning 
to find them;
+            // otherwise, outer joins can fail to emit null rows for these 
unmatched inputs.
+            eventTimeWatermarkForLateEvents.filter { _ =>

Review Comment:
   nit: `filter { _ => ... }` throws away its argument, and the long comment 
inside the arg list is hard to follow. Could this be a `val 
prevStateKeyWatermark = if (...) eventTimeWatermarkForLateEvents else None`, 
like `prevStateValueWatermark` below?



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

Reply via email to