File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -174,7 +174,7 @@ impl State {
174174 IoRequest :: new_single ( request)
175175 } ) ,
176176 Some ( window) => self . next_coalesced ( window) . map ( |request| {
177- match request. requests . len ( ) {
177+ match request. requests ( ) . len ( ) {
178178 1 => self . metrics . individual_requests . add ( 1 ) ,
179179 num_requests => {
180180 self . metrics . coalesced_requests . add ( 1 ) ;
@@ -311,11 +311,14 @@ impl State {
311311 current_end - aligned_start,
312312 ) ;
313313
314- Some ( CoalescedRequest {
315- range : aligned_start..current_end,
316- alignment : self . coalesced_buffer_alignment ,
317- requests,
318- } )
314+ Some (
315+ CoalescedRequest :: try_new (
316+ aligned_start..current_end,
317+ self . coalesced_buffer_alignment ,
318+ requests,
319+ )
320+ . vortex_expect ( "each request is correctly constructed and range.start <= range.end" ) ,
321+ )
319322 }
320323}
321324
Original file line number Diff line number Diff line change @@ -13,9 +13,9 @@ use vortex_error::VortexError;
1313use vortex_error:: VortexExpect ;
1414use vortex_error:: VortexResult ;
1515use vortex_error:: vortex_bail;
16- use vortex_error:: vortex_err;
1716
1817/// An I/O request, either a single read or a coalesced set of reads.
18+ #[ derive( Debug ) ]
1919pub ( crate ) struct IoRequest ( IoRequestInner ) ;
2020
2121impl IoRequest {
@@ -82,6 +82,7 @@ impl IoRequest {
8282 }
8383}
8484
85+ #[ derive( Debug ) ]
8586pub ( crate ) enum IoRequestInner {
8687 Single ( ReadRequest ) ,
8788 Coalesced ( CoalescedRequest ) ,
@@ -167,6 +168,10 @@ impl CoalescedRequest {
167168 } )
168169 }
169170
171+ pub fn requests ( & self ) -> & [ ReadRequest ] {
172+ & self . requests
173+ }
174+
170175 pub fn resolve ( self , result : VortexResult < BufferHandle > ) {
171176 let result = result. and_then ( |buffer| {
172177 let buffer_len = buffer. len ( ) as u64 ;
Original file line number Diff line number Diff line change @@ -119,9 +119,10 @@ impl FileSegmentSource {
119119 let result = result. and_then ( |buffer| {
120120 if req. len ( ) != buffer. len ( ) {
121121 vortex_bail ! (
122- "ReadRequest : expected buffer of length {} but received {}." ,
122+ "FileSegmentSource : expected buffer of length {} but received {}. {:?} " ,
123123 req. len( ) ,
124- buffer. len( )
124+ buffer. len( ) ,
125+ req
125126 )
126127 }
127128 Ok ( buffer)
You can’t perform that action at this time.
0 commit comments