Logical AND Error causing - 305 INTERNAL_SEVER_ERROR
- Dominant language
- Java
- Stars
- 6.4k
- Forks
- 1.2k
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 115
Description
### Search before asking
- [x] I searched in the [issues](https://github.com/apache/iotdb/issues) and found nothing similar.
### Version
version 2.0.5 (Build: 0917050)
### Describe the bug and provide the minimal reproduce step
DELETE DATABASE root.db1;
CREATE DATABASE root.db1;
CREATE TIMESERIES root.db1.t2.c0 INT64;
CREATE TIMESERIES root.db1.t2.c1 INT64;
CREATE TIMESERIES root.db1.t2.c2 INT32;
INSERT INTO root.db1.t2(timestamp, c0, c1, c2) VALUES (1641024000000, 123, 1, 456);
#query 1
SELECT c2 AS ref0, c0 AS ref1 FROM root.db1.t2 WHERE c1 = 1 OR 1=0;
#query 2
SELECT c2 AS ref0, c0 AS ref1 FROM root.db1.t2 WHERE c1 = 1 OR 1!=0;
#query 3
SELECT c2 AS ref0, c0 AS ref1 FROM root.db1.t2 WHERE c1 = 1 AND 1=1;
### What did you expect to see?
query 1 : return 1 result
query2 : return 1 result
query3 : return 1 result
### What did you see instead?
query 1 : return 1 result
query2 : return 1 result
query3 : 305 INTERNAL_SERVER_ERROR
### Anything else?
dear IoTDB team, I found out adding a logically neutral constant to a WHERE clause using AND 1 = 1 causes INTERNAL_SERVER_ERROR (305), while the equivalent OR 1=1 does not.
This looks like the crash is tied to neutral conjuncts in AND
### Are you willing to submit a PR?
- [ ] I'm willing to submit a PR!
Contributor guide
Research direction
Start by running the three SQL reproductions against IoTDB 2.0.5 and compare the AND and OR cases. Trace how the WHERE expression handles constant comparisons, then add regression coverage for query 3; done means all three queries return one result without a 305 error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100