apache / apache/druid

Incorrect results (including nulls) when querying string column with col <> '' and col is not null

Open
#10,525 3 comments 1 reaction 0 assignees View on GitHub
Area - SQL Bug
Dominant language
Java
Stars
14.1k
Forks
3.8k
Avg merge
2d 58m
Merged PRs (30d)
233

Description

### Affected Version
0.18.0 and 0.20.0

### Description
For druid 0.18.0 and config useDefaultValueForNull to false, querying a table with condition on string column (lets say col) with condition like col <> '' and col is not null returns rows with that column null. Both of these conditions behave correctly if passed separately but when together, nulls are not filtered at all.
- Cluster size
Local docker setup
- Configurations in use
useDefaultValueForNull is False
- Steps to reproduce the problem
1. Setup local druid 0.18.0 using docker setup
2. Load example data viz. wikipedia
3. Query: select * from wikipedia where cityName is not null and cityName <> '' limit 100
- The error message or stack traces encountered.
In the results you can see rows with cityName null as well
- Any debugging that you have already done
I tested it with version 0.18.0 and 0.20.0 and both have these issue

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue using the local Docker setup, the stated useDefaultValueForNull=false configuration, and the Wikipedia query with both predicates. Trace how the combined `cityName is not null` and `cityName <> ''` conditions are evaluated, then verify that the result contains no null cityName rows in both affected versions.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, java, sql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.