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


##########
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 {
+                if let Some(v) = self.bit_reader.get_value::<T::T>(bit_width) {
+                    self.last_value = self

Review Comment:
   Effectively you can only skip efficiently in multiples of the block size, as 
otherwise you are still having to decode all the value



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