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

   ### Rationale for this change
   
   `{"a": [null, 1]}` parses to `[[1]]`. Nothing raises, and 
`validate(full=True)` is the only thing
   that notices:
   
   ```
   Offset invariant failure: offset for slot 1 out of bounds: 2 > 1
   ```
   
   Debug builds abort on a DCHECK instead, at `parser.cc:540` if the second 
element is null and
   `parser.cc:1151` if it is typed.
   
   ### What changes are included in this PR?
   
   `RawBuilderSet::AppendNull` takes the child builder by value. Builders of 
`Kind::kNull` have no
   arena, their null count is packed into `BuilderPtr::index`, so the increment 
updates the parent
   but is lost to the caller. The next null then re-increments the same stale 
value, which leaves an
   all-null list as `NullArray(1)` and a promoted list with its leading nulls 
missing.
   
   It now takes a `BuilderPtr*`, matching `MakeBuilder` in the same class. The 
regression came in
   with `b7054c21aab` and has shipped since 0.14.0.
   
   ### Are these changes tested?
   
   `BlockParser.NullsInList` covers both arms. `arrow-json-test` passes 261/261 
in Debug and
   Release. Reverting `parser.cc` with the test in place aborts in Debug and 
fails both columns in
   Release.
   
   ### Are there any user-facing changes?
   
   Those inputs parse correctly now. This is not inference-only: an explicit 
`list(null())` schema
   reaches the same arm under both `Error` and `Ignore`.
   
   **This PR contains a "Critical Fix".** Well-formed JSON silently loses list 
elements in release
   builds and aborts on a DCHECK in debug builds.
   
   * GitHub Issue: #47417
   


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