@@ -40,6 +40,7 @@ use crate::error::{
4040use crate :: proto:: stream:: Kind ;
4141use crate :: schema:: DataType ;
4242use crate :: stripe:: Stripe ;
43+ use crate :: RowSelection ;
4344
4445use self :: decimal:: new_decimal_decoder;
4546use self :: list:: ListArrayDecoder ;
@@ -238,7 +239,7 @@ pub struct NaiveStripeDecoder {
238239 index : usize ,
239240 batch_size : usize ,
240241 number_of_rows : usize ,
241- row_selection : Option < crate :: row_selection :: RowSelection > ,
242+ row_selection : Option < RowSelection > ,
242243 selection_index : usize ,
243244}
244245
@@ -251,18 +252,16 @@ impl Iterator for NaiveStripeDecoder {
251252 if self . row_selection . is_some ( ) {
252253 // Process selectors until we find rows to select or exhaust the selection
253254 loop {
254- let selector_info = {
255- let selection = self . row_selection . as_ref ( ) . unwrap ( ) ;
256- let selectors = selection . selectors ( ) ;
255+ let ( is_skip , row_count ) = {
256+ // Safety: this has been checked above
257+ let selectors = self . row_selection . as_ref ( ) . unwrap ( ) . selectors ( ) ;
257258 if self . selection_index >= selectors. len ( ) {
258259 return None ;
259260 }
260261 let selector = selectors[ self . selection_index ] ;
261262 ( selector. skip , selector. row_count )
262263 } ;
263264
264- let ( is_skip, row_count) = selector_info;
265-
266265 if is_skip {
267266 // Skip these rows by advancing the index
268267 self . index += row_count;
@@ -492,7 +491,7 @@ impl NaiveStripeDecoder {
492491 stripe : Stripe ,
493492 schema_ref : SchemaRef ,
494493 batch_size : usize ,
495- row_selection : Option < crate :: row_selection :: RowSelection > ,
494+ row_selection : Option < RowSelection > ,
496495 ) -> Result < Self > {
497496 let number_of_rows = stripe. number_of_rows ( ) ;
498497 let decoders = stripe
0 commit comments