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

   ### What changes were proposed in this pull request?
   
   This PR lets a stream-stream join evict range state on one side using only 
the opposite input's watermark.
   
   **Stack.** This is PR 4 of 7 and depends on #60281. Until the earlier PRs 
merge, this PR also shows their commits. Please review only the last commit, 
`7bd01bd59a6`. Merge order:
   
   1. #60279 [SPARK-61344](https://issues.apache.org/jira/browse/SPARK-61344): 
Fix stream-stream join range eviction column and output watermark
   2. #60280 [SPARK-61345](https://issues.apache.org/jira/browse/SPARK-61345): 
Fix stream-stream join watermark direction and equality-key eviction
   3. #60281 [SPARK-61346](https://issues.apache.org/jira/browse/SPARK-61346): 
Derive stream-stream join range eviction from the late-filtering event time
   4. (PR to follow) 
[SPARK-61347](https://issues.apache.org/jira/browse/SPARK-61347): Evict 
stream-stream join range state without a watermark on the stored side (this PR)
   5. (PR to follow) 
[SPARK-61348](https://issues.apache.org/jira/browse/SPARK-61348): Reject 
numeric state bounds in stream-stream outer joins
   6. (PR to follow) 
[SPARK-61349](https://issues.apache.org/jira/browse/SPARK-61349): Ignore 
constant-only bounds in stream-stream join state eviction
   7. (PR to follow) 
[SPARK-61350](https://issues.apache.org/jira/browse/SPARK-61350): Reject 
negative watermark terms in stream-stream join eviction bounds
   
   - Infer a state range bound from the opposite watermark even when the stored 
side has no watermark of its own, or its event-time column was pruned from the 
physical join.
   - Raise the checkpoint version to 4. Older checkpoints of affected join 
shapes are rejected with `STREAMING_JOIN_CHECKPOINT_INCOMPATIBLE` before any 
state is opened.
   - The join guide states that the impressions example needs no watermark on 
`impressionTime`.
   
   ### Why are the changes needed?
   
   A right watermark and a valid time range are enough to finalize old left 
rows. For example, a left outer join of impressions and clicks with a watermark 
on `clickTime` only and `clickTime BETWEEN impressionTime AND impressionTime + 
INTERVAL 1 HOUR` passes analysis. Because the left input has no watermark, 
Spark never removes left rows and never emits their unmatched outer rows. The 
right outer case is symmetric.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. Joins with a watermark on only one input emit eligible unmatched rows 
and remove expired state, including after a restart and when the event-time 
column is pruned.
   
   ### How was this patch tested?
   
   All commands below passed on this branch, rebased on Apache Spark master: 
829 tests, 0 failures.
   
   ```sh
   build/sbt 'catalyst/testOnly *StreamingJoinHelperSuite 
*UnsupportedOperationsSuite'  # 296
   build/sbt 'sql/testOnly *StreamingJoinWatermarkAdmissionSuite 
*StreamingJoinEqualityOutputWatermarkSuite *StreamingJoinSelectedEventTimeSuite 
*StreamingJoinOutputWatermarkSuite *StreamingJoinEqualityWatermarkSuite 
*StreamingJoinOneSidedWatermarkSuite *StreamingJoinRangeWatermarkSuite 
*StreamingJoinRangeEvictionSuite *StreamingSymmetricHashJoinHelperSuite 
*MultiStatefulOperatorsSuite *OffsetSeqLogSuite 
*SymmetricHashJoinStateManagerSuite 
*SymmetricHashJoinStateManagerEventTimeInKeySuite'  # 214
   build/sbt 'sql/testOnly *StreamingJoinCheckpointCompatibilitySuite 
*StreamingJoinRangeEvictionCheckpointSuite'  # 223
   build/sbt 'sql/testOnly *StreamingInnerJoin*Suite -- -z "matching scan on 
event time"'  # 90
   build/sbt 'sql/testOnly *StreamingFullOuterJoinV4Suite -- -z "null" -z 
"ordinal"'  # 6
   ```
   
   Scalastyle for catalyst and sql, main and test sources: 0 errors, 0 warnings.
   
   The new tests cover V2, V3 and V4, both outer-join directions, restart, 
pruned event-time columns and crossed intervals. Without the fix, 10 of these 
tests fail: the six one-watermark tests (V2, V3 and V4, both directions) and 
the three left outer pruned-column tests never emit the unmatched outer row, 
and the helper test derives no eviction predicate.
   
   Note on apache/spark#60068 (SPARK-60850): that PR keeps watermarked input 
columns through column pruning. If it merges first, the test `expiry-column 
eviction with a pruned event-time column` here needs updating, because its 
assertion that the physical join no longer outputs `leftTime` would fail.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: OpenAI Codex (GPT-6) and Anthropic 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