GitHub user Jefffrey added a comment to the discussion: Converting a 
Vec<StructArray> to an arrow list type

Just for reference, it can be simplified like so

```rust
let values: Vec<StructArray> = vec![];
// Use `as` cast instead of passing through function
let converted_values: Vec<_> = values.iter().map(|array| array as &dyn 
Array).collect();
let concat_values = concat(&converted_values);
```

Also, it's worth mentioning that a `StructArray` by itself is an array; you 
mention you want a structure like so:

```
list = [
  { a: 1, b : 2 }.
  { a: 2, b : 5 },
  { a : 3, b: 4 },
]
```

This is already what a `StructArray` is; it is an array (aka a list) of struct 
elements, where each element is a struct (has multiple named values).

Putting it inside a `FixedSizeListArray` with value size equal to the length of 
the `StructArray` itself is just nested it, like

```
list = [
  [
    { a: 1, b : 2 }.
    { a: 2, b : 5 },
    { a : 3, b: 4 },
  ]
]
```

Here we have a `FixedSizeListArray` with value size `3` (the size of each list 
element), but it has only one element.

GitHub link: 
https://github.com/apache/arrow-rs/discussions/12413#discussioncomment-19830620

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to