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()
           )))?;
           // create a query planner
           let state = self.state.lock().clone();
           let query_planner = SqlToRel::new(&state);
           query_planner.statement_to_plan(stmt)
   ```




-- 
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