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

   ### Describe the bug
   
   Error is thrown inside `FilterExec`, if the direct child is a 
`NestedLoopJoinExec`, which has a mismatch between its statistics and schema
   ```
   1. query failed: DataFusion error: ProjectionPushdown
   caused by
   Internal error: Could not create `ExprBoundaries`: in `try_from_column` 
`col_index`
                   has gone out of bounds with a value of 2, the schema has 2 
columns.
   [SQL] select t1.t1_int from t1 left join (
       select * from t1 left join (
           select count(*) cnt ,t1_int from t1 left join t2 
               on t2.t2_int is not distinct from t1_int group by t1_int 
       ) temp on t1.t1_int is not distinct from temp.t1_int
   ) a on t1.t1_int=a.t1_int where a.cnt=0
   ---
   
   ```
   
   ### To Reproduce
   
   ```
   statement ok
   CREATE TABLE t1(t1_id INT, t1_name TEXT, t1_int INT) AS VALUES
   (11, 'a', 1),
   (22, 'b', 2),
   (33, 'c', 3),
   (44, 'd', 4);
   
   statement ok
   CREATE TABLE t2(t2_id INT, t2_name TEXT, t2_int INT) AS VALUES
   (11, 'z', 3),
   (22, 'y', 1),
   (44, 'x', 3),
   (55, 'w', 3);
   
   
   
   
   
   query TT
   explain with temp as (
    select count(*) cnt ,t1_int from t1 left join t2 
           on t2.t2_int is not distinct from t1_int group by t1_int 
   )
   select t1.t1_int from t1 left join (
       select * from t1 left join 
       temp on t1.t1_int is not distinct from temp.t1_int
   ) a on t1.t1_int=a.t1_int where a.cnt=0
   ---
   ```
   
   ### 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: [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