navina commented on code in PR #9224:
URL: https://github.com/apache/pinot/pull/9224#discussion_r978359462


##########
pinot-plugins/pinot-stream-ingestion/pinot-kafka-2.0/src/main/java/org/apache/pinot/plugin/stream/kafka20/RowMetadataExtractor.java:
##########
@@ -18,15 +18,35 @@
  */
 package org.apache.pinot.plugin.stream.kafka20;
 
+import java.util.HashMap;
+import java.util.Map;
 import org.apache.kafka.clients.consumer.ConsumerRecord;
+import org.apache.kafka.common.header.Header;
+import org.apache.kafka.common.header.Headers;
+import org.apache.pinot.spi.data.readers.GenericRow;
 import org.apache.pinot.spi.stream.RowMetadata;
 import org.apache.pinot.spi.stream.StreamMessageMetadata;
 
 
 @FunctionalInterface
 public interface RowMetadataExtractor {
   static RowMetadataExtractor build(boolean populateMetadata) {
-    return populateMetadata ? record -> new 
StreamMessageMetadata(record.timestamp()) : record -> null;
+    return record -> {
+      if (!populateMetadata) {
+        return null;
+      }
+      GenericRow headerGenericRow = new GenericRow();
+      Headers headers = record.headers();
+      if (headers != null) {
+        Header[] headersArray = headers.toArray();
+        for (Header header : headersArray) {
+          headerGenericRow.putValue(header.key(), header.value());
+        }
+      }
+      Map<String, String> metadata = new HashMap<>();
+      metadata.put("offset", String.valueOf(record.offset()));

Review Comment:
   I have renamed this to KafkaMetadataExtractor



-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to