AHeise commented on code in PR #258:
URL:
https://github.com/apache/flink-connector-kafka/pull/258#discussion_r3366774574
##########
flink-connector-kafka/src/main/java/org/apache/flink/streaming/connectors/kafka/table/DynamicKafkaRecordSerializationSchema.java:
##########
@@ -285,4 +289,14 @@ private <T> T readMetadata(RowData consumedRow,
KafkaDynamicSink.WritableMetadat
}
return (T) metadata.converter.read(consumedRow, pos);
}
+
+ private static @Nullable List<Header> resolveHeaders(
+ @Nullable List<Header> mapHeaders, @Nullable List<Header>
arrayHeaders) {
+ if (mapHeaders != null && arrayHeaders != null) {
+ throw new IllegalStateException(
Review Comment:
The main issue here is that as soon as we allow both readable and writeable,
we duplicate all entries unless we do an elaborate merging strategy. Let me
show an example:
* Input has header [k->v]
* HEADERS has [k->v], HEADER-LIST has [k->v]
* Now if we write them both out by naive merging, we get [k->v, k->v], the
entry is duplicated.
Since duplicates are exactly allowed with the new model we don't have an
easy way out. We could always choose HEADER-LIST over HEADERS but I'm assuming
users will be surprised if updates to HEADERS are lost. We could try to merge
them more intelligently but everything is a heuristic and someone will be
surprised.
This solution is the easiest way: both can be used for reading, only one can
be used for writing. Might not be the most elegant solution but its the easiest
to understand.
--
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]