Lordworms commented on PR #11897:
URL: https://github.com/apache/datafusion/pull/11897#issuecomment-2283118351

   > > > the only way for us to know whether return an empty set or a null is 
in execution
   > > 
   > > 
   > > What is the reason that we could not determine the result in the the 
optimizer? Is there any counter example that does not work if we rewrite 
expression and could only be determined in execution?
   > > InList is one of the example that returns empty set and it is rewritten 
early in ExprSimplifier
   > > ```
   > > query I
   > > select x from t where x IN (1,2,3) AND x IN (4,5);
   > > ----
   > > 
   > > query TT
   > > explain select x from t where x IN (1,2,3) AND x IN (4,5);
   > > ----
   > > logical_plan EmptyRelation
   > > physical_plan EmptyExec
   > > ```
   > 
   > The point is not the optimizer actually, for example(using offical release 
of DF and duckdb) 
![image](https://private-user-images.githubusercontent.com/48054792/356939147-29fa24d8-d9cb-44ab-abb0-05f9bbba7616.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM0MzkyNjAsIm5iZiI6MTcyMzQzODk2MCwicGF0aCI6Ii80ODA1NDc5Mi8zNTY5MzkxNDctMjlmYTI0ZDgtZDljYi00NGFiLWFiYjAtMDVmOWJiYmE3NjE2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODEyVDA1MDI0MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWU3MjAxYjNjNDM4NThmOWI0NDk1ZGRmNGIxZTI0OTU1MWRmNzUzY2U1YzkzYzM4YWZiZmIyNzU0NjExMzUwYjgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.VCB32yNKl71yaiOHZQ_nwgP9MslluL-3eY0VzNWFtCA)
   > 
   > we should generate an empty set when having is true and group_by is a 
constant
   > 
   > I was doing similar optimize things in the begining, but after alamb asked 
me to add tests when having is true. I found out this problem. I think we 
should control the AggExec's behaviour so I added this new field 
`is_global_group_by`
    
   


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