danepitkin commented on code in PR #40160:
URL: https://github.com/apache/arrow/pull/40160#discussion_r1498440128
##########
python/pyarrow/src/arrow/python/python_to_arrow.cc:
##########
@@ -836,11 +848,14 @@ class PyListConverter : public ListConverter<T,
PyConverter, PyConverterTrait> {
Status AppendSequence(PyObject* value) {
int64_t size = static_cast<int64_t>(PySequence_Size(value));
+ RETURN_NOT_OK(AppendTo(this->list_type_, size));
RETURN_NOT_OK(this->list_builder_->ValidateOverflow(size));
return this->value_converter_->Extend(value, size);
}
Status AppendIterable(PyObject* value) {
+ auto size = static_cast<int64_t>(PyObject_Size(value));
Review Comment:
At the moment, `AppendIterable()` is only called for Sets and Dictionary
values views. I suppose generators would be routed through `AppendSequence()`
instead? I did give it a try just to be safe:
```
>>> def gen():
... yield [0]
... yield [1]
... yield [2]
...
>>> pa.array(gen(), type=pa.list_view(pa.int32()))
<pyarrow.lib.ListViewArray object at 0x12c96e6e0>
[
[
0
],
[
1
],
[
2
]
]
```
--
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]