andygrove opened a new issue, #40:
URL: https://github.com/apache/datafusion-iceberg/issues/40

   ### Describe the bug
   
   `LIKE 'prefix%'` is pushed down as `STARTS WITH 'prefix'` when the prefix 
contains no `%` or `_` 
([expr_to_predicate.rs#L182-L206](https://github.com/apache/datafusion-iceberg/blob/a2bc9427d0659591b5f8122b90fec710fe2f5de6/crates/datafusion/src/physical_plan/expr_to_predicate.rs#L182-L206)).
 DataFusion and Arrow `LIKE` treat `\` as an escape character even without an 
`ESCAPE` clause, when `escape_char` is `None`. A prefix that contains a 
backslash therefore matches something different from the literal string that 
gets pushed down.
   
   ### To Reproduce
   
   ```sql
   -- t(s STRING NOT NULL) with rows 'a%', 'a\b', 'ab'
   SELECT s FROM t WHERE s LIKE 'a\%';
   ```
   
   The pattern matches the literal string `a%`. The pushed predicate is `s 
STARTS WITH "a\"`, and Iceberg returns no rows. The same query on a `MemTable` 
returns `a%`.
   
   ### Expected behavior
   
   Either unescape the prefix the same way Arrow does, or don't push down 
patterns that contain a backslash.
   


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