1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use std::path::PathBuf;

use polars_core::prelude::*;
use polars_plan::prelude::*;

/// Get a set of the data source paths in this LogicalPlan
pub(crate) fn agg_source_paths(
    root_lp: Node,
    paths: &mut PlHashSet<PathBuf>,
    lp_arena: &Arena<ALogicalPlan>,
) {
    lp_arena.iter(root_lp).for_each(|(_, lp)| {
        use ALogicalPlan::*;
        match lp {
            #[cfg(feature = "csv-file")]
            CsvScan { path, .. } => {
                paths.insert(path.clone());
            }
            #[cfg(feature = "parquet")]
            ParquetScan { path, .. } => {
                paths.insert(path.clone());
            }
            #[cfg(feature = "ipc")]
            IpcScan { path, .. } => {
                paths.insert(path.clone());
            }
            // always block parallel on anonymous sources
            // as we cannot know if they will lock or not.
            AnonymousScan { .. } => {
                paths.insert("anonymous".into());
            }
            _ => {}
        }
    })
}