sgilmore10 opened a new pull request, #35977:
URL: https://github.com/apache/arrow/pull/35977
<!--
Thanks for opening a pull request!
If this is your first pull request you can find detailed information on how
to contribute here:
* [New Contributor's
Guide](https://arrow.apache.org/docs/dev/developers/guide/step_by_step/pr_lifecycle.html#reviews-and-merge-of-the-pull-request)
* [Contributing
Overview](https://arrow.apache.org/docs/dev/developers/overview.html)
If this is not a [minor
PR](https://github.com/apache/arrow/blob/main/CONTRIBUTING.md#Minor-Fixes).
Could you open an issue for this pull request on GitHub?
https://github.com/apache/arrow/issues/new/choose
Opening GitHub issues ahead of time contributes to the
[Openness](http://theapacheway.com/open/#:~:text=Openness%20allows%20new%20users%20the,must%20happen%20in%20the%20open.)
of the Apache Arrow project.
Then could you also rename the pull request title in the following format?
GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
or
MINOR: [${COMPONENT}] ${SUMMARY}
In the case of PARQUET issues on JIRA the title also supports:
PARQUET-${JIRA_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
-->
### Rationale for this change
Users should be able to specify exactly which elements in a MATLAB array
should be treated as `null` values. In a previous PR, we added the name-value
pair `InferNulls` which users can use to turn off the automatic "null
detection" of values that `ismissing` function returns true:
```MATLAB
>> matlabArray = [1 NaN 3];
% NaN is treated as null by default
>> arrowArray = arrow.array.Float64Array(matlabArray);
arrowArray =
[
1,
null,
3
]
% Don't treat NaN as a null value
>> arrowArray = arrow.array.Float64Array(matlabArray, InferNulls=false);
arrowArray =
[
1,
nan,
3
]
```
To provide more control, this PR adds a new name-value pair named `Valid`.
This name-value pair will take precedence over `InferNulls` and allows users to
specify which elements are valid using either a logical array or a list of
indices:
```MATLAB
>> matlabArray = [1 NaN 3];
>> arrowArray = arrow.array.Float64Array(matlabArray, Valid=[true true
false]);
arrowArray =
[
1,
nan,
null
]
>> arrowArray = arrow.array.Float64Array(matlabArray, Valid=[2 3]);
arrowArray =
[
null,
nan,
3
]
```
### What changes are included in this PR?
1. Added the `Valid` name-value pair to `arrow.array.Float64Array`.
### Are these changes tested?
1. Added a new test file called `tParseValidElements.m` to independently
test the helper function `arrow.args.parseValidElements` used by
`arrow.array.Float64Array`.
2. Added two integration tests in `tFloat64Array.m`.
### Are there any user-facing changes?
Yes, users can now pass the `Valid` name-value pair to
`arrow.array.Float64Array`.
###Future Directions
1. Currently, only `arrow.array.Float64Array` supports the `InferNulls` and
`Valid` name-value pairs. In a followup PR, we will add support for these
name-value pairs to the rest of the numeric array classes.
--
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]