Repository navigation
fix: Compare metadata of nested child fields in TestingJSONComparison - #993
Open
JonSnow1807 wants to merge 1 commit into
Open
JonSnow1807 wants to merge 1 commit into
JonSnow1807 wants to merge 1 commit into
Conversation
CompareFieldBase() serializes both fields without metadata and then compares the metadata of the top-level field only, so a consumer that drops the metadata of a child of a struct, list, map or union field (e.g., an extension type on a list item) still passes the comparison. Recurse through the children of each field (and the children of a dictionary value type) and compare their metadata at ".children[i].metadata". Empty and absent metadata are treated as equal there because IPC and the integration JSON both omit empty metadata. Fixes apache#973
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #993 +/- ##
==========================================
- Coverage 78.59% 78.56% -0.04%
==========================================
Files 106 106
Lines 17153 17170 +17
Branches 2043 2056 +13
==========================================
+ Hits 13482 13489 +7
+ Misses 2422 2421 -1
- Partials 1249 1260 +11 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
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
TestingJSONComparison::CompareFieldBasewas comparing metadata on the parent field but not checking metadata on its children.That meant two nested schemas could compare as equal even when their child fields had different metadata.
This change makes the comparison recurse into child fields, including dictionary children, and reuse the existing metadata comparison logic.
It still treats absent and empty metadata as equivalent, and the existing order-insensitive metadata comparison behavior is preserved.
Testing
Added a gtest covering metadata differences in list, map, and dictionary children.
All 291 CTest tests pass.
This is separate from #972, which deals with dictionary value metadata.
Fixes #973.