2727#include " arrow/type_fwd.h"
2828#include " arrow/util/macros.h"
2929
30- namespace arrow ::internal {
30+ namespace arrow {
3131
3232struct ChunkResolver ;
3333
3434template <typename IndexType>
35- struct TypedChunkLocation {
35+ struct ARROW_EXPORT TypedChunkLocation {
3636 // / \brief Index of the chunk in the array of chunks
3737 // /
3838 // / The value is always in the range `[0, chunks.size()]`. `chunks.size()` is used
@@ -41,7 +41,7 @@ struct TypedChunkLocation {
4141
4242 // / \brief Index of the value in the chunk
4343 // /
44- // / The value is UNDEFINED if chunk_index >= chunks.size()
44+ // / The value is UNDEFINED if ` chunk_index >= chunks.size()`
4545 IndexType index_in_chunk = 0 ;
4646
4747 TypedChunkLocation () = default ;
@@ -61,7 +61,7 @@ using ChunkLocation = TypedChunkLocation<int64_t>;
6161
6262// / \brief An utility that incrementally resolves logical indices into
6363// / physical indices in a chunked array.
64- struct ARROW_EXPORT ChunkResolver {
64+ class ARROW_EXPORT ChunkResolver {
6565 private:
6666 // / \brief Array containing `chunks.size() + 1` offsets.
6767 // /
@@ -75,8 +75,16 @@ struct ARROW_EXPORT ChunkResolver {
7575 mutable std::atomic<int32_t > cached_chunk_;
7676
7777 public:
78+ // / \brief Initialize from an `ArrayVector`.
7879 explicit ChunkResolver (const ArrayVector& chunks) noexcept ;
80+
81+ // / \brief Initialize from a vector of raw `Array` pointers.
7982 explicit ChunkResolver (const std::vector<const Array*>& chunks) noexcept ;
83+
84+ // / \brief Initialize from a `RecordBatchVector`.
85+ // /
86+ // / Because all `Array`s in a `RecordBatch` must have the same length, this
87+ // / can be useful for iterating over multiple columns simultaneously.
8088 explicit ChunkResolver (const RecordBatchVector& batches) noexcept ;
8189
8290 // / \brief Construct a ChunkResolver from a vector of chunks.size() + 1 offsets.
@@ -115,11 +123,11 @@ struct ARROW_EXPORT ChunkResolver {
115123 // / The returned ChunkLocation contains the chunk index and the within-chunk index
116124 // / equivalent to the logical index.
117125 // /
118- // / \pre index >= 0
119- // / \post location.chunk_index in [0, chunks.size()]
126+ // / \pre ` index >= 0`
127+ // / \post ` location.chunk_index` in ` [0, chunks.size()]`
120128 // / \param index The logical index to resolve
121129 // / \return ChunkLocation with a valid chunk_index if index is within
122- // / bounds, or with chunk_index == chunks.size() if logical index is
130+ // / bounds, or with ` chunk_index == chunks.size()` if logical index is
123131 // / `>= chunked_array.length()`.
124132 inline ChunkLocation Resolve (int64_t index) const {
125133 const auto cached_chunk = cached_chunk_.load (std::memory_order_relaxed);
@@ -133,13 +141,13 @@ struct ARROW_EXPORT ChunkResolver {
133141 // / The returned ChunkLocation contains the chunk index and the within-chunk index
134142 // / equivalent to the logical index.
135143 // /
136- // / \pre index >= 0
137- // / \post location.chunk_index in [0, chunks.size()]
144+ // / \pre ` index >= 0`
145+ // / \post ` location.chunk_index` in ` [0, chunks.size()]`
138146 // / \param index The logical index to resolve
139147 // / \param hint ChunkLocation{} or the last ChunkLocation returned by
140148 // / this ChunkResolver.
141149 // / \return ChunkLocation with a valid chunk_index if index is within
142- // / bounds, or with chunk_index == chunks.size() if logical index is
150+ // / bounds, or with ` chunk_index == chunks.size()` if logical index is
143151 // / `>= chunked_array.length()`.
144152 inline ChunkLocation ResolveWithHint (int64_t index, ChunkLocation hint) const {
145153 assert (hint.chunk_index < static_cast <uint32_t >(offsets_.size ()));
@@ -281,4 +289,4 @@ struct ARROW_EXPORT ChunkResolver {
281289 }
282290};
283291
284- } // namespace arrow::internal
292+ } // namespace arrow
0 commit comments