corpoverlords commented on code in PR #47531:
URL: https://github.com/apache/arrow/pull/47531#discussion_r2349556981
##########
cpp/src/arrow/stl_iterator.h:
##########
@@ -247,33 +248,39 @@ class ChunkedArrayIterator {
};
/// Return an iterator to the beginning of the chunked array
-template <typename Type, typename ArrayType = typename
TypeTraits<Type>::ArrayType>
-ChunkedArrayIterator<ArrayType> Begin(const ChunkedArray& chunked_array) {
- return ChunkedArrayIterator<ArrayType>(chunked_array);
+template <typename Type, typename ArrayType = typename
TypeTraits<Type>::ArrayType,
+ typename ValueAccessor = detail::DefaultValueAccessor<ArrayType>>
+ChunkedArrayIterator<ArrayType, ValueAccessor> Begin(const ChunkedArray&
chunked_array) {
+ return ChunkedArrayIterator<ArrayType, ValueAccessor>(chunked_array);
}
/// Return an iterator to the end of the chunked array
-template <typename Type, typename ArrayType = typename
TypeTraits<Type>::ArrayType>
-ChunkedArrayIterator<ArrayType> End(const ChunkedArray& chunked_array) {
- return ChunkedArrayIterator<ArrayType>(chunked_array,
chunked_array.length());
+template <typename Type, typename ArrayType = typename
TypeTraits<Type>::ArrayType,
+ typename ValueAccessor = detail::DefaultValueAccessor<ArrayType>>
+ChunkedArrayIterator<ArrayType, ValueAccessor> End(const ChunkedArray&
chunked_array) {
+ return ChunkedArrayIterator<ArrayType, ValueAccessor>(chunked_array,
+
chunked_array.length());
}
-template <typename ArrayType>
+template <typename ArrayType,
+ typename ValueAccessor = detail::DefaultValueAccessor<ArrayType>>
struct ChunkedArrayRange {
const ChunkedArray* chunked_array;
- ChunkedArrayIterator<ArrayType> begin() {
- return stl::ChunkedArrayIterator<ArrayType>(*chunked_array);
+ ChunkedArrayIterator<ArrayType, ValueAccessor> begin() {
+ return stl::ChunkedArrayIterator<ArrayType, ValueAccessor>(*chunked_array);
}
- ChunkedArrayIterator<ArrayType> end() {
- return stl::ChunkedArrayIterator<ArrayType>(*chunked_array,
chunked_array->length());
+ ChunkedArrayIterator<ArrayType, ValueAccessor> end() {
+ return stl::ChunkedArrayIterator<ArrayType, ValueAccessor>(*chunked_array,
+
chunked_array->length());
}
};
/// Return an iterable range over the chunked array
-template <typename Type, typename ArrayType = typename
TypeTraits<Type>::ArrayType>
-ChunkedArrayRange<ArrayType> Iterate(const ChunkedArray& chunked_array) {
- return stl::ChunkedArrayRange<ArrayType>{&chunked_array};
+template <typename Type, typename ArrayType = typename
TypeTraits<Type>::ArrayType,
+ typename ValueAccessor = detail::DefaultValueAccessor<ArrayType>>
+ChunkedArrayRange<ArrayType, ValueAccessor> Iterate(const ChunkedArray&
chunked_array) {
+ return stl::ChunkedArrayRange<ArrayType, ValueAccessor>{&chunked_array};
}
Review Comment:
Is it good to add this to the type traits? The majority of types inside
arrow can use the default accessor.
--
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]