sgilmore10 opened a new pull request, #36039:
URL: https://github.com/apache/arrow/pull/36039
### Rationale for this change
We initially only enabled null support for `arrow.array.Float64Array` via
the `InferNulls` and `Valid` name-value pairs. This pull request adds
null-value support to the rest of the numeric array types.
### What changes are included in this PR?
1. All numeric array classes accept the `InferNulls` and `Valid` name-value
pairs.
2. `arrow.array.Float32Array` treats `NaN` as `null` by default if
`InferNulls=true` and `Valid` is not supplied.
3. To reduce code duplication, we added an abstract class called
`arrow.array.NumericArray` that all numeric array classes inherit form.
Here's an example of creating an `Int32Array` with `null` values:
```MATLAB
>> matlabArray = int32([1 2 3 4 5]);
>> arrowArray = arrow.array.Int32Array(matlabArray, Valid=[1 4 5])
arrowArray =
[
1,
null,
null,
4,
5
]
```
### Are these changes tested?
1. Added two unit tests to `hNumericArray.m` called `LogicalValidNVPair` and
`NumericValidNVPair` which test the null support integration of all numeric
types.
2. Added unit tests to `tFloat32Array.m` to verify `NaN `is treated as a
null value by default.
### Are there any user-facing changes?
Yes, users can now create numeric arrays of any type with null values.
### Notes
Thanks to @kevingurney for all the help!
--
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]