duongcongtoai commented on PR #16016:
URL: https://github.com/apache/datafusion/pull/16016#issuecomment-2907779111

   > It's thrown in planning phase, the error is thrown because in planning 
phase, planner can only get the schema info from upper query block.
   
   Ahah, confirmed, given this query
   ```
   SELECT e1.employee_name, e1.salary
   FROM employees e1
   WHERE e1.salary > (
       SELECT AVG(e2.salary)
       FROM employees e2 
       WHERE e2.dept_id = e1.dept_id
       AND e2.salary > (
           SELECT AVG(e3.salary)
           FROM employees e3
           WHERE e3.dept_id = e1.dept_id
       )
   );
   ```
   The optimizor is actually invoked, but with the plan of `EmptyRelation` for 
some reason, we better do something in the planning!


-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to