-
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
GH-38354: [MATLAB] Implement fromMATLAB
method for arrow.array.ListArray
#38561
Conversation
…ay that is not a missing value
…aits to be @arrow.array.ListArray.fromMATLAB
arrow.array.ListArray
@arrow.array.ListArray.fromMATLAB - not the MatlabConstructor property 2. Set the MatlabConstructor property of ListTraits back to missing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! It's really nice to see support for nested cell
arrays being added to arrow.array
!
+1 |
After merging your PR, Conbench analyzed the 4 benchmarking runs that have been run so far on merge-commit cd6e635. There were no benchmark performance regressions. 🎉 The full Conbench report has more details. It also includes information about 2 possible false positives for unstable benchmarks that are known to sometimes produce them. |
…ay.ListArray` (apache#38561) ### Rationale for this change We should implement a static `fromMATLAB` method for `arrow.array.ListArray` that takes in a MATLAB `cell` array and returns an instance of `arrow.array.ListArray`. Adding this method enables users to create an `arrow.array.ListArray` by passing a MATLAB `cell` array to the `arrow.array` gateway function: ```matlab >> C = {[1 2 3], [4 5], 6}; >> array = arrow.array(C) array = ListArray with 3 elements and 0 null values: [ [ 1, 2, 3 ], [ 4, 5 ], [ 6 ] ] ``` Internally, the `arrow.array` gateway function will call `arrow.array.ListArray.fromMATLAB` to construct a `ListArray` from the given `cell` array. ### What changes are included in this PR? 1. Implemented `fromMATLAB` method on `arrow.array.ListArray`. This method accepts a MATLAB `cell` array and returns an instance of `arrow.array.ListArray`. 2. Set the `ArrayStaticConstructor` property of `arrow.type.traits.ListTraits` to `@ arrow.array.ListArray.fromMATLAB`. 3. Added a switch case for `"cell"` to the `arrow.array` gateway function that invokes `arrow.array.ListArray.fromMATLAB` with the input `cell` array. ### Are these changes tested? Yes. I added a new test class to the `test/arrow/array/list` folder named `tFromMATLAB.m`. ### Are there any user-facing changes? Yes. Users can now create instances of `arrow.array.ListArray` by passing `cell` arrays to `arrow.array`: ```matlab >> C = {["A" "B"], ["C" "D" "E"], missing, ["F" "G"], string.empty(0, 1)}; >> array = arrow.array(C) array = ListArray with 5 elements and 1 null value: [ [ "A", "B" ], [ "C", "D", "E" ], null, [ "F", "G" ], [] ] ``` * Closes: apache#38354 Authored-by: Sarah Gilmore <[email protected]> Signed-off-by: Kevin Gurney <[email protected]>
…ay.ListArray` (apache#38561) ### Rationale for this change We should implement a static `fromMATLAB` method for `arrow.array.ListArray` that takes in a MATLAB `cell` array and returns an instance of `arrow.array.ListArray`. Adding this method enables users to create an `arrow.array.ListArray` by passing a MATLAB `cell` array to the `arrow.array` gateway function: ```matlab >> C = {[1 2 3], [4 5], 6}; >> array = arrow.array(C) array = ListArray with 3 elements and 0 null values: [ [ 1, 2, 3 ], [ 4, 5 ], [ 6 ] ] ``` Internally, the `arrow.array` gateway function will call `arrow.array.ListArray.fromMATLAB` to construct a `ListArray` from the given `cell` array. ### What changes are included in this PR? 1. Implemented `fromMATLAB` method on `arrow.array.ListArray`. This method accepts a MATLAB `cell` array and returns an instance of `arrow.array.ListArray`. 2. Set the `ArrayStaticConstructor` property of `arrow.type.traits.ListTraits` to `@ arrow.array.ListArray.fromMATLAB`. 3. Added a switch case for `"cell"` to the `arrow.array` gateway function that invokes `arrow.array.ListArray.fromMATLAB` with the input `cell` array. ### Are these changes tested? Yes. I added a new test class to the `test/arrow/array/list` folder named `tFromMATLAB.m`. ### Are there any user-facing changes? Yes. Users can now create instances of `arrow.array.ListArray` by passing `cell` arrays to `arrow.array`: ```matlab >> C = {["A" "B"], ["C" "D" "E"], missing, ["F" "G"], string.empty(0, 1)}; >> array = arrow.array(C) array = ListArray with 5 elements and 1 null value: [ [ "A", "B" ], [ "C", "D", "E" ], null, [ "F", "G" ], [] ] ``` * Closes: apache#38354 Authored-by: Sarah Gilmore <[email protected]> Signed-off-by: Kevin Gurney <[email protected]>
Rationale for this change
We should implement a static
fromMATLAB
method forarrow.array.ListArray
that takes in a MATLABcell
array and returns an instance ofarrow.array.ListArray
. Adding this method enables users to create anarrow.array.ListArray
by passing a MATLABcell
array to thearrow.array
gateway function:Internally, the
arrow.array
gateway function will callarrow.array.ListArray.fromMATLAB
to construct aListArray
from the givencell
array.What changes are included in this PR?
fromMATLAB
method onarrow.array.ListArray
. This method accepts a MATLABcell
array and returns an instance ofarrow.array.ListArray
.ArrayStaticConstructor
property ofarrow.type.traits.ListTraits
to@arrow.array.ListArray.fromMATLAB
."cell"
to thearrow.array
gateway function that invokesarrow.array.ListArray.fromMATLAB
with the inputcell
array.Are these changes tested?
Yes. I added a new test class to the
test/arrow/array/list
folder namedtFromMATLAB.m
.Are there any user-facing changes?
Yes. Users can now create instances of
arrow.array.ListArray
by passingcell
arrays toarrow.array
:fromMATLAB
method forarrow.array.ListArray
. #38354