-
Notifications
You must be signed in to change notification settings - Fork 14.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KAFKA-10477: Enabling the same behavior of NULL JsonNodeType to MISSI… #9306
Conversation
…NG JsonNodeType in JsonConverter. From 2.10.0 onwards, in jackson lib, ObjectMapper.readTree(input) started to return JsonNode of type MISSING for empty input, as mentioned in the issue: FasterXML/jackson-databind#2211. Made changes in JsonParser to incorporate this, and treat MISSING JsonNodeType in a similar fashion as that of NULL JsonNodeType. Added a unit test for this.
@kkonstantine @rhauch Kindly take a look at the changes. Thanks! |
Failures are in ConnectionQuotasTest, and ConsumerBounceTest test classes, and appear unrelated to the change in this PR. |
@shaikzakiriitm, you mentioned above:
However, the FasterXML/jackson-databind#2211 you mention above talks about this behavior changing in 2.9 relative to 2.8. This seems to not align with the your assertion in the KAFKA-10477 that:
Can you clarify? |
Following are the version dependencies of Apache Kafka (ak) on com.fasterxml.jackson.core:jackson-databind (j)
The behavior of the Jackson ObjectMapper#readTree() method when called with a blank string/empty-input changed as follows (based on the information from FasterXML/jackson-databind#2211) :
However, in all AK versions JsonConverter throws an error when it gets a MissingNode. This is only a problem for AK versions (v2.2.2, v2.3.1, v2.4.0, v2.4.1, v2.5.1, v2.6) that were released with Jackson 2.10.0 or later:
So, this PR aims to resolve the DataException that gets thrown when jackson-databind's |
Hi, I have shared more details in the comment #9306 (comment) . Kindly let me know if any further details are needed. Thanks! |
Thanks for putting together this comprehensive list of AK versions, Jackson versions, and behavior.
ak v2.1.0 (2018-11-20)-> j v2.9.7 IOW, the following versions are all affected since they use Jackson 2.10.x:
and thus the following branches are affected since they now use Jackson 2.10.x:
I've also gone through a number of versions of the https://github.com/FasterXML/jackson-databind code, looking for how MissingNode is used. It's obvious that MissingNode is used a lot more prevalently in 2.10.0. But the documentation for
So I think it's pretty clear that we should treat Once this PR is merged to
|
@shaikzakiriitm I added another test to verify that having a null within a JSON field is not a problem. It builds for me locally, and the new test passes when I've tested it against 2.3.1, 2.2.2, 2.4.0, 2.4.1, 2.5.0, 2.5.1, 2.6.0. However, even though it doesn't fail with these versions like your other test, it is still useful to at least verify that such behavior is unchanged. If we get a green build, I'll merge as discussed above. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks, @shaikzakiriitm!
No green jobs, but all of the Connect and MirrorMaker2 tests in all of the jobs passed. All of the failures in the tests were (flaky) client, broker, or streams tests. |
…ULL nodes (#9306) Fixes a regression introduced in `JsonConverter` with previous upgrades from Jackson Databind 2.9.x to 2.10.x. Jackson Databind version 2.10.0 included a backward-incompatible behavioral change to use `JsonNodeType.MISSING` (and `MissingNode`, the subclass of `JsonNode` that has a type of `MISSING`) instead of `JsonNodeType.NULL` / `NullNode`. See FasterXML/jackson-databind#2211 for details of this change. This change makes recovers the older `JsonConverter` behavior of returning null on empty input. Added two unit tests for this change. Both unit tests were independently tested with earlier released versions and passed on all versions that used Jackson 2.9.x and earlier, and failed on all versions that used 2.10.x and that did not have the fixed included in the PR. Both of the new unit tests pass with this fix to `JsonConverter`. Author: Shaik Zakir Hussain <[email protected]> Reviewer: Randall Hauch <[email protected]>
…ULL nodes (#9306) Fixes a regression introduced in `JsonConverter` with previous upgrades from Jackson Databind 2.9.x to 2.10.x. Jackson Databind version 2.10.0 included a backward-incompatible behavioral change to use `JsonNodeType.MISSING` (and `MissingNode`, the subclass of `JsonNode` that has a type of `MISSING`) instead of `JsonNodeType.NULL` / `NullNode`. See FasterXML/jackson-databind#2211 for details of this change. This change makes recovers the older `JsonConverter` behavior of returning null on empty input. Added two unit tests for this change. Both unit tests were independently tested with earlier released versions and passed on all versions that used Jackson 2.9.x and earlier, and failed on all versions that used 2.10.x and that did not have the fixed included in the PR. Both of the new unit tests pass with this fix to `JsonConverter`. Author: Shaik Zakir Hussain <[email protected]> Reviewer: Randall Hauch <[email protected]>
…ULL nodes (#9306) Fixes a regression introduced in `JsonConverter` with previous upgrades from Jackson Databind 2.9.x to 2.10.x. Jackson Databind version 2.10.0 included a backward-incompatible behavioral change to use `JsonNodeType.MISSING` (and `MissingNode`, the subclass of `JsonNode` that has a type of `MISSING`) instead of `JsonNodeType.NULL` / `NullNode`. See FasterXML/jackson-databind#2211 for details of this change. This change makes recovers the older `JsonConverter` behavior of returning null on empty input. Added two unit tests for this change. Both unit tests were independently tested with earlier released versions and passed on all versions that used Jackson 2.9.x and earlier, and failed on all versions that used 2.10.x and that did not have the fixed included in the PR. Both of the new unit tests pass with this fix to `JsonConverter`. Author: Shaik Zakir Hussain <[email protected]> Reviewer: Randall Hauch <[email protected]>
…ULL nodes (#9306) Fixes a regression introduced in `JsonConverter` with previous upgrades from Jackson Databind 2.9.x to 2.10.x. Jackson Databind version 2.10.0 included a backward-incompatible behavioral change to use `JsonNodeType.MISSING` (and `MissingNode`, the subclass of `JsonNode` that has a type of `MISSING`) instead of `JsonNodeType.NULL` / `NullNode`. See FasterXML/jackson-databind#2211 for details of this change. This change makes recovers the older `JsonConverter` behavior of returning null on empty input. Added two unit tests for this change. Both unit tests were independently tested with earlier released versions and passed on all versions that used Jackson 2.9.x and earlier, and failed on all versions that used 2.10.x and that did not have the fixed included in the PR. Both of the new unit tests pass with this fix to `JsonConverter`. Author: Shaik Zakir Hussain <[email protected]> Reviewer: Randall Hauch <[email protected]>
…ULL nodes (#9306) Fixes a regression introduced in `JsonConverter` with previous upgrades from Jackson Databind 2.9.x to 2.10.x. Jackson Databind version 2.10.0 included a backward-incompatible behavioral change to use `JsonNodeType.MISSING` (and `MissingNode`, the subclass of `JsonNode` that has a type of `MISSING`) instead of `JsonNodeType.NULL` / `NullNode`. See FasterXML/jackson-databind#2211 for details of this change. This change makes recovers the older `JsonConverter` behavior of returning null on empty input. Added two unit tests for this change. Both unit tests were independently tested with earlier released versions and passed on all versions that used Jackson 2.9.x and earlier, and failed on all versions that used 2.10.x and that did not have the fixed included in the PR. Both of the new unit tests pass with this fix to `JsonConverter`. Author: Shaik Zakir Hussain <[email protected]> Reviewer: Randall Hauch <[email protected]>
…NG JsonNodeType in JsonConverter.
From v2.10.0 onwards, in jackson lib, ObjectMapper.readTree(input) started to return JsonNode of type MISSING for empty input, as mentioned in the issue: FasterXML/jackson-databind#2211.
This caused to throw a
DataException["Unknown schema type: null"]
when an empty message key was parsed to be converted to Connect format via JsonConverter. TheschemaType
forMISSING
type of JsonNode was returned as null, which resulted in this exception.As part of this PR, made changes in JsonParser to incorporate the Jackson's ObjectMapper treatment of empty input from v2.10.0 onwards. Treating MISSING JsonNodeType in a similar fashion as that of NULL JsonNodeType.
Added a unit test for this.
Related Jira ticket captures further details: https://issues.apache.org/jira/browse/KAFKA-10477
All unit tests passed locally.
Committer Checklist (excluded from commit message)