HeartSaVioR opened a new pull request, #60667:
URL: https://github.com/apache/spark/pull/60667
### What changes were proposed in this pull request?
A stream-stream join derives the range cutoff for an input with its own
watermark from any
column of that input, but evicts by the event time. This PR evicts by the
column that the
condition bounds: the event time if it is bounded, else the first other
TIMESTAMP column that
is. State format version 4 orders the state by that column. A row whose
eviction column is
NULL is emitted (outer) or dropped at once, like a row that fails the
pre-join filter.
In scope:
- the column pick, the V4 index column, and the NULL rule;
- an analysis error for an outer or left semi join bounded only through
another column type,
such as a DATE cast to TIMESTAMP, which would otherwise never emit its
unmatched rows;
- a V4 restart check: a checkpoint from an earlier version fails with "start
a new
checkpoint" when the ordering differs. Recorded by an internal offset-log
entry.
Out of scope: the join's output watermark, inputs without their own
watermark, equality-key
eviction, and the legacy mode (`allowMultiple=false`), which keeps the
previous behavior.
### Why are the changes needed?
```sql
-- leftTime and rightTime have 60-second watermarks
SELECT * FROM l LEFT OUTER JOIN r
ON leftKey = rightKey AND rightTime BETWEEN leftTime AND expiry
```
With left `(1, 100 s, expiry 700 s)`, once the watermark reaches 340 s,
Spark emits
`(1, null)` and then drops the match with right `(1, 460 s)`.
### Does this PR introduce _any_ user-facing change?
Yes. Correct results for such joins; the analysis error above; V4
checkpoints of the changed
shape need a new checkpoint. Migration guide updated.
### How was this patch tested?
New `StreamingJoinRangeEvictionSuite` (V2-V4, inner/left/right outer, a V4
fixture from the
previous version), plus analysis and unit tests. The new tests fail on
master.
### Note for reviewers, including AI review
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]