xudong963 commented on a change in pull request #1183:
URL: https://github.com/apache/arrow-datafusion/pull/1183#discussion_r737996977



##########
File path: datafusion/src/execution/dataframe_impl.rs
##########
@@ -56,8 +56,12 @@ impl DataFrameImpl {
     /// Create a physical plan
     async fn create_physical_plan(&self) -> Result<Arc<dyn ExecutionPlan>> {
         let state = self.ctx_state.lock().unwrap().clone();
+        let has_optimized = state.has_optimized;

Review comment:
       I think redundant calls to logical plan optimization will cost 
performance. 
   
   With this implementation, after the first optimization in 
https://github.com/apache/arrow-datafusion/blob/ad059a688fd8da7b360423e0d911f2f1f33dbb9f/datafusion/src/execution/context.rs#L749,
 the `state.has_optimized` will be true. So in `create_physical_plan`, we can 
avoid the redundant optimization for logical plan and directly create a 
physical plan.




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