AHeise commented on code in PR #351:
URL:
https://github.com/apache/flink-connector-kafka/pull/351#discussion_r4615767838
##########
flink-connector-kafka/src/main/java/org/apache/flink/streaming/connectors/kafka/table/UpsertKafkaDynamicTableFactory.java:
##########
@@ -254,6 +259,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) {
+ final List<String> topics = getTopics(tableOptions);
+ return topics != null && topics.size() == 1;
+ }
+
+ /**
+ * Key-only deletes leave the value columns NULL, which the NOT NULL
enforcer of Flink versions
+ * without FLINK-40477 rejects. Remove once the minimum Flink version
supported by the connector
Review Comment:
I don't think we can ever remove this: if there is no value, chances are
very low that we could extract the target topic, right? It would need to be
derivable entirely by the key. Not sure if we can test if it's indeed derived
this way.
--
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]