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

   ### Describe the bug
   
   ```
   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    --------┘
       )
   );
   ```
   Query execution fails for correlated subqueries with a depth exceeding 1, 
generation error as follows:
   ```
   Schema error: No field named e1.dept_id. Did you mean 'e3.dept_id'?.
   ```
   
   ### To Reproduce
   
   _No response_
   
   ### Expected behavior
   
   _No response_
   
   ### Additional context
   
   _No response_


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