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/01/16 13:36:43 UTC

[GitHub] [arrow] mqy commented on a change in pull request #9193: ARROW-11239: [Rust] Show some unit test failures

mqy commented on a change in pull request #9193:
URL: https://github.com/apache/arrow/pull/9193#discussion_r558885348



##########
File path: rust/arrow/src/array/data.rs
##########
@@ -219,17 +219,15 @@ impl ArrayData {
     ///
     /// Panics if `offset + length > self.len()`.
     pub fn slice(&self, offset: usize, length: usize) -> ArrayData {
-        assert!((offset + length) <= self.len());
-
-        let mut new_data = self.clone();
-
-        new_data.len = length;
-        new_data.offset = offset + self.offset;
-
-        new_data.null_count =
-            count_nulls(new_data.null_buffer(), new_data.offset, new_data.len);
+        self.copy_range(offset, length)
+    }
 
-        new_data
+    fn copy_range(&self, offset: usize, length: usize) -> ArrayData {
+        assert!((offset + length) <= self.len());
+        let arrays = vec![self];

Review comment:
       > Possible performance speedup
   Totally wrong, the benchmark of `array_slice` shows 4x - 11x regression.




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