You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "felipecrv (via GitHub)" <gi...@apache.org> on 2023/03/13 15:58:26 UTC

[GitHub] [arrow] felipecrv commented on a diff in pull request #34503: GH-20351: [C++] Kernel input type matcher for run-end encoded types

felipecrv commented on code in PR #34503:
URL: https://github.com/apache/arrow/pull/34503#discussion_r1134216296


##########
cpp/src/arrow/util/ree_util.h:
##########
@@ -209,18 +209,19 @@ class RunEndEncodedArraySpan {
   /// \brief Create an iterator from a logical position and its
   /// pre-computed physical offset into the run ends array
   ///
-  /// \param logical_pos is an index in the [0, length()) range
+  /// \param logical_pos is an index in the [0, length()] range
   /// \param physical_offset the pre-calculated PhysicalIndex(logical_pos)
   Iterator iterator(int64_t logical_pos, int64_t physical_offset) const {
     return Iterator{PrivateTag{}, *this, logical_pos, physical_offset};
   }
 
   /// \brief Create an iterator from a logical position
   ///
-  /// \param logical_pos is an index in the [0, length()) range
+  /// \param logical_pos is an index in the [0, length()] range
   Iterator iterator(int64_t logical_pos) const {
-    assert(logical_pos < length());
-    return iterator(logical_pos, PhysicalIndex(logical_pos));
+    return iterator(logical_pos, logical_pos < length()
+                                     ? PhysicalIndex(logical_pos)
+                                     : RunEndsArray(array_span).length);

Review Comment:
   I tried to use this class for something new and I realized this assert was too restrictive: it's not necessary for the correct working of the class.



-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org