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

Method display_indent_schema

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

Return a `format`able structure that produces a single line per node that includes the output schema. For example: ```text Projection: employee.id [id:Int32]\ Filter: employee.state = Utf8(\"CO\") [id:Int32, state:Utf8]\ TableScan: employee projection=[0, 3] [id:Int32, state:Utf8]"; ``` ``` use arrow::datatypes::{DataType, Field, Schema}; use datafusion_expr::{col, lit, logical_plan::table_scan,

(&self)

Source from the content-addressed store, hash-verified

1731 /// );
1732 /// ```
1733 pub fn display_indent_schema(&self) -> impl Display + '_ {
1734 // Boilerplate structure to wrap LogicalPlan with something
1735 // that that can be formatted
1736 struct Wrapper<'a>(&'a LogicalPlan);
1737 impl Display for Wrapper<'_> {
1738 fn fmt(&self, f: &mut Formatter) -> fmt::Result {
1739 let with_schema = true;
1740 let mut visitor = IndentVisitor::new(f, with_schema);
1741 match self.0.visit_with_subqueries(&mut visitor) {
1742 Ok(_) => Ok(()),
1743 Err(_) => Err(fmt::Error),
1744 }
1745 }
1746 }
1747 Wrapper(self)
1748 }
1749
1750 /// Return a displayable structure that produces plan in postgresql JSON format.
1751 ///

Calls 1

WrapperClass · 0.70