kartik00052 commented on issue #27628:
URL: https://github.com/apache/datafusion/issues/27628#issuecomment-7060941307
Hi @hcrosse, I'd like to work on this if you haven't started yet.
**Proposed approach (two small PRs):**
1. **`EliminateFilter` (primary fix):** extend `is_safe_to_discard` to cover
`Expr::Like` (including `ILIKE`) when its `expr` and `pattern` children are
also safe to discard. `LIKE` is infallible, so `NULL AND s ILIKE 'val_%'` folds
to an empty relation during optimization. Runtime error semantics are
preserved, since fallible expressions such as `1 / x` stay excluded.
2. **`PruningPredicate` (follow-up, if maintainers want it):**
- Treat `Boolean(None)` as always-false only when the sibling conjuncts
are infallible, so `NULL AND <fallible>` still surfaces errors.
- Make `build_inverted_predicate` also reject `has_filter_semantics_only`
on the inverse, so a row group is never falsely marked fully matched.
**Tests:** a sqllogictest for the repro in this issue, plus a unit test for
the `Like` case in `is_safe_to_discard`.
Could a maintainer confirm that fixing the optimizer layer first (1) is the
preferred direction before I open a PR?
--
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]