You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/06/01 06:01:15 UTC

[GitHub] [arrow-rs] Dandandan commented on a change in pull request #384: Implement faster arrow array reader

Dandandan commented on a change in pull request #384:
URL: https://github.com/apache/arrow-rs/pull/384#discussion_r642802751



##########
File path: parquet/src/util/memory.rs
##########
@@ -292,19 +292,28 @@ impl<T> BufferPtr<T> {
     }
 
     /// Returns slice of data in this buffer.
+    #[inline]
     pub fn data(&self) -> &[T] {
         &self.data[self.start..self.start + self.len]
     }
 
     /// Updates this buffer with new `start` position and length `len`.
     ///
     /// Range should be within current start position and length.
+    #[inline]
     pub fn with_range(mut self, start: usize, len: usize) -> Self {
-        assert!(start <= self.len);
-        assert!(start + len <= self.len);
+        self.set_range(start, len);
+        self
+    }
+
+    /// Updates this buffer with new `start` position and length `len`.
+    ///
+    /// Range should be within current start position and length.
+    #[inline]
+    pub fn set_range(&mut self, start: usize, len: usize) {
+        assert!(self.start <= start && start + len <= self.start + self.len);

Review comment:
       Ah I had the `self.start` and `start` swapped in my head




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

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