[FLINK-39378][table] Add support for Context, timers and on_time to PTF test harness#28326
Open
autophagy wants to merge 1 commit into
Open
[FLINK-39378][table] Add support for Context, timers and on_time to PTF test harness#28326autophagy wants to merge 1 commit into
autophagy wants to merge 1 commit into
Conversation
…rocessTableFunctionTestHarness
Collaborator
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.
What is the purpose of the change
This PR adds support for
Context,OnTimerContext,TimeContext, timer registration and firing, watermark management, androwtimesupport to the PTF Test Harness.When a PTF registers a timer, the timer is stored in the TimerManager and keyed by the partition row. When the user advances the watermark using
either
setWatermarkorsetWatermarkForTable, the manager then fires all pending timers below or equal to the watermark in a deterministic order.I moved per-invocation state stuff into an
InvocationContextto make separation of concerns a little easier to follow.Rows emitted from test harness setups that configure an
on_timecolumn also contain therowtimecolumn, and the PTF rejects at the point of registration if the user tries to register a timer withPASS_COLUMNS_THROUGHenabled (similar to live, per the
PROCESS_INVALID_PASS_THROUGH_TIMERStest on live.)Some open questions remain. One is that there's an edge case where if a user's
onTimerregisters a new timer at or before the current watermark, it then fires, and then registers,then fires, etc. Should there be some sort of max depth check here?
The second is that when defining the on time parameter in SQL, you pass in
DESCRIPTOR(ts), but in the harness you just pass in the string name of the column. Would it instead be better to supportwithOnTime("DESCRIPTOR(ts)")to better mirror SQL, rather thanwithOnTimeColumn("ts")?Brief change log
Context,OnTimerContext,TimeContextinProcessTableFunctionTestHarnessProcessTableFunctionTestHarnessInvocationContextto capture per-invocation state to simplify the collector logicon_timeanduidcreateStateConverterwhere the incorrect state converters were being used for Map/List state.Verifying this change
This change added tests and can be verified as follows:
ProcessFunctionTestHarnessesTestto cover timer firing, watermark advancement and context.Does this pull request potentially affect one of the following parts:
@Public(Evolving): (no)Documentation
Was generative AI tooling used to co-author this PR?
2.1.156 (Claude Code)