dmitry-chirkov-dremio commented on code in PR #51647:
URL: https://github.com/apache/arrow/pull/51647#discussion_r4335242847
##########
cpp/src/arrow/util/list_util.cc:
##########
@@ -190,8 +192,78 @@ int64_t SumOfListViewSizes(const ArraySpan& input) {
return sum;
}
+/// \param list_view A LIST_VIEW or LARGE_LIST_VIEW array
+template <typename DestListType, typename SrcListViewType>
+Result<std::shared_ptr<ArrayData>> ListFromListViewImpl(const ArraySpan&
list_view,
+ MemoryPool* pool) {
+ using src_offset_type = typename SrcListViewType::offset_type;
+ using ListBuilderType = typename TypeTraits<DestListType>::BuilderType;
+
+ const auto& list_view_type = checked_cast<const
SrcListViewType&>(*list_view.type);
+ const auto& value_type = list_view_type.value_type();
+ // The value type is carried over, so that callers may cast the child.
+ auto list_type = std::make_shared<DestListType>(value_type);
+
+ ARROW_ASSIGN_OR_RAISE(auto sum_of_sizes, SumOfLogicalListSizes(list_view));
+ ARROW_ASSIGN_OR_RAISE(std::shared_ptr<ArrayBuilder> value_builder,
+ MakeBuilder(value_type, pool));
Review Comment:
This makes casts with extension children fail. A valid
list_view<arrow.bool8> can currently be cast to list<arrow.bool8> or
list<int8>. Both now fail because MakeBuilder does not support extension types.
Let's preserve these casts and add regression tests for both targets.
--
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]