influxdata / influxdata/influxdb

Filter with == comparison to boolean value always returns true

Open
#16,675 0 comments 0 reactions 0 assignees View on GitHub
kind/bug
Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

__Steps to reproduce:__

1. Insert `cpu,:a=a :type=":a" 1579907813612`
2. Run the Flux query:
```
from(bucket:"test")
|> range(start:1969-12-31T00:00:00Z,stop:1970-01-02T00:00:00Z)
|> filter(fn:(r) => r[":a"] == false)
```
3. The point has the tag value of `":a"` set to `"a"` and the filter is filtering for `r[":a"] == false`. The predicate is incorrectly returning true. The query will also return the same point if the predicate is set to `r[":a"] == true`.
```csv
#datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,double,string,string
#group,false,false,true,true,false,false,true,true
#default,_result,,,,,,,
,result,table,_start,_stop,_time,_value,_field,_measurement
,,0,1969-12-31T00:00:00Z,1970-01-02T00:00:00Z,1970-01-01T00:00:00Z,0.1,cpu,a
```
4. Run the below query
```
from(bucket:"test")
|> range(start:1969-12-31T00:00:00Z,stop:1970-01-02T00:00:00Z)
|> limit(n: 100)
|> filter(fn:(r) => r[":a"] == false)
```
5. Note there are no results and the query worked correctly. @jsternberg notes that this indicates "the flux filter code is correct, but when the filter gets pushed down into the influxdb storage engine, it interprets it incorrectly"

__Expected behavior:__
No results returned.

__Actual behavior:__
One row is returned.

__Environment info:__

Using InfluxDB Cloud v2

Contributor guide

Open the contributing guide

Research direction

Start by comparing the Flux filter behavior with the pushed-down filter path in the InfluxDB storage engine. Reproduce the query using the supplied data and verify that comparisons of the string tag value with both true and false return no rows, while the non-pushed-down query already behaves correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.