You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/03/09 03:48:11 UTC

[GitHub] [arrow-datafusion] houqp commented on a change in pull request #1945: omit some clone when converting sql to logical plan

houqp commented on a change in pull request #1945:
URL: https://github.com/apache/arrow-datafusion/pull/1945#discussion_r822263562



##########
File path: datafusion/src/execution/context.rs
##########
@@ -311,7 +311,7 @@ impl ExecutionContext {
         // create a query planner
         let state = self.state.lock().clone();
         let query_planner = SqlToRel::new(&state);
-        query_planner.statement_to_plan(&statements[0])
+        query_planner.statement_to_plan(statements.pop().unwrap())

Review comment:
       how about combining the length check and pop logic into a single block to make it more readable? basically something like below:
   
   ```rust
   let stmt = statements.pop().ok_or(Err(DataFusionError::NotImplemented(
       "The context currently only supports a single SQL statement".to_string()
   )))?;
   ```




-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org