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

   ### Is your feature request related to a problem or challenge?
   
   This is perfectly valid use of scalar subquery without aggregation. 
   This should work in DataFusion
   
   ```sql
   WITH src AS (
       SELECT *
       FROM (VALUES
           (1, NULL, 'Europe'),
           (2, 1, 'Warsaw'),
           (3, 1, 'Paris')
       ) t(id, parent_id, name)
   )
   SELECT
       id,
       name,
       (SELECT p.name FROM src p WHERE p.id = s.parent_id) AS parent_name
   FROM src s;
   ```
   
   Currently this fails with
   
   ```
   Invalid (non-executable) plan after Analyzer
   caused by
   Error during planning: Correlated scalar subquery must be aggregated to 
return at most one row
   ```
   
   ### Describe the solution you'd like
   
   _No response_
   
   ### Describe alternatives you've considered
   
   _No response_
   
   ### Additional context
   
   - https://github.com/apache/datafusion/issues/16134


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