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

Function plan_to_sql

datafusion/sql/src/unparser/plan.rs:98–101  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

96/// [`SqlToRel::sql_statement_to_plan`]: crate::planner::SqlToRel::sql_statement_to_plan
97/// [`expr_to_sql`]: crate::unparser::expr_to_sql
98pub fn plan_to_sql(plan: &LogicalPlan) -> Result<ast::Statement> {
99 let unparser = Unparser::default();
100 unparser.plan_to_sql(plan)
101}
102
103impl Unparser<'_> {
104 pub fn plan_to_sql(&self, plan: &LogicalPlan) -> Result<ast::Statement> {

Calls 1

plan_to_sqlMethod · 0.80

Used in the wild real call sites across dependent graphs

searching dependent graphs…