gruuya commented on code in PR #4958:
URL: https://github.com/apache/arrow-datafusion/pull/4958#discussion_r1081432997


##########
datafusion/core/src/execution/context.rs:
##########
@@ -1729,6 +1741,15 @@ impl SessionState {
         query.statement_to_plan(statement)
     }
 
+    /// Creates a [`LogicalPlan`] from the provided SQL string
+    ///
+    /// See [`SessionContext::sql`] for a higher-level interface that also 
handles DDL
+    pub async fn create_logical_plan(&self, sql: &str) -> Result<LogicalPlan> {
+        let statement = self.sql_to_statement(sql)?;
+        let plan = self.statement_to_plan(statement).await?;
+        Ok(plan)
+    }

Review Comment:
   That's a fair point; let me see if I can make a self-contained example for 
the usecase we have and then try my luck with a PR. 
   
   Namely, we use `sql_to_expr` to 
[convert](https://github.com/splitgraph/seafowl/blob/main/src/context.rs#L1173) 
the `WHERE` clauses in `UPDATE` and `DELETE` statements from sqlparser `Expr`s 
into Datafusion `Expr`s during logical planning. Subsequently, during physical 
planning of our custom logical extension nodes for `UPDATE` and `DELETE` we 
employ these expressions in order to achieve the desired action using available 
Datafusion primitives (pruning, scanning, filtering, etc.).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to