findepi commented on issue #11773:
URL: https://github.com/apache/datafusion/issues/11773#issuecomment-2633164055

   > I cannot use `UNNEST` inside a subquery:
   > 
   > > SELECT id, (SELECT * FROM UNNEST(arr) LIMIT 1) FROM 
   >     (
   >       SELECT 1 id, array [1, 2] arr
   >         UNION
   >       SELECT 2 id, array [] arr
   >     ) rows;
   
   This currently compiles, but doesn't run
   
   ```
   DataFusion CLI v45.0.0
   > SELECT id, (SELECT * FROM UNNEST(arr) LIMIT 1) FROM
       (
         SELECT 1 id, array [1, 2] arr
           UNION
         SELECT 2 id, array [] arr
       ) rows;
   Internal error: Physical input schema should be the same as the one 
converted from logical input schema. Differences:
        - field nullability at index 1 [arr]: (physical) false vs (logical) 
true.
   This was likely caused by a bug in DataFusion's code and we would welcome 
that you file an bug report in our issue tracker
   ```
   
   This error looks like same as /similar to 
https://github.com/apache/datafusion/issues/13190
   I guess the original problem was fixed in 
https://github.com/apache/datafusion/pull/13523
   
   
   > or can I use `UNNEST` in a subquery on the right hand side of `EXISTS`:
   > 
   > > SELECT id FROM 
   >     (
   >       SELECT 1 id, array [1, 2] arr
   >         UNION
   >       SELECT 2 id, array [] arr
   >     ) rows
   >   WHERE EXISTS (SELECT 1 FROM UNNEST(arr));
   > 
   > check_analyzed_plan
   > caused by
   > Error during planning: Unsupported operator in the subquery plan.
   
   This still doesn't work.
   Supporting unnest decorelation ([e.g. like in 
Trino](https://github.com/trinodb/trino/pulls?q=is%3Apr+decorrelate+unnest+is%3Amerged))
 would indeed be cool.
   


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