pitrou commented on code in PR #36256:
URL: https://github.com/apache/arrow/pull/36256#discussion_r1241836101
##########
cpp/src/arrow/compute/kernels/scalar_if_else_benchmark.cc:
##########
@@ -57,9 +57,45 @@ struct GetBytesProcessed<Type, enable_if_base_binary<Type>> {
}
};
+template <typename DataType>
+struct GetBytesProcessed<DataType, enable_if_list_like<DataType>> {
+ static int64_t Get(const std::shared_ptr<Array>& arr) {
+ using OffsetType = typename TypeTraits<DataType>::OffsetType::c_type;
+
+ int64_t total_bytes = 0;
+ if constexpr (DataType::type_id == Type::LIST ||
+ DataType::type_id == Type::LARGE_LIST) {
+ total_bytes += (arr->length() + 1) * sizeof(OffsetType);
+ } else {
+ ADD_FAILURE() << "GetBytesProcessed dispatching not implemented for "
+ << arr->type()->ToString();
+ }
+
+ auto child_array = std::static_pointer_cast<ListArray>(arr)->values();
+ switch (child_array->type_id()) {
Review Comment:
May want to use `VisitTypeInline` to avoid rewriting the switch by hand.
--
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]