The Round function in the Where clause fails when combined with binary arithmetic operations.
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. Do other functions also exhibit similar behavior?
Environment info
Influx CLI dev (git: none) build_date: 2023-04-28T14:24:14Z
InfluxDB OSS v2.7.10 (git: f302d97)
Linux 5.15.0-94-generic x86_64