Repository navigation
[Spark 4] Filter late data against the key's previous watermark in the streaming stateful ParDo - #40447
Merged
Conversation
…e streaming stateful ParDo Late data is filtered against the watermark of the key's previous visit and timers fire against the current one, so timer output behind the shared watermark survives into a downstream stateful ParDo. Part of apache#36841.
Contributor
Author
|
R: @Abacn |
Contributor
|
Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment |
1 task done
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #40447 +/- ##
============================================
- Coverage 59.04% 58.74% -0.30%
+ Complexity 15624 13910 -1714
============================================
Files 2797 2584 -213
Lines 280750 271444 -9306
Branches 12488 11229 -1259
============================================
- Hits 165764 159467 -6297
+ Misses 108540 105985 -2555
+ Partials 6446 5992 -454
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Oct 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Spark 4 Structured Streaming gives every stateful operator in a query the same event time watermark, transformWithState in EventTime mode reports its output watermark equal to its input watermark. Timer output of a stateful ParDo emitted behind that watermark reached a downstream stateful ParDo in the same batch and was dropped as late.
This follows the legacy runner rule in SparkGroupAlsoByWindowViaWindowSet: late data is filtered against the watermark of the key's previous visit, timers fire against the current one, through a new
SparkTimerInternals.forWatermarksand a third state variablebeamWatermark. Spark 4.0.2 accepts it as a new column family on restart from a #40281 checkpoint, existing keys take the first visit path once.The bound is per key, not per batch, so a key seen for the first time or idle for several batches accepts data a per batch bound would drop. Spark keeps the per batch value in
eventTimeWatermarkForLateEventsbut does not expose it through TimerValues, #40446 tracks the tighter bound.The new test
testChainedStatefulParDoTimerOutputSurvivesfails on master and passes with this change.Part of #36841.