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

   ### Describe the bug
   
   Some special shapes of queries, namely self joins on structs/json data trip 
up the push down leaf expressions optimiser.
   
   ### To Reproduce
   
   From datafusion-cli:
   
   ```sql
     CREATE TABLE t AS SELECT named_struct('a', 'x', 'b', 'y') AS s, 1 AS id;
   
     SELECT p.s['a'], count(1)
     FROM t p
     LEFT JOIN t c ON p.id = c.id
     WHERE c.s['b'] IS NOT NULL
     GROUP BY 1;
   ```
   
   Will produce:
   
   ```
   Optimizer rule 'push_down_leaf_projections' failed
   caused by
   Schema error: Schema contains qualified field name p.__datafusion_extracted_1
   and unqualified field name __datafusion_extracted_1 which would be ambiguous
   ```
   
   ### Expected behavior
   
   Should output something like:
   
   ```
   +--------+-----------------+
   | p.s[a] | count(Int64(1)) |
   +--------+-----------------+
   | x      | 1               |
   +--------+-----------------+
   ```
   
   ### 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