@@ -114,8 +114,8 @@ pub struct VortexGlobalData {
114114 iterator : ThreadSafeIterator < VortexResult < ( ArrayRef , Arc < ConversionCache > ) > > ,
115115 batch_id : AtomicU64 ,
116116 ctx : ExecutionCtx ,
117- rows_total : AtomicU64 ,
118- rows_read : AtomicU64 ,
117+ chunk_len_total : AtomicU64 ,
118+ chunk_len_read : AtomicU64 ,
119119}
120120
121121pub struct VortexLocalData {
@@ -348,6 +348,9 @@ impl TableFunction for VortexTableFunction {
348348 return Ok ( ( ) ) ;
349349 } ;
350350
351+ global_state
352+ . chunk_len_total
353+ . fetch_add ( chunk. len ( ) , Ordering :: Relaxed ) ;
351354 let ( array_result, conversion_cache) = result?;
352355
353356 let array_result = array_result. optimize_recursive ( ) ?;
@@ -383,6 +386,10 @@ impl TableFunction for VortexTableFunction {
383386 . vortex_expect ( "error: exporter missing" ) ;
384387
385388 let has_more_data = exporter. export ( chunk) ?;
389+ // exporter.export updates chunk length to remaning bytes
390+ global_state
391+ . chunk_len_read
392+ . fetch_add ( chunk. len ( ) , Ordering :: Relaxed ) ;
386393
387394 if !has_more_data {
388395 // This exporter is fully consumed.
@@ -482,8 +489,8 @@ impl TableFunction for VortexTableFunction {
482489 batch_id : AtomicU64 :: new ( 0 ) ,
483490 // TODO(joe): fetch this from somewhere??.
484491 ctx : ExecutionCtx :: new ( VortexSession :: default ( ) ) ,
485- rows_read : AtomicU64 :: new ( 0 ) ,
486- rows_total : AtomicU64 :: new ( 0 )
492+ chunk_len_total : AtomicU64 :: new ( 0 ) ,
493+ chunk_len_read : AtomicU64 :: new ( 0 ) ,
487494 } )
488495 }
489496
@@ -518,8 +525,8 @@ impl TableFunction for VortexTableFunction {
518525 _bind_data : & mut Self :: BindData ,
519526 global_state : & mut Self :: GlobalState ,
520527 ) -> f64 {
521- global_state. rows_read . load ( Ordering :: Relaxed ) as f64
522- / global_state. rows_total . load ( Ordering :: Relaxed ) as f64
528+ global_state. chunk_len_read . load ( Ordering :: Relaxed ) as f64
529+ / global_state. chunk_len_total . load ( Ordering :: Relaxed ) as f64
523530 }
524531
525532 fn pushdown_complex_filter (
0 commit comments