amol- commented on a change in pull request #11076:
URL: https://github.com/apache/arrow/pull/11076#discussion_r707282081
##########
File path: cpp/src/arrow/python/python_to_arrow.cc
##########
@@ -650,6 +652,19 @@ class PyListConverter : public ListConverter<T,
PyConverter, PyConverterTrait> {
return this->value_converter_->Extend(value, size);
}
+ Status AppendIterable(PyObject* value) {
+ int64_t current_size = 0;
+ PyObject* iterator = PyObject_GetIter(value);
+ OwnedRef iter_ref(iterator);
+ while (PyObject* item = PyIter_Next(iterator)) {
+ current_size += 1;
+ OwnedRef item_ref(item);
+ RETURN_NOT_OK(this->value_converter_->Reserve(current_size));
Review comment:
You were right, the argument of `Reserve` is the additional capacity to
add `Status Reserve(int64_t additional_capacity)`. Changed this to avoid
reserving unecessary space.
--
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]