jayzhan211 commented on PR #15281:
URL: https://github.com/apache/datafusion/pull/15281#issuecomment-2764487737

   ```
   For query,
   select e.b ,(select case when max(e2.a) > 10 then 'a' else 'b' end from t e2 
where e2.b = e.b+1 ) from t e;
   
   After `SimplifyExpressions`, we know e2.b = 2.b + 1 is false, since they are 
the same column. And, then we can infer taht max(e2.a) is NULL.
   select e.b ,(select case when max(e2.a) > 10 then 'a' else 'b' end from t e2 
where e2.b = e.b+1 ) from t e;
   
   we can optimize this query into
   select e.b ,(select case when NULL > 10 then 'a' else 'b' end from t e2 
where e2.b = e.b+1 ) from t e;
   ```
   
   ```
   For query,
   select e.b ,(select case when max(e2.a) > 10 then 'a' else 'b' end from t2 
e2 where e2.b = e.b+1 ) from t1 e;
   
   We can't do anything
   ```


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

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