You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "clintropolis (via GitHub)" <gi...@apache.org> on 2023/06/13 06:56:07 UTC
[GitHub] [druid] clintropolis opened a new pull request, #14413: fix Kafka input format to throw ParseException if timestamp is missing
clintropolis opened a new pull request, #14413:
URL: https://github.com/apache/druid/pull/14413
### Description
Fixes an issue when using the Kafka input format if the timestamp is missing from a row which can result in a [null pointer exception](https://github.com/apache/druid/blob/master/server/src/main/java/org/apache/druid/segment/realtime/appenderator/BaseAppenderatorDriver.java#L294). The fix is to throw a `ParseException` to be [consistent with other input format readers](https://github.com/apache/druid/blob/master/processing/src/main/java/org/apache/druid/data/input/impl/MapInputRowParser.java#L131).
This PR has:
- [ ] been self-reviewed.
- [ ] using the [concurrency checklist](https://github.com/apache/druid/blob/master/dev/code-review/concurrency.md) (Remove this item if the PR doesn't have any relation to concurrency.)
- [ ] added documentation for new or modified features or behaviors.
- [ ] a release note entry in the PR description.
- [ ] added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
- [ ] added or updated version, license, or notice information in [licenses.yaml](https://github.com/apache/druid/blob/master/dev/license.md)
- [ ] added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
- [ ] added unit tests or modified existing tests to cover new code paths, ensuring the threshold for [code coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md) is met.
- [ ] added integration tests.
- [ ] been tested in a test Druid cluster.
--
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-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
[GitHub] [druid] github-code-scanning[bot] commented on a diff in pull request #14413: fix Kafka input format to throw ParseException if timestamp is missing
Posted by "github-code-scanning[bot] (via GitHub)" <gi...@apache.org>.
github-code-scanning[bot] commented on code in PR #14413:
URL: https://github.com/apache/druid/pull/14413#discussion_r1227669988
##########
extensions-core/kafka-indexing-service/src/test/java/org/apache/druid/data/input/kafkainput/KafkaInputFormatTest.java:
##########
@@ -554,6 +555,68 @@
}
}
+ @Test
+ public void testMissingTimestampThrowsException() throws IOException
+ {
+ final byte[] key = StringUtils.toUtf8(
+ "{\n"
+ + " \"key\": \"sampleKey\"\n"
+ + "}");
+
+ final byte[] payload = StringUtils.toUtf8(
+ "{\n"
+ + " \"timestamp\": \"2021-06-25\",\n"
+ + " \"bar\": null,\n"
+ + " \"foo\": \"x\",\n"
+ + " \"baz\": 4,\n"
+ + " \"o\": {\n"
+ + " \"mg\": 1\n"
+ + " }\n"
+ + "}");
+
+ Headers headers = new RecordHeaders(SAMPLE_HEADERS);
+ inputEntity = new KafkaRecordEntity(
+ new ConsumerRecord<>(
+ "sample",
+ 0,
+ 0,
+ timestamp,
+ null,
+ null,
+ 0,
+ 0,
+ key,
+ payload,
+ headers
+ )
Review Comment:
## Deprecated method or constructor invocation
Invoking [ConsumerRecord.ConsumerRecord](1) should be avoided because it has been deprecated.
[Show more details](https://github.com/apache/druid/security/code-scanning/5051)
--
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-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
[GitHub] [druid] gianm merged pull request #14413: fix Kafka input format to throw ParseException if timestamp is missing
Posted by "gianm (via GitHub)" <gi...@apache.org>.
gianm merged PR #14413:
URL: https://github.com/apache/druid/pull/14413
--
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-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org