Savonitar commented on code in PR #351:
URL: 
https://github.com/apache/flink-connector-kafka/pull/351#discussion_r4633054780


##########
flink-connector-kafka/src/main/java/org/apache/flink/streaming/connectors/kafka/table/UpsertKafkaDynamicTableFactory.java:
##########
@@ -254,6 +258,35 @@ public DynamicTableSink createDynamicTableSink(Context 
context) {
                 tableOptions.get(TRANSACTION_NAMING_STRATEGY));
     }
 
+    private static boolean supportsKeyOnlyDeletes(
+            ReadableConfig tableOptions, ResolvedSchema schema) {
+        return writesToSingleTopic(tableOptions) && 
hasOnlyNullableValueColumns(schema);

Review Comment:
   Should we wait for FLINK-40528 (fixed only in 2.4)? With a NOT NULL source 
column, e.g. `arr ARRAY<INT> NOT NULL` and `INSERT INTO snk SELECT k, ROW(k, 
arr) FROM src`, the tombstone fails with an NPE in `StreamExecCalc` on 2.2.1 
and 2.3.0. 
   Should this wait for a Flink version with that fix?



##########
flink-connector-kafka/src/main/java/org/apache/flink/streaming/connectors/kafka/table/UpsertKafkaDynamicTableFactory.java:
##########
@@ -254,6 +258,35 @@ public DynamicTableSink createDynamicTableSink(Context 
context) {
                 tableOptions.get(TRANSACTION_NAMING_STRATEGY));
     }
 
+    private static boolean supportsKeyOnlyDeletes(
+            ReadableConfig tableOptions, ResolvedSchema schema) {
+        return writesToSingleTopic(tableOptions) && 
hasOnlyNullableValueColumns(schema);
+    }
+
+    /**
+     * A tombstone only needs the key, as long as the sink knows the target 
topic. With a topic list
+     * or pattern, each row picks its topic from the {@code topic} metadata 
column, which a key-only
+     * delete does not guarantee to carry. This makes sinks writing to 
multiple topics incompatible
+     * with key-only deletes.
+     */
+    private static boolean writesToSingleTopic(ReadableConfig tableOptions) {

Review Comment:
   nit: could this reuse `KafkaConnectorOptionsUtil#isSingleTopic` (same logic, 
currently private)?



##########
flink-connector-kafka/src/main/java/org/apache/flink/streaming/connectors/kafka/table/UpsertKafkaDynamicTableFactory.java:
##########
@@ -254,6 +258,35 @@ public DynamicTableSink createDynamicTableSink(Context 
context) {
                 tableOptions.get(TRANSACTION_NAMING_STRATEGY));
     }
 
+    private static boolean supportsKeyOnlyDeletes(
+            ReadableConfig tableOptions, ResolvedSchema schema) {
+        return writesToSingleTopic(tableOptions) && 
hasOnlyNullableValueColumns(schema);
+    }
+
+    /**
+     * A tombstone only needs the key, as long as the sink knows the target 
topic. With a topic list

Review Comment:
   Does "only needs the key" hold for writable `timestamp` / `headers` metadata 
columns?



##########
flink-connector-kafka/src/test/java/org/apache/flink/streaming/connectors/kafka/table/UpsertKafkaDynamicTableFactoryTest.java:
##########


Review Comment:
   Do we have an existing case  that sends a key-only delete through the sink 
writer?
   Would an ITCase for upsert-kafka -> upsert-kafka with a tombstone be worth 
adding?
   



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