alamb commented on issue #16697:
URL: https://github.com/apache/datafusion/issues/16697#issuecomment-3057055273

   Thank you for this well written ticket
   
   I agree that for a predicate like
   ```sql
   WHERE ((col1 = 'category_1' AND col2 = 'type_1') 
       OR (col1 = 'category_2' AND col2 = 'type_2'))
   ```
   
   That it requires `col1` to be either `category_1` or `category_2`. Similarly 
`col2` must be in `type_1` or `type_2`
   
   
   I think the pattern to look for is an OR chain where *every* clause has a 
LiteralGuarantee for a column
   
   For example, I don't think the same result holds for this:
   
   ```sql
   WHERE ((col1 = 'category_1' AND col2 = 'type_1') 
       OR (col1 = 'category_2' AND col2 = 'type_2'))
       OR (col2 = 'type_3') --  doesn't refer to col1
   ```
   
   Here is the code that extracts the guarantees 
   
   
https://github.com/apache/datafusion/blob/54592e89f08424ef29c33393fda5de7cfe9d4ab4/datafusion/physical-expr/src/utils/guarantee.rs#L110-L119


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