From 17055ca7a33bd1b0ba1ef244b56deb96994c4e1a Mon Sep 17 00:00:00 2001 From: Greg Bowyer Date: Tue, 22 Dec 2020 16:46:31 -1000 Subject: [PATCH] ARROW-10943: [Rust][Parquet] Always init new RleDecoder Part of the removal of specialisation makes the RleDecoder remain instanticated. This is done to lose some allocations but right now appears to leave a decoder in a semi configured state that can mis-read RLE packed data. As such we just init a new one each time the parent decoder has data set on it in a fashion to the pre refactored code. --- rust/parquet/src/encodings/decoding.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/rust/parquet/src/encodings/decoding.rs b/rust/parquet/src/encodings/decoding.rs index f1e98cc606d..02f0a1c9c59 100644 --- a/rust/parquet/src/encodings/decoding.rs +++ b/rust/parquet/src/encodings/decoding.rs @@ -301,6 +301,7 @@ impl Decoder for RleValueDecoder { // We still need to remove prefix of i32 from the stream. const I32_SIZE: usize = mem::size_of::(); let data_size = read_num_bytes!(i32, I32_SIZE, data.as_ref()) as usize; + self.decoder = RleDecoder::new(1); self.decoder.set_data(data.range(I32_SIZE, data_size)); self.values_left = num_values; Ok(())