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

Method display_graphviz

datafusion/expr/src/logical_plan/plan.rs:1799–1827  ·  view source on GitHub ↗

Return a `format`able structure that produces lines meant for graphical display using the `DOT` language. This format can be visualized using software from [`graphviz`](https://graphviz.org/) This currently produces two graphs -- one with the basic structure, and one with additional details such as schema. ``` use arrow::datatypes::{DataType, Field, Schema}; use datafusion_expr::{col, lit, logic

(&self)

Source from the content-addressed store, hash-verified

1797 /// dot -Tpdf < /tmp/example.dot > /tmp/example.pdf
1798 /// ```
1799 pub fn display_graphviz(&self) -> impl Display + '_ {
1800 // Boilerplate structure to wrap LogicalPlan with something
1801 // that that can be formatted
1802 struct Wrapper<'a>(&'a LogicalPlan);
1803 impl Display for Wrapper<'_> {
1804 fn fmt(&self, f: &mut Formatter) -> fmt::Result {
1805 let mut visitor = GraphvizVisitor::new(f);
1806
1807 visitor.start_graph()?;
1808
1809 visitor.pre_visit_plan("LogicalPlan")?;
1810 self.0
1811 .visit_with_subqueries(&mut visitor)
1812 .map_err(|_| fmt::Error)?;
1813 visitor.post_visit_plan()?;
1814
1815 visitor.set_with_schema(true);
1816 visitor.pre_visit_plan("Detailed LogicalPlan")?;
1817 self.0
1818 .visit_with_subqueries(&mut visitor)
1819 .map_err(|_| fmt::Error)?;
1820 visitor.post_visit_plan()?;
1821
1822 visitor.end_graph()?;
1823 Ok(())
1824 }
1825 }
1826 Wrapper(self)
1827 }
1828
1829 /// Return a `format`able structure with the a human readable
1830 /// description of this LogicalPlan node per node, not including

Callers 3

handle_explainMethod · 0.80
csv_explain_plansFunction · 0.80

Calls 1

WrapperClass · 0.70

Tested by 2

csv_explain_plansFunction · 0.64