Commits


sgilmore10 authored and GitHub committed dfab9821ce1
GH-36109: [MATLAB] Store a nullptr as the validity bitmap if all array elements are valid (#36114) ### Rationale for this change We want to take advantage of the validity bitmap optimization in which it's stored a nullptr if everything in the array is valid. When making large arrow arrays with only valid elements, this speeds up construction because we don't have to bit-pack the the validity array. ### What changes are included in this PR? 1. Renamed `bit_pack_matlab_logical_array` to `pack`. This function lives in the `arrow::matlab::bit` namespace. 2. Renamed `bit_unpack_arrow_buffer` to `unpack`. This function lives in the `arrow::matlab::bit` namespace. 3. Added a new function called `packValid`, which returns a `nullptr` if the input MATLAB logical array that represents the valid elements is empty. 4. Modified `arrow.args.parseValidElements` to return a 0x1 logical array if all the elements in the MATLAB array are valid. ### Are these changes tested? Yes. 1. Added tests to `tParseValidElements.m`, `tBooleanArray.m`, and `hNumericArray.m` that verify the optimization works as expected. ### Are there any user-facing changes? They are not user-facing. ### Notes Thanks to @ kevingurney for the help! * Closes: #36109 Lead-authored-by: Sarah Gilmore <sgilmore@mathworks.com> Co-authored-by: sgilmore10 <74676073+sgilmore10@users.noreply.github.com> Co-authored-by: Sutou Kouhei <kou@cozmixng.org> Signed-off-by: Sutou Kouhei <kou@clear-code.com>