Skip to content

Flink: Centralize dynamic-sink record routing on DynamicRecord#16231

Closed
jordepic wants to merge 0 commit intoapache:mainfrom
jordepic:main
Closed

Flink: Centralize dynamic-sink record routing on DynamicRecord#16231
jordepic wants to merge 0 commit intoapache:mainfrom
jordepic:main

Conversation

@jordepic
Copy link
Copy Markdown
Contributor

@jordepic jordepic commented May 6, 2026

Move per-record overrides (resolved equality fields, forward eligibility, distribution-mode resolution, and key-selector construction) onto DynamicRecord itself, and centralize how DynamicRecordProcessor builds and emits a DynamicRecordInternal behind a single DynamicRecordPlan abstraction with three implementations (CachedRecordPlan, DeferredUpdateRecordPlan, ImmediateUpdateRecordPlan). HashKeyGenerator keeps its selector cache and now delegates dispatch to DynamicRecord.keySelector. Existing equality-field-id resolution (user-supplied set, falling back to schema identifier fields) is reused unchanged.

Existing routing functionality is preserved with one exception: forward records (null distribution mode) that resolve to a non-empty equality-field set no longer take the forward path. Forwarding such records can land rows sharing an equality key on different writer subtasks, where independent equality deletes can leave duplicates behind. They are now hash-distributed by their equality fields, matching the rest of the dynamic sink. The Forward Mode section of docs/docs/flink-writes.md notes this carve-out.

Also corrects the DynamicRecord field reference in the docs: UpsertMode is a per-record write-time flag and does not override the table's write.upsert.enabled property.

Copy link
Copy Markdown
Contributor

@mxm mxm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Jordan! Thanks for the PR! Do you think we could factor out the fixes before we attempt the refactor? Otherwise this could be a bit tricky to review. For ease for review, we also typically remove all Flink versions but the latest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants