seddonm1 commented on code in PR #9606:
URL: https://github.com/apache/arrow-datafusion/pull/9606#discussion_r1525494181


##########
datafusion/sql/src/unparser/plan.rs:
##########
@@ -176,7 +250,9 @@ impl Unparser<'_> {
                 )
             }
             LogicalPlan::Aggregate(_agg) => {

Review Comment:
   @devinjdangelo 
   I have done a lot of work on this problem independently - although I think 
this approach of trying to rebuild the sqlparser-rs AST and then using it to 
generate SQL is nicer.
   
   Regarding your questions you start to see all kinds of crazy plans when you 
start trying to unwind aggregations:
   
   ```sql
   // Projection: pc.contacttypeid, ctypename, nocontacts
   //   Sort: COUNT(*) AS nocontacts DESC NULLS FIRST
   //     Projection: pc.contacttypeid, pc.name AS ctypename, COUNT(*) AS 
nocontacts, COUNT(*)
   //       Filter: COUNT(*) >= Int64(100)
   //         Aggregate: groupBy=[[pc.contacttypeid, pc.name]], 
aggr=[[COUNT(*)]]
   ```



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