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

   > **Warning** This pull request is a draft. We will rebase and mark as ready 
when the changes are finalized.
   
   ### Rationale for this change
   
   Currently, the `arrow.array.<Array>` classes do not support querying the 
Null values (i.e. validity bitmap) on an Arrow array. Support for encoding Null 
values is an important part of the Arrow memory format, so the MATLAB Interface 
to Arrow should support it.
   
   There are likely multiple different APIs that the MATLAB interface should 
have to support Null values robustly. However, to focus on incremental 
delivery, we can start by adding a public `Valid` property to the 
`arrow.array.<Array>` classes, which would return a `logical` array of null 
values in the given array.
   
   ### What changes are included in this PR?
   
   1. Added a new public property `Valid` to the `arrow.array.Array` superclass.
   2. Implemented basic null value handling for `arrow.array.Float64Array` 
(i.e. treat `NaN` values in the input MATLAB array as null values in the 
corresponding `arrow.array.Float64Array`).
   
   Example of creating an `arrow.array.Float64Array` from a MATLAB `double` 
array containing `NaN` values:
   
   ```matlab
   >> matlabArray = [1, 2, NaN, 4, NaN]'
   
   matlabArray =
   
        1
        2
      NaN
        4
      NaN
   
   >> arrowArray = arrow.array.Float64Array(matlabArray)
   
   arrowArray = 
   
   [
     1,
     2,
     null,
     4,
     null
   ]
   
   >> arrowArray.Valid
   
   ans =
   
     5×1 logical array
   
      1
      1
      0
      1
      0
   
   >> all(~isnan(matlabArray) == arrowArray.Valid)
   
   ans =
   
     logical
   
      1
   ```
   
   ### Are these changes tested?
   
   Yes, we have added the following test points for the `Valid` property of 
`arrow.array.Float64Array`:
   
   1. `ValidBasic`
   2. `ValidNoNulls`
   4. `ValidAllNulls`
   5. `ValidEmpty`
   
   ### Are there any user-facing changes?
   
   Yes.
   
   There is now a public property `Valid` on the arrow.array.Float64Array` 
class which is a MATLAB `logical` array encoding the null values in the 
underlying Arrow array, where `true` indicates an element is valid (i.e. not 
null) and `false` indicates that an element is invalid (i.e. null).


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