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

   ### What changes were proposed in this pull request?
   
   This PR derives a range-eviction bound only from the opposite input's 
timestamp that late-input filtering uses.
   
   **Stack.** This is PR 3 of 7 and depends on #60280. Until the earlier PRs 
merge, this PR also shows their commits. Please review only the last commit, 
`da50a738afe`. 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. (PR to follow) 
[SPARK-61346](https://issues.apache.org/jira/browse/SPARK-61346): Derive 
stream-stream join range eviction from the late-filtering event time (this PR)
   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
   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
   
   - When the opposite input carries several watermarked columns, use only the 
first one, which is the column that late-input filtering checks, as the 
opposite time when inferring the state's range bound.
   - Raise the checkpoint version to 3. Older checkpoints of affected join 
shapes are rejected with `STREAMING_JOIN_CHECKPOINT_INCOMPATIBLE` before any 
state is opened.
   
   ### Why are the changes needed?
   
   With `spark.sql.streaming.statefulOperator.allowMultiple=false`, a join 
input can carry several watermarked columns, for example the output of an 
upstream join. An upstream join can emit `(u = 100, v = 5)` after the watermark 
reaches 50. A downstream join filters late input on `u` but has the condition 
`l > v`. Substituting watermark 50 for `v` evicts `l = 10`, although the row 
with `v = 5` still passes late filtering and matches it.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. Valid matches are preserved in V2 and V3 with 
`spark.sql.streaming.statefulOperator.allowMultiple=false`. V4 and the default 
mode already reject multiple distinct event-time columns.
   
   ### How was this patch tested?
   
   All commands below passed on this branch, rebased on Apache Spark master: 
807 tests, 0 failures.
   
   ```sh
   build/sbt 'catalyst/testOnly *StreamingJoinHelperSuite 
*UnsupportedOperationsSuite'  # 296
   build/sbt 'sql/testOnly *StreamingJoinWatermarkAdmissionSuite 
*StreamingJoinEqualityOutputWatermarkSuite *StreamingJoinSelectedEventTimeSuite 
*StreamingJoinOutputWatermarkSuite *StreamingJoinEqualityWatermarkSuite 
*StreamingJoinRangeEvictionSuite *StreamingSymmetricHashJoinHelperSuite 
*MultiStatefulOperatorsSuite *OffsetSeqLogSuite 
*SymmetricHashJoinStateManagerSuite 
*SymmetricHashJoinStateManagerEventTimeInKeySuite'  # 192
   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 V2/V3 test failed before the fix: the match was missing once the 
late-event watermark reached 50 seconds.
   
   ### 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