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

   ### Rationale for this change
   
   `MapArray` validation uses `MayHaveNulls()` to check that the map child and 
keys contain no nulls. When an all-valid validity bitmap is present with an 
unknown null count, `MayHaveNulls()` can report that the array may contain 
nulls even though all values are valid.
   
   During a cast of a `MapArray`, this can cause validation to return an 
invalid status which is passed to `ARROW_CHECK_OK`, resulting in a process 
abort instead of a recoverable error.
   
   ### What changes are included in this PR?
   
   - Use `GetNullCount()` instead of `MayHaveNulls()` when validating the 
`MapArray` child and keys.
   - Add a regression test covering an all-valid validity bitmap with 
`kUnknownNullCount`.
   - Cover both the `filter()` → `cast()` path and an explicitly constructed 
all-valid keys bitmap.
   
   ### Are these changes tested?
   
   Yes.
   
   Added and passed:
   
   - `Cast.CastMapWithAllValidKeysBitmap`
   - Existing `Cast.CastMap` test
   
   The complete `arrow-array-test` suite was also run successfully with 1060 
tests passed and 1 skipped.
   
   ### Are there any user-facing changes?
   
   Yes. Casting affected `MapArray` values no longer aborts the process when 
the map keys have an all-valid validity bitmap with an unknown null count.
   
   ### This PR contains a "Critical Fix".
   
   This fixes a bug that can cause a process crash when casting a valid 
`MapArray` whose keys carry an all-valid validity bitmap with an unknown null 
count.
   
   Fixes GH-51029.


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