Skip to content

Commit

Permalink
add timer
Browse files Browse the repository at this point in the history
  • Loading branch information
Gun9niR committed Apr 25, 2024
1 parent 7e372b8 commit f72b50e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions optd-datafusion-repr/src/cost/base_cost/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,14 @@ impl TableStats<Counter<ColumnCombValue>, TDigest<Value>> {
hlls: &mut [HyperLogLog<ColumnCombValue>],
null_counts: &mut [i32],
) {
let now = std::time::Instant::now();
column_combs
.par_iter()
.zip(mgs)
.zip(hlls)
.zip(null_counts)
.for_each(|(((column_comb, mg), hll), count)| {
let now = std::time::Instant::now();
let filtered_nulls: Vec<ColumnCombValue> = column_comb
.iter()
.filter(|row| row.iter().any(|val| val.is_some()))
Expand All @@ -292,7 +294,9 @@ impl TableStats<Counter<ColumnCombValue>, TDigest<Value>> {
*count += nb_rows - filtered_nulls.len() as i32;
mg.aggregate(&filtered_nulls);
hll.aggregate(&filtered_nulls);
println!("generate_partial_stats one task took {:?}", now.elapsed());
});
println!("generate_partial_stats took {:?}", now.elapsed());
}

fn generate_full_stats(
Expand All @@ -301,12 +305,14 @@ impl TableStats<Counter<ColumnCombValue>, TDigest<Value>> {
distrs: &mut [Option<TDigest<Value>>],
row_counts: &mut [i32],
) {
let now = std::time::Instant::now();
column_combs
.par_iter()
.zip(cnts)
.zip(distrs)
.zip(row_counts)
.for_each(|(((column_comb, cnt), distr), count)| {
let now = std::time::Instant::now();
let nb_rows = column_comb.len() as i32;
*count += nb_rows;
cnt.aggregate(column_comb);
Expand All @@ -322,7 +328,9 @@ impl TableStats<Counter<ColumnCombValue>, TDigest<Value>> {
d.norm_weight += nb_rows as usize;
d.merge_values(&filtered_values);
}
println!("generate_full_stats one task took {:?}", now.elapsed());
});
println!("generate_full_stats took {:?}", now.elapsed());
}

pub fn from_record_batches<I: IntoIterator<Item = Result<RecordBatch, ArrowError>>>(
Expand Down

0 comments on commit f72b50e

Please sign in to comment.