jiangzhx commented on issue #5791:
URL: 
https://github.com/apache/arrow-datafusion/issues/5791#issuecomment-1492020465

   
   **logical_plan & physical_plan by SQL**
   ```
   
+---------------+----------------------------------------------------------------------------------------------------------------------------+
   | plan_type     | plan                                                       
                                                                |
   
+---------------+----------------------------------------------------------------------------------------------------------------------------+
   | logical_plan  | Projection: t1.a, t1.b                                     
                                                                |
   |               |   Inner Join: t1.a = __scalar_sq_1.a                       
                                                                |
   |               |     TableScan: t1 projection=[a, b]                        
                                                                |
   |               |     SubqueryAlias: __scalar_sq_1                           
                                                                |
   |               |       Projection: t2.a                                     
                                                                |
   |               |         Filter: COUNT(Int64(1)) > Int64(0)                 
                                                                |
   |               |           Aggregate: groupBy=[[t2.a]], 
aggr=[[COUNT(Int64(1))]]                                                        
    |
   |               |             TableScan: t2 projection=[a]                   
                                                                |
   | physical_plan | ProjectionExec: expr=[a@0 as a, b@1 as b]                  
                                                                |
   |               |   CoalesceBatchesExec: target_batch_size=8192              
                                                                |
   |               |     HashJoinExec: mode=Partitioned, join_type=Inner, 
on=[(Column { name: "a", index: 0 }, Column { name: "a", index: 0 })] |
   |               |       CoalesceBatchesExec: target_batch_size=8192          
                                                                |
   |               |         RepartitionExec: partitioning=Hash([Column { name: 
"a", index: 0 }], 8), input_partitions=8                        |
   |               |           RepartitionExec: 
partitioning=RoundRobinBatch(8), input_partitions=1                             
                |
   |               |             MemoryExec: partitions=1, partition_sizes=[1]  
                                                                |
   |               |       ProjectionExec: expr=[a@0 as a]                      
                                                                |
   |               |         CoalesceBatchesExec: target_batch_size=8192        
                                                                |
   |               |           FilterExec: COUNT(Int64(1))@1 > 0                
                                                                |
   |               |             AggregateExec: mode=FinalPartitioned, gby=[a@0 
as a], aggr=[COUNT(Int64(1))]                                   |
   |               |               CoalesceBatchesExec: target_batch_size=8192  
                                                                |
   |               |                 RepartitionExec: partitioning=Hash([Column 
{ name: "a", index: 0 }], 8), input_partitions=8                |
   |               |                   AggregateExec: mode=Partial, gby=[a@0 as 
a], aggr=[COUNT(Int64(1))]                                      |
   |               |                     RepartitionExec: 
partitioning=RoundRobinBatch(8), input_partitions=1                             
      |
   |               |                       MemoryExec: partitions=1, 
partition_sizes=[1]                                                        |
   |               |                                                            
                                                                |
   
+---------------+----------------------------------------------------------------------------------------------------------------------------+
   ```
   
   
   **logical_plan by dataframe,create physical_plan will failed**
   ```
   +--------------+-------------------------------------------------------+
   | plan_type    | plan                                                  |
   +--------------+-------------------------------------------------------+
   | logical_plan | Filter: (<subquery>) > Int64(0)                       |
   |              |   Subquery:                                           |
   |              |     Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1))]] |
   |              |       Filter: t1.a = t2.a                             |
   |              |         TableScan: t2                                 |
   |              |   TableScan: t1 projection=[a, b]                     |
   +--------------+-------------------------------------------------------+
   
   ```


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