jackwener opened a new pull request #2084:
URL: https://github.com/apache/arrow-datafusion/pull/2084


   # Which issue does this PR close?
   
   Closes #2045 .
   
    # Rationale for this change
   
   related: #1315
   
   # What changes are included in this PR?
   
   Eliminate distinct in the aggregate instead of rewrite
   
   Now the target is rewrite from
   
   ```sql
   | initial_logical_plan | Projection: #Max(DISTINCT test.c1)                  
   
   |                      |   Aggregate: groupBy=[[]], aggr=[[Max(DISTINCT 
#test.c1)]]                      
   |                      |     TableScan: test projection=None
   ```
   to
   ```sql
   | initial_logical_plan | Projection: #Max(DISTINCT test.c1)
   |                      |   Projection: #Max(#test.c1) AS Max(DISTINCT 
test.c1)                   
   |                      |     Aggregate: groupBy=[[]], aggr=[[Max(#test.c1)]] 
               
   |                      |       TableScan: test projection=None
   ```
   instead of 
   
   ```sql
   | logical_plan  | Projection: #Max(DISTINCT test.c1)          
   |               |   Projection: #Max(alias1) AS Max(DISTINCT test.c1)     
   |               |     Aggregate: groupBy=[[]], aggr=[[Max(#alias1)]]        
   |               |       Aggregate: groupBy=[[#test.c1 AS alias1]], aggr=[[]] 
                       
   |               |       Aggregate: groupBy=[[#test.c1 AS alias1]], aggr=[[]] 
 
   |               |         TableScan: test projection=Some([0])
   ```
   
   # Are there any user-facing changes?
   None
   


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