polars_lazy/
dot.rs

1use polars_core::prelude::*;
2
3use crate::prelude::*;
4
5impl LazyFrame {
6    /// Get a dot language representation of the LogicalPlan.
7    pub fn to_dot(&self, optimized: bool) -> PolarsResult<String> {
8        let lp = if optimized {
9            self.clone().to_alp_optimized()
10        } else {
11            self.clone().to_alp()
12        }?;
13
14        Ok(lp.display_dot().to_string())
15    }
16
17    /// Get a dot language representation of the streaming physical plan.
18    #[cfg(feature = "new_streaming")]
19    pub fn to_dot_streaming_phys(&self, optimized: bool) -> PolarsResult<String> {
20        let lf = self.clone().with_new_streaming(true);
21        let mut lp = if optimized {
22            lf.to_alp_optimized()
23        } else {
24            lf.to_alp()
25        }?;
26        polars_stream::visualize_physical_plan(lp.lp_top, &mut lp.lp_arena, &mut lp.expr_arena)
27    }
28}