Clear "lineSplittable" for JSON when using KafkaInputFormat.#15692
Merged
gianm merged 3 commits intoapache:masterfrom Jan 18, 2024
Merged
Clear "lineSplittable" for JSON when using KafkaInputFormat.#15692gianm merged 3 commits intoapache:masterfrom
gianm merged 3 commits intoapache:masterfrom
Conversation
JsonInputFormat has a "withLineSplittable" method that can be used to control whether JSON is read line-by-line, or as a whole. The intent is that in streaming ingestion, "lineSplittable" is false (although it can be overridden by "assumeNewlineDelimited"), and in batch ingestion, lineSplittable is true. When a "json" format is wrapped by a "kafka" format, this isn't set properly. This patch updates KafkaInputFormat to set this on an underlying "json" format. The tests for KafkaInputFormat were overriding the "lineSplittable" parameter explicitly, which wasn't really fair, because that made them unrealistic to what happens in production. Now they omit the parameter and get the production behavior.
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.
Fixes a bug where the KafkaInputFormat would parse incoming JSON newline-delimited (as if it were a batch ingest) rather than as a whole entity (as is typical for streaming ingest).
Background:
JsonInputFormat has a
withLineSplittablemethod that can be used to control whether JSON is read line-by-line, or as a whole. The intent is that in streaming ingestion,lineSplittableis false (although it can be overridden byassumeNewlineDelimited), and in batch ingestion,lineSplittableis true.When a
jsonformat is wrapped by akafkaformat, this isn't set properly. This patch updates KafkaInputFormat to set this on an underlyingjsonformat.The tests for KafkaInputFormat were overriding the
lineSplittableparameter explicitly, which wasn't really fair, because that made them unrealistic to what happens in production. Now they omit the parameter and get the production behavior.