[
https://issues.apache.org/jira/browse/FLINK-41677?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Gustavo de Morais updated FLINK-41677:
--------------------------------------
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].
{{TO_CHANGELOG}} with an {{op_mapping}} that maps only INSERT and UPDATE_AFTER
never reads UPDATE_BEFORE or DELETE rows. The planner still keeps a
{{ChangelogNormalize}} below it in the same cases as for {{TO_APPEND}}, for
example when the input has no upsert key:
{code:sql}
CREATE VIEW order_status AS SELECT status, amount FROM orders;
SELECT * FROM TO_CHANGELOG(
input => TABLE order_status,
op_mapping => MAP['INSERT', 'INSERT', 'UPDATE_AFTER', 'UPDATE_AFTER']);
{code}
We should declare {{SKIP_RETRACTIONS}} for {{TO_CHANGELOG}} with such an
{{op_mapping}}, so it benefits from the same optimizations. Without the
{{ChangelogNormalize}}, the op column shows the row kinds of the source, as it
already does for inputs with an upsert key.
was:
{{TO_CHANGELOG}} with an {{op_mapping}} that maps only INSERT and UPDATE_AFTER
never reads UPDATE_BEFORE or DELETE rows. The planner still keeps a
{{ChangelogNormalize}} below it in the same cases as for {{TO_APPEND}}, for
example when the input has no upsert key:
{code:sql}
CREATE VIEW order_status AS SELECT status, amount FROM orders;
SELECT * FROM TO_CHANGELOG(
input => TABLE order_status,
op_mapping => MAP['INSERT', 'INSERT', 'UPDATE_AFTER', 'UPDATE_AFTER']);
{code}
We should declare {{SKIP_RETRACTIONS}} for {{TO_CHANGELOG}} with such an
{{op_mapping}}, so it benefits from the same optimizations. Without the
{{ChangelogNormalize}}, the op column shows the row kinds of the source, as it
already does for inputs with an upsert key.
Summary: Remove ChangelogNormalize below PTFs that skip retractions:
TO_CHANGELOG with an insert/update-only op_mapping (was: Skip retractions in
TO_CHANGELOG if op_mapping forwards only inserts and updates)
> Remove ChangelogNormalize below PTFs that skip retractions: TO_CHANGELOG with
> an insert/update-only op_mapping
> --------------------------------------------------------------------------------------------------------------
>
> Key: FLINK-41677
> URL: https://issues.apache.org/jira/browse/FLINK-41677
> Project: Flink
> Issue Type: Improvement
> Components: Table SQL / Planner
> Reporter: Gustavo de Morais
> Assignee: Gustavo de Morais
> Priority: Major
>
> 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].
> {{TO_CHANGELOG}} with an {{op_mapping}} that maps only INSERT and
> UPDATE_AFTER never reads UPDATE_BEFORE or DELETE rows. The planner still
> keeps a {{ChangelogNormalize}} below it in the same cases as for
> {{TO_APPEND}}, for example when the input has no upsert key:
> {code:sql}
> CREATE VIEW order_status AS SELECT status, amount FROM orders;
> SELECT * FROM TO_CHANGELOG(
> input => TABLE order_status,
> op_mapping => MAP['INSERT', 'INSERT', 'UPDATE_AFTER', 'UPDATE_AFTER']);
> {code}
> We should declare {{SKIP_RETRACTIONS}} for {{TO_CHANGELOG}} with such an
> {{op_mapping}}, so it benefits from the same optimizations. Without the
> {{ChangelogNormalize}}, the op column shows the row kinds of the source, as
> it already does for inputs with an upsert key.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)