punya opened a new issue, #27685:
URL: https://github.com/apache/datafusion/issues/27685

   ### Describe the bug
   
   `unnest` in the `GROUP BY` of a `|> AGGREGATE` fails during type coercion. 
The same grouping works in a normal `SELECT`.
   
   ### To Reproduce
   
   ```sql
   CREATE TABLE t AS SELECT * FROM (VALUES (1, [1, 2]), (2, [3])) AS t(k, xs);
   SELECT * FROM t |> AGGREGATE count(*) AS c GROUP BY unnest(xs) AS x;
   ```
   
   ```
   type_coercion
   caused by
   This feature is not implemented: Unnest should be rewritten to 
LogicalPlan::Unnest before type coercion
   ```
   
   Without pipes, this works:
   
   ```sql
   SELECT unnest(xs) AS x, count(*) AS c FROM t GROUP BY unnest(xs);
   ```
   
   ### Expected behavior
   
   ```
   x,c
   1,1
   2,1
   3,1
   ```
   
   ### Additional context
   
   Same cause as #27681: `|> AGGREGATE` builds the aggregate directly and skips 
the `GROUP BY` unnest rewrite a normal `SELECT` gets. Part of #14660.
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to