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

   **Describe the bug**
   
   I have a query that triggers this error:
   
   ```
   Error: Internal("Optimizer rule 'projection_push_down' failed due to 
unexpected error: Error during planning: Aggregate schema has wrong number of 
fields. Expected 4 got 3")
   ```
   
   Here is some debug output. The query has `group by 
substr(i_item_desc,1,30),i_item_sk,d_date` and we have the correct info here:
   
   ```
   schema = ["substr(item.i_item_desc,Int64(1),Int64(30))", "item.i_item_sk", 
"date_dim.d_date", "COUNT(UInt8(1))"]
   group_expr: [substr(item.i_item_desc, Int64(1), Int64(30)), item.i_item_sk, 
date_dim.d_date]
   aggr_expr: [COUNT(UInt8(1))]
   ```
   
   When the aggregate schema gets created it has dropped the `substr` 
expression:
   
   ```
   new_schema = ["item.i_item_sk", "date_dim.d_date", "COUNT(UInt8(1))"]
   ```
   
   **To Reproduce**
   I am working on a simple repro case.
   
   **Expected behavior**
   Should not fail
   
   **Additional context**
   
   


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