influxdata / influxdata/influxdb
The syntax validation for bitwise operations is incorrect
- 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 \
-b db0 \
-o organization \
-p ns \
't0,t0_tag0=initTag t0_f0=1.2 1641024000
t0,t0_tag0=initTag t0_f0=1.3 1641024001
t0,t0_tag0=initTag t0_f0=2.1 1641024002'
Next, we use the Influx v1 shell command to enter the Influx shell backend and execute four types of query statements:
# query1 syntax error
SELECT t0_f0 | 1 FROM db0.autogen.t0
# query2 success
SELECT * FROM db0.autogen.t0 WHERE t0_f0 | 1
Expected behaviour
Both Query 1 and Query 2 should report syntax errors.
Actual behaviour
When Query 1 performs a bitwise operation, it prompts the user with a syntax error, indicating that bitwise operations between floating-point and integer types are not supported. However, Query 2 executes successfully and returns an empty set without any additional prompts, which may confuse the user.
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
Research direction
Start by reproducing the issue with the supplied bucket commands and the two InfluxQL queries in the Influx v1 shell. Trace how bitwise operands are validated in each query context, then verify that both queries reject the floating-point and integer combination with a syntax error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100