MCPcopy Create free account
hub / github.com/apache/datafusion / compute_all_files_statistics

Function compute_all_files_statistics

datafusion/datasource/src/statistics.rs:509–542  ·  view source on GitHub ↗
(
    file_groups: Vec<FileGroup>,
    table_schema: SchemaRef,
    collect_stats: bool,
    inexact_stats: bool,
)

Source from the content-addressed store, hash-verified

507/// * The summary statistics across all file groups, aka all files summary statistics
508#[expect(clippy::needless_pass_by_value)]
509pub fn compute_all_files_statistics(
510 file_groups: Vec<FileGroup>,
511 table_schema: SchemaRef,
512 collect_stats: bool,
513 inexact_stats: bool,
514) -> Result<(Vec<FileGroup>, Statistics)> {
515 let file_groups_with_stats = file_groups
516 .into_iter()
517 .map(|file_group| {
518 compute_file_group_statistics(
519 file_group,
520 Arc::clone(&table_schema),
521 collect_stats,
522 )
523 })
524 .collect::<Result<Vec<_>>>()?;
525
526 // Then summary statistics across all file groups
527 let file_groups_statistics = file_groups_with_stats
528 .iter()
529 .filter_map(|file_group| file_group.file_statistics(None));
530
531 let mut statistics = Statistics::try_merge_iter_with_ndv_fallback(
532 file_groups_statistics,
533 &table_schema,
534 NdvFallback::Max,
535 )?;
536
537 if inexact_stats {
538 statistics = statistics.to_inexact()
539 }
540
541 Ok((file_groups_with_stats, statistics))
542}
543
544#[deprecated(since = "47.0.0", note = "Use Statistics::add")]
545pub fn add_row_stats(

Calls 6

file_statisticsMethod · 0.80
to_inexactMethod · 0.80
mapMethod · 0.45
into_iterMethod · 0.45
iterMethod · 0.45

Used in the wild real call sites across dependent graphs

searching dependent graphs…