Druid SQL does not support IN clause with null
- Dominant language
- Java
- Stars
- 14.1k
- Forks
- 3.8k
- Avg merge
- 2d 58m
- Merged PRs (30d)
- 233
Description
### Affected Version
Tested on 0.16, 0.17, 0.18
### Description
The following SQL fails to plan with an ISE
```
SELECT "channel", "cityName", "comment", "count", "countryIsoCode"
FROM "wikipedia"
WHERE
countryIsoCode in ('TN', NULL)
```
The error is in the broker where it is trying to plan the query (stacktrace too long to include here)
Druid In filters support null values, so this should work.
NOTE: when postgres issues a similar query it does not match rows where the column value is null - Druid would probably need to do something similar as well.
Contributor guide
Research direction
Start in the broker's SQL planning path by reproducing the reported query against the affected Druid versions and tracing how an IN list containing NULL is converted to a Druid filter. Done means the query plans without an ISE and preserves the stated SQL behavior of not matching rows whose column value is NULL.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100