cshuo commented on code in PR #20776:
URL: https://github.com/apache/hudi/pull/20776#discussion_r4640171314


##########
hudi-examples/hudi-examples-flink/src/main/java/org/apache/hudi/examples/quickstart/HoodieFlinkQuickstart.java:
##########
@@ -114,6 +114,9 @@ public void initEnv() {
       // configure not to retry after failure
       execConf.setString("restart-strategy", "fixed-delay");
       execConf.setString("restart-strategy.fixed-delay.attempts", "0");
+      // Flink 2.3 rejects an INSERT whose upsert key differs from the primary 
key of the sink table
+      // unless it has an ON CONFLICT clause (FLINK-38927), restore the 
behavior of earlier versions.
+      execConf.setString("table.exec.sink.require-on-conflict", "false");

Review Comment:
   
[HoodieFlinkQuickstart.java:119](https://github.com/apache/hudi/blob/0f2874fed38d9da44659635993059d75fc7fbb11/hudi-examples/hudi-examples-flink/src/main/java/org/apache/hudi/examples/quickstart/HoodieFlinkQuickstart.java#L119)
 · 
[HoodieTableSink.java:148–153](https://github.com/apache/hudi/blob/0f2874fed38d9da44659635993059d75fc7fbb11/hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/table/HoodieTableSink.java#L148-L153)
   
   I favor returning `insertOnly()` for insert-only input in the default UPSERT 
branch. The quickstart setting leaves a backward compatibility break for 
existing jobs. When Flink cannot infer an upsert key, a streaming `INSERT` into 
a keyed Hudi table that worked on 2.2 fails at planning time on 2.3. Users must 
explicitly set `table.exec.sink.require-on-conflict=false` to keep the same SQL 
running with otherwise default settings.
   
   Returning `insertOnly()` preserves those jobs without adding a 
`SinkMaterializer` on 2.3.0. For this input, I would prioritize compatibility 
over support for an explicit `ON CONFLICT` clause. Flink 2.4 also changed 
`require-on-conflict` to default to `false` to restore the pre-2.3 behavior. 
[Upstream change](https://github.com/apache/flink/pull/29935)
   



-- 
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