Repository navigation
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
The focused change matches the intended precedence, with no blocking issues identified in static review; tests were not executed.
No open issues 🎉
What changed in this PR
Updates Kafka ingestion so non-null header, key, and topic values take precedence over same-named payload columns.
Changes:
- Reverses shared lookup precedence for
read()andsample(). - Adds a header-collision regression test that also checks unaffected payload fields and timestamps.
- Updates the lookup documentation.
| File | Description |
|---|---|
| extensions-core/kafka-indexing-service/src/test/java/org/apache/druid/data/input/kafkainput/KafkaInputFormatTest.java | Tests header precedence on name collisions. |
| extensions-core/kafka-indexing-service/src/main/java/org/apache/druid/data/input/kafkainput/KafkaInputReader.java | Prioritizes Kafka metadata over payload values and documents the behavior. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
KafkaInputReader: Kafka header/key/topic values now win over payload columns of the same name.
Applies to
read()andsample(). Needed so enrichment headers (T0, Metrics Monetization) can't be shadowed by a payload column.Evidence
foo=fromHeader+ payloadfoo=x, empty header prefixtestHeaderWinsOnNameCollision->ComparisonFailure: expected:<fromHeader> but was:<x>After:
KafkaInputFormatTestTests run: 12, Failures: 0, Errors: 0Note: the Kafka module has no
junit-vintage-engine, so its JUnit 4 tests run 0 tests under Surefire by default. I added the engine temporarily to run them and did not commit that.Merge Danger
Door: two-way
Revert the 4-line change.
Blast Radius: Kafka ingestion
Behavior changes only for specs using
KafkaInputFormatwith a header, key or topic column name that equals a payload column. With the defaultkafka.header.prefix, collisions are rare. Anyone relying on payload-wins would now see header values.🤖 Generated with Claude Code