tustvold commented on code in PR #2393:
URL: https://github.com/apache/arrow-rs/pull/2393#discussion_r942549607


##########
parquet/src/encodings/decoding.rs:
##########
@@ -736,8 +736,47 @@ where
     }
 
     fn skip(&mut self, num_values: usize) -> Result<usize> {
-        let mut buffer = vec![T::T::default(); num_values];
-        self.get(&mut buffer)
+        let mut skip = 0;
+        let to_skip = num_values.min(self.values_left);
+        if to_skip == 0 {
+            return Ok(0);
+        }
+
+        // try to consume first value in header.
+        if let Some(value) = self.first_value.take() {
+            self.last_value = value;
+            skip += 1;
+            self.values_left -= 1;
+        }
+
+        while skip != to_skip {
+            if self.mini_block_remaining == 0 {
+                self.next_mini_block()?;
+            }
+
+            let bit_width = self.mini_block_bit_widths[self.mini_block_idx] as 
usize;
+            let batch_to_skip = self.mini_block_remaining.min(to_skip - skip);
+
+            for i in 0..batch_to_skip {

Review Comment:
   The key optimisation that I think would be good to include is if you don't 
need to read any values from a block, you don't need to keep track of 
last_value for the block



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

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

Reply via email to