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

   ### Is your feature request related to a problem or challenge?
   
   `LIKE 'abc%'` is pushed down to Iceberg as `STARTS WITH 'abc'`, with the 
prefix unescaped using `\`, DataFusion's default escape character (#46). A 
`LIKE` with an explicit `ESCAPE` clause is not pushed down at all:
   
   ```sql
   SELECT * FROM t WHERE s LIKE 'a#%b%' ESCAPE '#';  -- could push STARTS WITH 
'a%b'
   ```
   
   The result is correct, since DataFusion filters again, but Iceberg can't use 
the prefix to skip files.
   
   There's a `TODO` for this in `predicate` 
(`crates/datafusion/src/read/predicate.rs`), added in #117.
   
   ### Describe the solution you'd like
   
   Pass the `ESCAPE` character to `like_prefix` and unescape with it instead of 
`\`. A pattern that `like_prefix` can't reduce to a plain prefix is still not 
pushed down.
   
   Tests: unit tests for `like_prefix` with a custom escape character (an 
escaped `%`, an escaped `_`, an escaped escape character, a trailing escape), 
and a sqllogictest that checks the rows returned. `ILIKE` stays unsupported, 
since Iceberg's `STARTS WITH` is case-sensitive.
   
   ### Additional context
   
   Part of the predicate pushdown epic.
   


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