influxdata / influxdata/influxdb

There is a logical bug with the binary bitwise operation.

Open
#25,457 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

Dear InfluxDB Team, I have a logic bug that I need to report to you.

#### Steps to reproduce

In the latest version of InfluxDB, if we have an organization named "**organization**", we can use the Influx client to execute the following commands to create a bucket and write the specified data into that bucket.

```
influx bucket delete --name db0
influx bucket create --name db0 --org organization

influx write \
-b db0 \
-o organization \
-p ns \
't0,t0_tag0=initTag t0_f0=0u 1641024000
t0,t0_tag0=initTag t0_f0=1u 1641024001
t0,t0_tag0=initTag t0_f0=2u 1641024002
t0,t0_tag0=initTag t0_f0=3u 1641024003
t0,t0_tag0=initTag t0_f0=4u 1641024004'
```

Next, we use the `Influx v1 shell` command to enter the Influx shell backend and execute four types of query statements:

```
# query 1 success
SELECT t0_f0, t0_tag0 FROM db0.autogen.t0 WHERE (('a') | ('219565529'))

# query 2 success
SELECT t0_f0, t0_tag0 FROM db0.autogen.t0 WHERE ((t0_tag0) | ('219565529')) != TRUE
SELECT t0_f0, t0_tag0 FROM db0.autogen.t0 WHERE ((t0_tag0) | ('219565529')) ^ TRUE

# query 3 success
SELECT t0_f0, t0_tag0 FROM db0.autogen.t0 WHERE ((t0_tag0) | ('219565529')) != FALSE

# query 4 error
SELECT t0_f0, t0_tag0 FROM db0.autogen.t0 WHERE ((t0_tag0) | ('219565529'))
```

#### Expected behaviour

When performing a bitwise OR operation on the field **t0_tag0**, Query 1 cannot retrieve any data, Query 2 can retrieve all the data, and Query 3 cannot retrieve any data. Therefore, Query 4 should not retrieve any data either, as the clause `((t0_tag0) | ('219565529'))` returns FALSE.

#### Actual behaviour

Query 1 and Query 3 return "No Results," while Query 2 can retrieve all the data. However, Query 4 does not meet expectations, as it retrieves all the data. Could this suggest a logical issue with the binary bitwise operator? I would appreciate your insights on this matter.

#### Environment info

Influx CLI dev (git: a79a2a1b825867421d320428538f76a4c90aa34c) build_date: 2024-04-16T14:34:32Z

InfluxDB OSS v2.7.11 (git: [fbf5d4a](https://github.com/influxdata/influxdb/commit/fbf5d4ab5e65d3a3661aa52e1d05259d19a6a81b))

Linux 5.15.0-94-generic x86_64

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the four queries through the Influx v1 shell after creating the db0 bucket and sample data with the listed CLI commands. Trace the binary bitwise OR expression handling and compare query 4 with the other three; done means query 4 returns no data and the behavior is covered by a regression test.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.