CaptainAni187 opened a new pull request, #46:
URL: https://github.com/apache/datafusion-iceberg/pull/46
Closes #40
Without an `ESCAPE` clause, DataFusion and Arrow treat `\` in a LIKE pattern
as an escape for the next character. The prefix pushdown didn't, so `name LIKE
'a\%'`, which only matches the literal `a%`, was pushed down as `STARTS WITH
"a\"` and Iceberg dropped the matching rows.
This replaces the `ends_with('%')` check with a small `like_prefix` helper
that reads the pattern with Arrow's rules: `\c` is a literal `c`, a trailing
`\` is a literal backslash, and only an unescaped trailing `%` makes it a
prefix pattern. So `'a\%'` is no longer pushed down, `'a\%b\_c%'` becomes
`STARTS WITH "a%b_c"`, and `'a\\%'` becomes `STARTS WITH "a\"`. Patterns
without backslashes are pushed down as before.
Tests: unit tests in `expr_to_predicate.rs` for the escaped cases, and
`like_predicate_pushdown.slt` now runs the query from the issue. Both fail
without the fix; the slt one returns no rows for `LIKE 'Al\%'`.
`cargo fmt --all -- --check`, `cargo clippy --workspace --locked
--all-targets -- -D warnings` and `cargo test --workspace --locked` pass
locally.
--
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]