AmanBoronbaev opened a new pull request, #55641:
URL: https://github.com/apache/arrow/pull/55641

   ### Rationale for this change
   
   Fixes https://github.com/apache/arrow/issues/44949.
   
   When an explicit JSON schema contains two fields named `foo`, the parser 
silently reuses the first field's index. The parsed fields then no longer match 
the explicit schema, and the reader can report an unrelated conversion error. 
Reject duplicate sibling field names with an `Invalid` status that identifies 
the duplicate.
   
   ### What changes are included in this PR?
   
   - Check the existing field-name index while constructing JSON object 
builders. This also covers nested structs and structs inside lists.
   - Document the uniqueness requirement for JSON explicit schemas.
   - Add parameterized regression tests for non-adjacent duplicate fields, 
identical and different field types, empty names, and all unexpected-field 
modes. Verify that the same name in separate objects remains valid.
   - Exercise the issue's reproducer through the table reader with threading 
enabled and disabled.
   
   ### Are these changes tested?
   
   Built from main commit `55803660f015f9945fe1b9bc84f0c138ae70ce98` with Clang 
22.1.8, Debug assertions, and `BUILD_WARNING_LEVEL=CHECKIN` (`-Werror`).
   
   - Before the fix: the new regression selection ran 8 tests; 5 failed as 
expected and the 3 valid-schema cases passed. The table-reader cases reproduced 
the conversion error reported in the issue.
   - After the fix: the full `arrow-json-test` executable passed all 254 tests 
across 60 suites, including the 8 added parameterized test instances.
   - `clang-format 18.1.8 --dry-run --Werror`, `cpplint 1.6.1 --quiet 
--verbose=2`, and `git diff --check` passed for all changed files.
   
   The complete Arrow CI matrix and Python bindings were not built or run 
locally.
   
   ### Are there any user-facing changes?
   
   JSON reading now reports `Invalid: JSON parse error: duplicate field 'foo' 
in explicit schema` for duplicate sibling names. General Arrow schemas and CSV 
handling are unchanged. There are no public API signature changes.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to