AlenkaF commented on issue #48182:
URL: https://github.com/apache/arrow/issues/48182#issuecomment-3557499574
Yes, looks like the linked PR fixed the issue. I have rebuilt PyArrow on
main and the code works:
```python
In [1]: import pyarrow
In [2]: pyarrow.__version__
Out[2]: '23.0.0.dev83+g9dfc3afb2'
In [3]: struct_type = pyarrow.struct([("x", pyarrow.int64()), ("y",
pyarrow.int64())])
...:
...: list0 = [{"x": 1, "y": 2}, {"x": 3, "y": 4}]
...: list1 = [{"x": 5, "y": 6}]
...: list2 = [{"x": 7, "y": 8}, {"x": 9, "y": 10}]
...:
...: list_of_structs = pyarrow.array([list0, list1, list2],
type=pyarrow.list_(struct_type))
...:
...: # Get the first list - should be [{x:1,y:2}, {x:3,y:4}]
...: elem0 = list_of_structs[0]
...: batch_for_elem0 = pyarrow.RecordBatch.from_struct_array(elem0.values)
...:
...: print("ver", pyarrow.__version__)
...: print("RIGHT:", len(elem0.values), elem0.values.field("x"))
...:
...: print("WRONG?:", len(batch_for_elem0), batch_for_elem0["x"])
ver 23.0.0.dev83+g9dfc3afb2
RIGHT: 2 [
1,
3
]
WRONG?: 2 [
1,
3
]
```
I think a test on the PyArrow side would still be needed so I will keep this
issue open. Contributions welcome!
--
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]