Skip to content

Commit 1dc73bc

Browse files
committed
use chunk lengths instead of rows
1 parent afe1fb5 commit 1dc73bc

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

vortex-duckdb/src/duckdb/table_function/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ use crate::duckdb::data_chunk::DataChunk;
3030
use crate::duckdb::expr::Expression;
3131
use crate::duckdb::table_function::cardinality::cardinality_callback;
3232
use crate::duckdb::table_function::partition::get_partition_data_callback;
33-
use crate::duckdb::table_function::table_scan_progress::table_scan_progress_callback;
3433
use crate::duckdb::table_function::pushdown_complex_filter::pushdown_complex_filter_callback;
34+
use crate::duckdb::table_function::table_scan_progress::table_scan_progress_callback;
3535
use crate::duckdb::table_function::virtual_columns::get_virtual_columns_callback;
3636
use crate::duckdb_try;
3737

vortex-duckdb/src/scan.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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

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

Comments
 (0)