twalthr commented on code in PR #28403:
URL: https://github.com/apache/flink/pull/28403#discussion_r3427502871


##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/plan/stream/sql/ProcessTableFunctionTest.java:
##########
@@ -513,6 +517,35 @@ private static Stream<ErrorSpec> errorSpecs() {
                         "SELECT * FROM f(r => TABLE t_watermarked PARTITION BY 
name, on_time => DESCRIPTOR(ts))",
                         "Time operations using the `on_time` argument are 
currently not supported for "
                                 + "PTFs that consume or produce updates."),
+                ErrorSpec.ofInsertInto(
+                        "upsert output into sink without primary key",
+                        UpdatingUpsertFunction.class,
+                        "INSERT INTO t_no_pk_sink SELECT * FROM f(r => TABLE 
t_updating PARTITION BY name)",
+                        "There is a changelog mismatch between two operators. "
+                                + "One produces an upsert changelog 
(UPDATE_AFTER without UPDATE_BEFORE). "
+                                + "The other requires a retract changelog 
(UPDATE_BEFORE and UPDATE_AFTER), for example a sink without a primary key. "
+                                + "In such cases, ensure that the sink is able 
to digest upserts where the PRIMARY KEY serves as the upsert key, or make the 
input produce UPDATE_BEFORE.\n\n"
+                                + "The conflict is at:\n"
+                                + "Sink(ExpectedChangelogMode=[I,UB,UA,D])\n"
+                                + "  +- 
ProcessTableFunction(changelogMode=[I,UA,D])"),
+                ErrorSpec.ofSelect(
+                        "upsert conflict that does not surface at a sink",
+                        UpdatingUpsertFunction.class,
+                        "SELECT name, SUM(`count`) OVER (PARTITION BY name 
ORDER BY name) "
+                                + "FROM f(r => TABLE t_updating PARTITION BY 
name)",
+                        "Can't generate a valid execution plan for the given 
query:\n"),
+                ErrorSpec.ofInsertInto(
+                        "upsert conflict buried below a calc",
+                        UpdatingUpsertFunction.class,
+                        "INSERT INTO t_no_pk_sink SELECT name, name0, `count`, 
mode "
+                                + "FROM f(r => TABLE t_updating PARTITION BY 
name) WHERE name0 <> ''",
+                        "There is a changelog mismatch between two operators. "
+                                + "One produces an upsert changelog 
(UPDATE_AFTER without UPDATE_BEFORE). "
+                                + "The other requires a retract changelog 
(UPDATE_BEFORE and UPDATE_AFTER), for example a sink without a primary key. "
+                                + "In such cases, ensure that the sink is able 
to digest upserts where the PRIMARY KEY serves as the upsert key, or make the 
input produce UPDATE_BEFORE.\n\n"
+                                + "The conflict is at:\n"
+                                + "Sink(ExpectedChangelogMode=[I,UB,UA,D])\n"

Review Comment:
   ```suggestion
                                   + "Sink(expectedChangelogMode=[I,UB,UA,D])\n"
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to