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

   ### Describe the bug
   
   Queries that use `ANY` / `ALL` subquery comparisons fail at planning time 
with an internal schema error instead of executing.
   
   
   ### To Reproduce
   
   ```
   CREATE TABLE person(id INT, age INT);
     INSERT INTO person VALUES (1, 20), (2, 30), (3, 40);
   
     -- (1) ANY
     SELECT id FROM person WHERE age = ANY (SELECT age FROM person);
   
     -- (2) ALL
     SELECT id FROM person WHERE age <> ALL (SELECT age FROM person);
   ```
   
   Both queries fail at planning time with:
   
     ```
   Optimizer rule 'optimize_projections' failed
     caused by
     Schema error: Schema contains duplicate unqualified field name mark
   ```
   
   ### Expected behavior
   
   `ANY`: `age = ANY (SELECT age FROM person)` is true for every row (each 
row's age is in the set {20, 30, 40}). Expected output: ids 1, 2, 3.
    `ALL`: `age <> ALL (SELECT age FROM person)` is false for every row.  
Expected output: zero rows.
   
   
   
   ### 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: [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