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

   **Describe the bug**
   When running an aggregate count on an unnested column the 
`aggregate_statistics` optimizer removes `UnnestExec` from the `ExecutionPlan` 
   
   **To Reproduce**
   Given the following data:
   ```
   "+--------------------+",
   "| tags               |",
   "+--------------------+",                                                   
   "|                    |",                                                   
   "| [tag1, tag2, tag3] |",                                                   
   "| [tag1, tag2, tag3] |",
   "| [tag1, tag2]       |",
   "| [tag1]             |",
   "+--------------------+",
   ```
   
   The following aggregation:
   
   ```rust
   df
       .unnest_column("tags")?
       .aggregate(vec![], vec![count(col("tags"))])?
       .show()
       .await?;
   ```
   
   reports 4 rows instead of 9 unnested nested rows (see 
[test](https://github.com/vincev/arrow-datafusion/blob/047803a879e7af7e894280eb9c51edb5f931c249/datafusion/core/tests/dataframe.rs#L640)):
   
   **Expected behavior**
   Aggregate count should count unnested rows. 
   
   **Additional context**
   Add any other context about the problem here.
   


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