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

   ### Rationale for this change
   
   The JSON reader parses each block separately. When a field is a list or 
object in one block and another kind in a later block, `read_json` can crash or 
return wrong values. With default options this can happen on any file just over 
1 MiB. A single-block read of the same data reports an error.
   
   ### What changes are included in this PR?
   
   A read split into blocks returns an `Invalid` error for such a type change, 
at the top level and inside lists and objects. The chunked builders and 
converters check the incoming type before using it.
   
   A list or object that follows only `null` values is tracked separately in 
GH-20253.
   
   Draft status: the first commit adds the tests. The fix follows in this pull 
request.
   
   ### Are these changes tested?
   
   New tests in `reader_test.cc` compare each split read with a single-block 
read, and check that valid input still reads. Until the fix is in, 22 of the 29 
new tests fail on a debug build.
   
   ### Are there any user-facing changes?
   
   Input that used to crash or return wrong values raises an error. Valid files 
read as before.
   
   **This PR contains a "Critical Fix".** It fixes a crash and incorrect data 
produced from JSON input.
   
   ### Was AI used for this PR?
   
   In accordance to the [AI generation 
guidelines](https://arrow.apache.org/docs/dev/developers/overview.html#ai-generated-code),
 please disclose below whether and how AI was used in this PR.
   
   **PR code and description written by:**
   
   - [ ] Human
   - [x] AI
   
   **Reviewed before submission by:**
   
   - [x] Human
   - [ ] AI
   - [ ] Not reviewed
   
   * GitHub Issue: #55833
   


-- 
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