kfaraz commented on code in PR #16192:
URL: https://github.com/apache/druid/pull/16192#discussion_r1536548096
##########
extensions-core/kafka-indexing-service/src/main/java/org/apache/druid/data/input/kafkainput/KafkaStringHeaderReader.java:
##########
@@ -48,10 +48,17 @@ public KafkaStringHeaderReader(Headers headers,
public List<Pair<String, Object>> read()
{
List<Pair<String, Object>> events = new ArrayList<>();
+
for (Header hdr : headers) {
- String s = new String(hdr.value(), this.encoding);
- String newKey = this.headerLabelPrefix + hdr.key();
- events.add(Pair.of(newKey, s));
+ byte[] value = hdr.value();
+
+ if (value != null) {
+ String s = new String(value, this.encoding);
+ String newKey = this.headerLabelPrefix + hdr.key();
+ events.add(Pair.of(newKey, s));
+ } else {
+ log.warn("Header '" + hdr.key() + "' skipped because it had no value");
+ }
Review Comment:
As suggested in this comment,
https://github.com/apache/druid/issues/16177#issuecomment-2009731844, we should
just add a null value rather than skipping this header altogether.
```suggestion
String s = value == null ? null : new String(value, this.encoding);
String newKey = this.headerLabelPrefix + hdr.key();
events.add(Pair.of(newKey, s));
```
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]