alamb commented on code in PR #10759:
URL: https://github.com/apache/arrow-rs/pull/10759#discussion_r3880116304


##########
arrow-buffer/src/buffer/offset.rs:
##########
@@ -177,6 +177,42 @@ impl<O: ArrowNativeType> OffsetBuffer<O> {
         Self(ScalarBuffer::from(offsets))
     }
 
+    /// The first offset, i.e. the start of the first range.
+    ///
+    /// An [`OffsetBuffer`] is never empty, so this always returns an offset.
+    ///
+    /// ```
+    /// # use arrow_buffer::OffsetBuffer;
+    /// let offsets = OffsetBuffer::<i32>::from_lengths([1, 3, 5]);
+    /// assert_eq!(offsets.first(), 0);
+    /// assert_eq!(OffsetBuffer::<i32>::new_empty().first(), 0);
+    /// ```
+    #[inline]
+    pub fn first(&self) -> O {
+        self.0
+            .first()
+            .copied()
+            .expect("An `OffsetBuffer` is never empty")
+    }

Review Comment:
   Oh, I see now that this changed the signature
   
   > this is nice to have, though i wonder if itll cause churn downstream; a 
softer alternative is naming it first_offset() but does mean we can't really 
get people to move to the new api (dont think we can deprecate first() since it 
comes from a deref 🤔)
   
   I like this idea now -- rename this to `first_offset()` and deprecate 
`first()` (and the same for last)
   
   This (arrow 60) already has a bunch of breaking changes. It might be nice to 
minimize the number of additional changes needed



-- 
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]

Reply via email to