influxdata / influxdata/influxdb
The Round function in the Where clause fails when combined with binary arithmetic operations.
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 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 \
--bucket db0 \
--precision s "
t0,t0_tag0=initTag t0_f0=0u 1641024000
t0,t0_tag0=initTag t0_f0=1u 1641024001
t0,t0_tag1=initTag t0_f0=0u 1641024000"
```
Next, we use the `Influx v1 shell` command to enter the Influx shell backend and execute two types of query statements:
```
# query 1 success
SELECT round(t0_f0 * 100), t0_tag0 FROM db0.autogen.t0 where TRUE
SELECT round(t0_f0 + 10), t0_tag0 FROM db0.autogen.t0
SELECT t0_f0, t0_tag0 FROM db0.autogen.t0 where round(t0_f0) > 0
# query 2 error
SELECT t0_f0, t0_tag0 FROM db0.autogen.t0 where (round(t0_f0 + 10)) > 0
```
#### Expected behaviour
Query 1.1 is able to retrieve three data points, with t0_f0 multiplied by 100. Query 1.2 can find three data points, with t0_f0 increased by 10. Query 1.3 can find data points where t0_f0 equals 1. Query 2 should be able to retrieve three data points, and the data results should remain unchanged.
#### Actual behaviour
The result of Query 2 is "**No results**." Could this be a logical issue? It seems that the Round function in the Where clause may not work as expected when used with binary arithmetic operations.
#### 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
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
Start by reproducing the two InfluxQL queries in the issue against the stated InfluxDB version, using the provided bucket and points. Trace the Round expression and binary arithmetic evaluation in the query path; done means the parenthesized WHERE expression returns the same three data points as the equivalent successful queries.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100