[
https://issues.apache.org/jira/browse/FLINK-39913?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ASF GitHub Bot updated FLINK-39913:
-----------------------------------
Labels: pull-request-available (was: )
> Improve the error message when a foreground query emits an upsert changelog
> ---------------------------------------------------------------------------
>
> Key: FLINK-39913
> URL: https://issues.apache.org/jira/browse/FLINK-39913
> Project: Flink
> Issue Type: Improvement
> Components: Table SQL / API, Table SQL / Planner
> Reporter: Ramin Gharib
> Assignee: Ramin Gharib
> Priority: Major
> Labels: pull-request-available
>
> A foreground query (a bare SELECT, collected with no primary key) over a
> relation that emits an upsert changelog fails with an unhelpful error. The
> message is just "Can't generate a valid execution plan" followed by the
> optimized plan. A user has no way to tell what went wrong or how to fix it.
>
>
>
>
> The plan can emit an upsert changelog, for example via FROM_CHANGELOG with
> PARTITION BY and an op_mapping that has no UPDATE_BEFORE. The foreground sink
> has no primary key, so the planner requires a retract changelog
> (UPDATE_BEFORE + UPDATE_AFTER). Upsert cannot satisfy that, and the planner
> gives up.
> Reproduce:
> {code:java}
> SELECT *
> FROM FROM_CHANGELOG(
> input => TABLE events PARTITION BY id,
> op => DESCRIPTOR(operation),
> op_mapping => MAP[
> 'c', 'INSERT',
> 'u', 'UPDATE_AFTER',
> 'd', 'DELETE'
> ]
> ); {code}
> Part of the error message the users sees is:
> {code:java}
> Can't generate a valid execution plan for the given query:
> Sink(table=[*anonymous_foreground-sink$112*], fields=[id, name, email,
> status, event_time], changelogMode=[NONE])
> ...{code}
>
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)