Convert a DataFusion [`LogicalPlan`] to [`ast::Statement`] This function is the opposite of [`SqlToRel::sql_statement_to_plan`] and can be used to, among other things, to convert `LogicalPlan`s to SQL strings. # Errors This function returns an error if the plan cannot be converted to SQL. # See Also [`expr_to_sql`] for converting [`Expr`], a single expression to SQL # Example ``` use arrow::
(plan: &LogicalPlan)
| 96 | /// [`SqlToRel::sql_statement_to_plan`]: crate::planner::SqlToRel::sql_statement_to_plan |
| 97 | /// [`expr_to_sql`]: crate::unparser::expr_to_sql |
| 98 | pub fn plan_to_sql(plan: &LogicalPlan) -> Result<ast::Statement> { |
| 99 | let unparser = Unparser::default(); |
| 100 | unparser.plan_to_sql(plan) |
| 101 | } |
| 102 | |
| 103 | impl Unparser<'_> { |
| 104 | pub fn plan_to_sql(&self, plan: &LogicalPlan) -> Result<ast::Statement> { |
searching dependent graphs…