Repository navigation
[FLINK-41712][table] Expose PTF trait to drop retractions and enforce with FilterChangelog - #30173
gustavodemorais wants to merge 2 commits into
Conversation
28faffd to
86e589f
Compare
twalthr
left a comment
There was a problem hiding this comment.
Great stuff @gustavodemorais. I left some comments but overall I'm surpottive of this addition.
| ProcessTableFunction(invocation=[TO_APPEND(TABLE(#0), DEFAULT(), DEFAULT())], uid=[null], select=[name], rowType=[RecordType(VARCHAR(2147483647) name)], changelogMode=[I]) | ||
| +- Calc(select=[name], changelogMode=[I,UA,PD]) | ||
| +- TableSourceScan(table=[[default_catalog, default_database, upsert_source]], fields=[id, name], changelogMode=[I,UA,PD]) | ||
| +- Calc(select=[name], changelogMode=[I,UA]) |
There was a problem hiding this comment.
check if the calc has still a partialDeleteKey set
There was a problem hiding this comment.
The Calc above the ChangelogFilter receives no deletes, so it has no partial delete keys.
partialDeleteKeys is null there, which is expected, since its delete kind is NONE.
86e589f to
dd3d37d
Compare
MartijnVisser
left a comment
There was a problem hiding this comment.
Thanks, I have two comments.
| None | ||
| } | ||
|
|
||
| case normalize: StreamPhysicalChangelogNormalize if !deduplicatesChanges(normalize) => |
There was a problem hiding this comment.
Without the ChangelogNormalize, an upsert repeating the last row of its key now reaches the function, so TO_CHANGELOG with only inserts and updates in op_mapping emits more rows than on master. Is that intended?
There was a problem hiding this comment.
Yes, the user wants a simples stateless conversion and we give them that 🙂 If there are duplicates, that is what he will see in his output append table.
There was a problem hiding this comment.
Makes sense. Then I think a semantic test with a repeated upsert below a non-key filter should pin it; the new TO_APPEND programs also pass on master. The IGNORE_RETRACTIONS docs could mention it too.
There was a problem hiding this comment.
Added a repeated upsert to the non-key filter program with key-only deletes; it fails on master. Also mentioned it in the IGNORE_RETRACTIONS docs.
…tractions Generated-by: Claude Code 2.1.304 (Opus 5.5)
…s are key-only Generated-by: Claude Code 2.1.304 (Opus 5.5)
dd3d37d to
088930b
Compare
What is the purpose of the change
Follow-up to #30123 (only the last two commits are new). PTFs that declare
IGNORE_RETRACTIONSnever read UPDATE_BEFORE or DELETE rows, but these rows still reach them. This PR adds a genericChangelogFilternode that keeps only a given set of row kinds, and places it below such functions as low as possible: below Calcs and Unions, on top of sources and stateful operators. Since the planner now enforces the trait, it is exposed to user PTFs asArgumentTrait.IGNORE_RETRACTIONS.Brief change log
ChangelogFilternode (physical, execstream-exec-changelog-filter, runtime filter), reusable for other row-kind filtering.IGNORE_RETRACTIONSarguments, so keyless Calcs no longer forward all-NULL tombstones and non-key filters over sources with key-only deletes (e.g. upsert-kafka) no longer need aChangelogNormalize.ArgumentTrait.IGNORE_RETRACTIONSfor user PTFs (requiresSUPPORT_UPDATES, cannot be combined withREQUIRE_UPDATE_BEFORE/REQUIRE_FULL_DELETE), documented in the PTF docs.Verifying this change
Plan tests in
ToAppendTest,ToChangelogTestandProcessTableFunctionTest, semantic tests inToAppendSemanticTestsandProcessTableFunctionSemanticTests(a user PTF that fails on any retraction), extraction tests inTypeInferenceExtractorTest, metadata tests, and a compiled-plan round trip for the new exec node.Does this pull request potentially affect one of the following parts:
@Public(Evolving): yes, newArgumentTrait.IGNORE_RETRACTIONSDocumentation
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code 2.1.304 (Opus 5.5)