alamb commented on issue #5325:
URL: 
https://github.com/apache/arrow-datafusion/issues/5325#issuecomment-1455078418

   Hi @yjshen 
   
   Here was my understanding of what you were proposing, which shows the 
diamond I am referring to.
   
   I may be misunderstanding your proposal;
   
   ```sql
   SELECT date, 
     COUNT(DISTINCT x), 
     COUNT(DISITNCT y)
   FROM
     t;
   ```
   
   ```
                         ┌─────────────────┐                         
                         │ Combine somehow │   Maybe Join? Could     
                         │    (on date)    │   also be some more     
                         │                 │   optimized version     
                         └─────────────────┘                         
                                  ▲                                  
                                  │                                  
                                  │                                  
               ┌──────────────────┴─────────────────────┐            
               │                                        │            
               │                                        │            
               │                                        │            
   ┌───────────────────────┐                ┌───────────────────────┐
   │     HashAggregate     │                │     HashAggregate     │
   │       gby: date       │                │       gby: date       │
   │     agg: COUNT(x)     │                │     agg: COUNT(y)     │
   └───────────────────────┘                └───────────────────────┘
               ▲                                        ▲            
               │                                        │            
               │                                        │            
   ┌───────────────────────┐                ┌───────────────────────┐
   │     HashAggregate     │                │     HashAggregate     │
   │     gby: date, x      │                │     gby: date, y      │
   │      agg: <NONE>      │                │      agg: <NONE>      │
   └───────────────────────┘                └───────────────────────┘
               ▲                                        ▲            
               │                                        │            
               │                                        │            
               └───────────────────┬────────────────────┘            
                                   │                                 
                                   │                                 
                                   │                                 
                       ┌───────────────────────┐                     
                       │         Scan          │                     
                       └───────────────────────┘                     
   ```


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