comphead commented on PR #26544:
URL: https://github.com/apache/datafusion/pull/26544#issuecomment-6320008762

   Thanks @jayzhan211 and @adriangb.
   
   @jayzhan211 the schema error with a filter between the aggregates is not 
new. Main hits the same error on the `HAVING` form of that query:
   
   ```sql
   SELECT o.k, (SELECT count(*) FROM (SELECT count(*) AS n FROM 
nested_agg_inner AS i WHERE i.id = o.k HAVING count(*) >= 0))
   FROM nested_agg_outer AS o ORDER BY o.k;
   -- Schema error: Schema contains duplicate unqualified field name 
"count(Int64(1))"
   ```
   
   The `Aggregate` branch kept rebuilding the plan after it set `can_pull_up = 
false`, and the rebuild failed with a schema error. It now stops the rewrite as 
soon as it reaches an aggregate over a pulled up scalar aggregate. The filter 
case and the `HAVING` form now both fail with `Physical plan does not support 
logical expression ScalarSubquery`, at the default `max_passes`. The filter 
case is added as a test.
   
   @adriangb I changed "Closes #26508" to "Part of #26508".
   


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