-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MATLAB] Add Valid
as a name-value pair on the arrow.array.Float64Array
constructor
#35693
Comments
kevingurney
changed the title
[MATLAB] Add
[MATLAB] Add Jun 7, 2023
Valid
as a name-value pair on the arrow.array.Array
superclass constructorValid
as a name-value pair on the arrow.array.Float64Array
constructor
kou
added a commit
that referenced
this issue
Jun 10, 2023
…ay.Float64Array` constructor (#35977) ### 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 for which the MATLAB `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. * Closes: #35693 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>
@sgilmore10 Could you add a |
Will do! |
take |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the enhancement requested
This is a follow up to #35676 and #35598 .
To allow users to clearly specify which values in an input MATLAB array should be treated as null values when constructing an
arrow.array.Array
, it would be helpful to add aValid
name-value pair.This name-value pair would correspond to the public
Valid
property which encodes the validity bitmap (i.e. null values) in anarrow.array.Array
(proposed in #35598).Adding this name-value pair would provide clients with a way to unambiguously control null value handling behavior when constructing
arrow.array.Array
objects.Example:
Component(s)
MATLAB
The text was updated successfully, but these errors were encountered: