HeartSaVioR opened a new pull request, #60668:
URL: https://github.com/apache/spark/pull/60668

   ### What changes were proposed in this pull request?
   A stream-stream join evicts both inputs' state by the same equality key: the 
first
   watermarked key of the left input, else of the right input. This PR evicts 
each input's state
   by the first watermarked key of the opposite input, whose future rows that 
key bounds.
   
   In scope:
   - per-side key choice, with the previous shared key when the opposite input 
has no
     watermarked key;
   - a row whose newly selected key is NULL is emitted (outer) or dropped at 
once;
   - state format version 4 checkpoints of an earlier version fail with "start 
a new checkpoint"
     when the key differs (same check and marker as the parent PR).
   
   Out of scope: shifted or truncated keys, the join's output watermark, 
analysis of the
   watermark direction, and legacy mode (`allowMultiple=false`), which keeps 
the previous key.
   
   ### Why are the changes needed?
   ```sql
   -- la has a watermark on the left, rb on the right (10 seconds each)
   SELECT * FROM l FULL OUTER JOIN r ON la = ra AND lb = rb
   ```
   
   With left `(5, 50)` and the watermark at 40 s, Spark evicts the left row by 
`la = 5` and
   emits `(5, 50, null, null)`. The right row `(5, 50)` arrives later and is 
emitted unmatched
   too, instead of one match `(5, 50, 5, 50)`.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. Correct results for such joins; V4 checkpoints of this shape need a new 
checkpoint.
   Migration guide updated.
   
   ### How was this patch tested?
   New `StreamingJoinEqualityWatermarkSuite` (V2-V4, with and without restart), 
a V4 restart
   case and unit tests. They fail on the parent PR.
   
   ### Note for reviewers, including AI review
   This PR is stacked on #60667 (SPARK-61988, range eviction). Please review 
only this PR's own commit. For each
   finding, give a runnable reproducer and say whether master has the same 
behavior.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   Generated-by: Claude Opus 5.5
   
   This pull request and its description were written by Isaac.
   


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