Logical OR causes 305 INTERNAL SERVER 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
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.c1 INT64;
CREATE TIMESERIES root.db1.t2.c3 INT64;
INSERT INTO root.db1.t2(timestamp, c1, c3) VALUES (1707690567134, 1, 10);
#query 1
SELECT c1 AS ref0, c3 AS ref1
FROM root.db1.t2
WHERE (time == 1707690567134) AND (time NOT IN (1658432578669));
#query 2
SELECT c1 AS ref0, c3 AS ref1
FROM root.db1.t2
WHERE ((time == 1707690567134) AND (time NOT IN (1658432578669))) OR TRUE;
#query 3
SELECT c1 AS ref0, c3 AS ref1
FROM root.db1.t2
WHERE ((time == 1707690567134) AND (time NOT IN (1658432578669))) OR 1=1;
### What did you expect to see?
query 1 : return 1 value
query 2 : return same value
query 3 : return same value
### What did you see instead?
query 1 : return 1 value
query 2 : return same value
query 3 : 305 INTERNAL SERVER ERROR
### Anything else?
OR 1=1 works in simple queries, but when combined with a time filter and time NOT IN (...), the query fails with 305 INTERNAL_SERVER_ERROR. The same predicate using OR TRUE runs fine.
### Are you willing to submit a PR?
- [ ] I'm willing to submit a PR!
Contributor guide
Research direction
Start by running the three SQL queries against IoTDB 2.0.5, comparing the working OR TRUE case with the failing OR 1=1 case. Trace the query-planning or expression-evaluation path for time filters combined with NOT IN; done means query 3 returns the same value as queries 1 and 2 instead of a 305 INTERNAL SERVER ERROR.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100