sgilmore10 opened a new issue, #37996:
URL: https://github.com/apache/arrow/issues/37996
### Describe the enhancement requested
Right now, the only way to construct an `arrow.array.StructArray` is to call
its static method `fromArrays` method. Doing so requires users to first
construct the individual field arrays before creating the `StructArray`.
```matlab
>> a1 = arrow.array([1 2 3 4]);
>> a2 = arrow.array(["A" "B" "C" "D"]);
>> s1 = arrow.array.StructArray.fromArrays(a1, a2, FieldNames=["Number"
"String"])
s1 =
-- is_valid: all not null
-- child 0 type: double
[
1,
2,
3,
4
]
-- child 1 type: string
[
"A",
"B",
"C",
"D"
]
```
It would be nice if users could construct `StructArray`s from MATLAB
`table`s:
```matlab
>> t = table([1 2 3 4]', ["A1" "A2" "A3" "A4"]', VariableNames=["Number",
"String"])
>> s1 = arrow.array.StructArray.fromMATLAB(t)
s1 =
-- is_valid: all not null
-- child 0 type: double
[
1,
2,
3,
4
]
-- child 1 type: string
[
"A",
"B",
"C",
"D"
]
```
Adding `fromMATLAB` to `StructArray` enables returning `StructArray`s from
`arrow.array()`:
```matlab
>> t = table([1 2 3 4]', ["A1" "A2" "A3" "A4"]', VariableNames=["Number",
"String"])
>> s1 = arrow.array(t)
s1 =
-- is_valid: all not null
-- child 0 type: double
[
1,
2,
3,
4
]
-- child 1 type: string
[
"A",
"B",
"C",
"D"
]
```
### Component(s)
MATLAB
--
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]