[ 
https://issues.apache.org/jira/browse/FLINK-41472?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18147667#comment-18147667
 ] 

Gustavo de Morais commented on FLINK-41472:
-------------------------------------------

One case to explicitly decide before implementing: several live rows per key, 
and the current row gets deleted. If only the current row is kept in state, a 
delete of it removes the key, while batch (which applies the changelog first) 
still returns the remaining row:

{code:sql}
-- input partitioned by customer_id, upsert key account_id, keep => 'last'
+I[c1, a1]
+I[c1, a2]
-D[c1, a2]
-- streaming: c1 has no row
-- batch:     c1 -> a1
{code}

Options:
* Keep only the current row and document that a delete does not fall back to 
another row. This deliberately differs from regular SQL, so it needs to be 
explicit in the docs.
* Accept updating input only when its upsert key equals the PARTITION BY key. 
Then a key has at most one live row, a delete leaves nothing, and both modes 
agree.
* Keep every live row per key, like the ROW_NUMBER() pattern. Correct, BUT 
state grows with the rows per key -> It's something we said multiple times we 
really want to avoid.

> Support updating input in DEDUPLICATE
> -------------------------------------
>
>                 Key: FLINK-41472
>                 URL: https://issues.apache.org/jira/browse/FLINK-41472
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Table SQL / Planner, Table SQL / Runtime
>            Reporter: Gustavo de Morais
>            Assignee: Vas Shabu
>            Priority: Major
>
> Accept updating input when the PARTITION BY columns contain an upsert key of 
> the input, and reject it at planning time otherwise. Handle upsert and 
> retract messages: -D clears the key and is emitted, and -U/-D for a key 
> without state are ignored.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to