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

   ### Is your feature request related to a problem or challenge?
   
   As @adriangb observes in https://github.com/apache/datafusion/pull/12978, 
there is often special case handling for equality predicates like `col = 'foo'`
   
   However, sometimes people (or tools) write queries using the `LIKE` operator:
   
   ```sql
   SELECT ... WHERE col like 'foo'
   ```
   
   
   
   ### Describe the solution you'd like
   
   I think it would be nice if DataFusion's simplifier could simplify such 
expressions to `WHERE col = 'foo'`, something that trino does (see 
https://github.com/trinodb/trino/commit/6aea881752ef9a83521a4a20bccf510bf9a31d2c#diff-3b166584d367d2e1bf2184249d6bad632bb4ecbe18e011f4744fdf629c771ce7R912)
   
   
   ```
   > explain select * from values ('foo'), ('bar') where column1 like 'foo';
   +---------------+---------------------------------------------+
   | plan_type     | plan                                        |
   +---------------+---------------------------------------------+
   | logical_plan  | Filter: column1 LIKE Utf8("foo")            |
   |               |   Values: (Utf8("foo")), (Utf8("bar"))      |
   | physical_plan | CoalesceBatchesExec: target_batch_size=8192 |
   |               |   FilterExec: column1@0 LIKE foo            |
   |               |     ValuesExec                              |
   |               |                                             |
   +---------------+---------------------------------------------+
   2 row(s) fetched.
   Elapsed 0.006 seconds.
   ```
   
   ### Describe alternatives you've considered
   
   _No response_
   
   ### Additional context
   
   @adriangb  has implemented a version of this here: 
https://github.com/apache/datafusion/pull/13061


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