wuchong commented on a change in pull request #13732:
URL: https://github.com/apache/flink/pull/13732#discussion_r510233222



##########
File path: 
flink-connectors/flink-connector-kafka/src/main/java/org/apache/flink/streaming/connectors/kafka/table/KafkaDynamicSource.java
##########
@@ -202,4 +268,169 @@ public int hashCode() {
 
                return kafkaConsumer;
        }
+
+       // 
--------------------------------------------------------------------------------------------
+       // Metadata handling
+       // 
--------------------------------------------------------------------------------------------
+
+       private enum ReadableMetadata {
+               TOPIC(
+                       "topic",
+                       DataTypes.STRING().notNull(),
+                       record -> StringData.fromString(record.topic())
+               ),
+
+               PARTITION(
+                       "partition",
+                       DataTypes.INT().notNull(),
+                       ConsumerRecord::partition
+               ),
+
+               HEADERS(
+                       "headers",
+                       // key and value of the map are nullable to make 
handling easier in queries
+                       DataTypes.MAP(DataTypes.STRING().nullable(), 
DataTypes.BYTES().nullable()).notNull(),
+                       record -> {
+                               final Map<StringData, byte[]> map = new 
HashMap<>();
+                               for (Header header : record.headers()) {
+                                       
map.put(StringData.fromString(header.key()), header.value());
+                               }
+                               return new GenericMapData(map);
+                       }
+               ),
+
+               LEADER_EPOCH(
+                       "leader-epoch",

Review comment:
       Is that possible to remove the prefix of `debezium-json`? The Javadoc 
also says "In case of duplicate names in format and source keys, format keys 
shall have higher precedence." 
   
   So far, the metadata keys of format and source are very different. 




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

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


Reply via email to