pitrou commented on code in PR #45272: URL: https://github.com/apache/arrow/pull/45272#discussion_r2190793693
########## cpp/src/arrow/compute/kernels/codegen_internal.h: ########## @@ -349,6 +356,31 @@ struct ArrayIterator<Type, enable_if_base_binary<Type>> { } }; +template <typename Type> +struct ArrayIterator<Type, enable_if_list_type<Type>> { + using offset_type = typename Type::offset_type; + + const ArraySpan& arr; + const offset_type* offsets; + offset_type cur_offset; + int64_t position; + + explicit ArrayIterator(const ArraySpan& arr) + : arr(arr), + offsets(reinterpret_cast<const offset_type*>(arr.buffers[1].data) + arr.offset), + cur_offset(offsets[0]), + position(0) {} + + ArraySpan operator()() { + offset_type next_offset = offsets[++position]; + const offset_type length = next_offset - cur_offset; + ArraySpan new_span{arr}; + new_span.SetSlice(cur_offset, length); Review Comment: I think this is a bit confused. This is creating a list ArraySpan with `length` list elements in it. If you want to use `ArrayIterator`, I think it should create an ArraySpan of the child array. -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org