Gustavo de Morais created FLINK-40111:
-----------------------------------------

             Summary: Keyless upsert sink should fall back to retract when the 
input has no upsert key
                 Key: FLINK-40111
                 URL: https://issues.apache.org/jira/browse/FLINK-40111
             Project: Flink
          Issue Type: Bug
          Components: Table SQL / API
            Reporter: Gustavo de Morais
            Assignee: Gustavo de Morais


When a sink without a primary key advertises an upsert changelog 
(ONLY_UPDATE_AFTER), {{FlinkChangelogModeInferenceProgram}} currently always 
lets the planner keep UPDATE_AFTER-only, regardless of the input. A keyless 
sink has no key for the downstream to apply updates by, so an unkeyed upsert 
stream cannot be materialized correctly.

Make {{inferSinkRequiredTraits}} fall back to BEFORE_AND_AFTER (retract) for a 
keyless sink when the input produces no upsert key. When the input can produce 
UPDATE_BEFORE (e.g. via ChangelogNormalize), the query then plans as retract 
instead of failing; when it cannot, planning fails as before. Keyed-sink 
behavior is unchanged.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to