[ 
https://issues.apache.org/jira/browse/FLINK-41674?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gustavo de Morais updated FLINK-41674:
--------------------------------------
    Description: 
Part of removing unnecessary {{ChangelogNormalize}} below built-in PTFs that 
skip retractions (e.g. {{TO_APPEND}}), see 
[apache/flink#30123|https://github.com/apache/flink/pull/30123].

Insert-only PTFs read upserts only if their input has an upsert key. Without 
one, for example after a projection that drops the key or a {{UNION ALL}} of 
upsert tables, the planner falls back to retract mode and keeps a 
{{ChangelogNormalize}} to produce UPDATE_BEFORE.

{code:sql}
CREATE VIEW order_status AS SELECT status, amount FROM orders;
SELECT * FROM TO_APPEND(input => TABLE order_status);
{code}

A PTF that skips retractions never matches an UPDATE_AFTER to a previous row. 
We should add an internal {{StaticArgumentTrait.SKIP_RETRACTIONS}}, declare it 
for {{TO_APPEND}}, and let such PTFs read upserts without an upsert key.

  was:
Insert-only PTFs read upserts only if their input has an upsert key. Without 
one, for example after a projection that drops the key or a {{UNION ALL}} of 
upsert tables, the planner falls back to retract mode and keeps a 
{{ChangelogNormalize}} to produce UPDATE_BEFORE.

{code:sql}
CREATE VIEW order_status AS SELECT status, amount FROM orders;
SELECT * FROM TO_APPEND(input => TABLE order_status);
{code}

A PTF that skips retractions never matches an UPDATE_AFTER to a previous row. 
We should add an internal {{StaticArgumentTrait.SKIP_RETRACTIONS}}, declare it 
for {{TO_APPEND}}, and let such PTFs read upserts without an upsert key.

        Summary: Remove ChangelogNormalize below PTFs that skip retractions: 
inputs without an upsert key  (was: Let PTFs that skip retractions read upserts 
without an upsert key)

> Remove ChangelogNormalize below PTFs that skip retractions: inputs without an 
> upsert key
> ----------------------------------------------------------------------------------------
>
>                 Key: FLINK-41674
>                 URL: https://issues.apache.org/jira/browse/FLINK-41674
>             Project: Flink
>          Issue Type: Improvement
>          Components: Table SQL / Planner
>            Reporter: Gustavo de Morais
>            Assignee: Gustavo de Morais
>            Priority: Major
>              Labels: pull-request-available
>
> Part of removing unnecessary {{ChangelogNormalize}} below built-in PTFs that 
> skip retractions (e.g. {{TO_APPEND}}), see 
> [apache/flink#30123|https://github.com/apache/flink/pull/30123].
> Insert-only PTFs read upserts only if their input has an upsert key. Without 
> one, for example after a projection that drops the key or a {{UNION ALL}} of 
> upsert tables, the planner falls back to retract mode and keeps a 
> {{ChangelogNormalize}} to produce UPDATE_BEFORE.
> {code:sql}
> CREATE VIEW order_status AS SELECT status, amount FROM orders;
> SELECT * FROM TO_APPEND(input => TABLE order_status);
> {code}
> A PTF that skips retractions never matches an UPDATE_AFTER to a previous row. 
> We should add an internal {{StaticArgumentTrait.SKIP_RETRACTIONS}}, declare 
> it for {{TO_APPEND}}, and let such PTFs read upserts without an upsert key.



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

Reply via email to