danepitkin commented on code in PR #40482:
URL: https://github.com/apache/arrow/pull/40482#discussion_r1526383266
##########
python/pyarrow/src/arrow/python/arrow_to_pandas.cc:
##########
@@ -826,6 +830,37 @@ Status ConvertListsLike(PandasOptions options, const
ChunkedArray& data,
return Status::OK();
}
+template <class T>
+struct ListViewConversionType;
+
+template <>
+struct ListViewConversionType<ListViewType> {
+ using type = ListType;
+};
+
+template <>
+struct ListViewConversionType<LargeListViewType> {
+ using type = LargeListType;
+};
+
+template <typename T>
+enable_if_list_view<T, Status> ConvertListsLike(PandasOptions options,
+ const ChunkedArray& data,
+ PyObject** out_values) {
+ using ListViewArrayType = typename TypeTraits<T>::ArrayType;
+ using ConversionType = typename ListViewConversionType<T>::type;
+ using ConversionClass = typename TypeTraits<ConversionType>::ArrayType;
+ ArrayVector list_arrays;
+ for (int c = 0; c < data.num_chunks(); c++) {
+ const auto& arr = checked_cast<const ListViewArrayType&>(*data.chunk(c));
+ ARROW_ASSIGN_OR_RAISE(auto converted_array,
+ ConversionClass::FromListView(arr, options.pool));
+ list_arrays.emplace_back(converted_array);
+ }
+ auto chunked_array = std::make_shared<ChunkedArray>(list_arrays);
+ return ConvertListsLike<ConversionType>(options, *chunked_array, out_values);
Review Comment:
absolutely! That would be super helpful. I'll add it to the C++ ListView
"remaining tasks" parent issue.
--
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]