You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "JonyTony (via GitHub)" <gi...@apache.org> on 2023/04/14 07:21:03 UTC

[GitHub] [arrow-datafusion] JonyTony opened a new issue, #6006: logical_plan optimize for MemTable will cost more time when collect dataframe

JonyTony opened a new issue, #6006:
URL: https://github.com/apache/arrow-datafusion/issues/6006

   ### Is your feature request related to a problem or challenge?
   
   I try to read table from MemTable which is large, but when I collect it, datafusion cost more time then expectation.
   I find this is because logical_plan optimize. 
   https://github.com/apache/arrow-datafusion/blob/f9f40bf70a9b6af4345f16b906bcf8a839d5f511/datafusion/core/src/execution/context.rs
   ```rust
   // line 1940
       pub async fn create_physical_plan(
           &self,
           logical_plan: &LogicalPlan,
       ) -> Result<Arc<dyn ExecutionPlan>> {
           let logical_plan = self.optimize(logical_plan)?;
           self.query_planner
               .create_physical_plan(&logical_plan, self)
               .await
       }
   ```
   I find old_plan is TableScan{.., projection: None, ..}, but new_plan is TableScan{.., projection: Some([0,1,2,...]), ..}.
   when I collect data, datafusion use new_plan will cost more time then use old_plan because of MemoryStream::poll_next: 
   https://github.com/apache/arrow-datafusion/blob/f9f40bf70a9b6af4345f16b906bcf8a839d5f511/datafusion/core/src/physical_plan/memory.rs
   ```rust
   // line 203
              let batch = match self.projection.as_ref() {
                  Some(columns) => batch.project(columns)?,
                  None => batch.clone(),
              };
   ```
   
   ### Describe the solution you'd like
   
   _No response_
   
   ### Describe alternatives you've considered
   
   _No response_
   
   ### Additional context
   
   _No response_


-- 
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.apache.org

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


[GitHub] [arrow-datafusion] jiangzhx commented on issue #6006: logical_plan optimize for MemTable will cost more time when collect dataframe

Posted by "jiangzhx (via GitHub)" <gi...@apache.org>.
jiangzhx commented on issue #6006:
URL: https://github.com/apache/arrow-datafusion/issues/6006#issuecomment-1512357161

   @JonyTony would it be possible to share a self contained reproducer?


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