Is Not Empty Filter adds an unnecessary clause
Nobody has claimed this yet.
- Dominant language
- Clojure
- Stars
- 49.3k
- Forks
- 6.8k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 653
Description
### Describe the bug
When adding the `Is Not Empty` Filter the generated SQL adds an unnecessary clause
### To Reproduce
1. Go to New -> Question -> Products -> Category is not empty:
The `OR ("PUBLIC"."PRODUCTS"."CATEGORY" IS NULL)` isn't really needed
### Expected behavior
The first condition ensures that CATEGORY is not NULL.
The OR ("CATEGORY" IS NULL) inside the second condition contradicts the outer IS NOT NULL condition.
Since a row cannot be both NULL and NOT NULL, this part effectively does nothing.
So it should be removed
### Logs
None that are relevant
### Information about your Metabase installation
```JSON
1.53 and master
```
### Severity
minor
### Additional context
_No response_
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue through New -> Question -> Products -> Category is not empty and inspect the generated SQL. Confirm the redundant OR ("CATEGORY" IS NULL) clause, then verify that the resulting query still returns the expected products without that clause.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clojure, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100