apache / apache/iotdb

NOT trigger 305 INTERNAL ERROR instead of "Syntax Error"

Open
#16,437 1 comment 0 reactions 0 assignees View on GitHub
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.min;
CREATE DATABASE root.min;

CREATE ALIGNED TIMESERIES root.min.d1 (c0 INT64);
INSERT INTO root.min.d1(time, c0) VALUES (1641025977946, 1);

--query 1
SELECT c0 FROM root.min.d1
WHERE time BETWEEN 1641025977946 AND 1641026043074;

-- query 2
SELECT c0 FROM root.min.d1
WHERE time NOT BETWEEN 1641025977946 AND 1641026043074;

-- query 3
SELECT c0 FROM root.min.d1
WHERE NOT (time BETWEEN 1641025977946 AND 1641026043074);

-- query 4

SELECT c0 FROM root.min.d1
WHERE time BETWEEN 1641025977946 AND NOT 1641026043074;

### What did you expect to see?

query 1: retrurn 1 result

query 2: retrurn empty

query 3: retrurn empty

query 4: retrurn syntax error

### What did you see instead?

query 1: retrurn 1 result

query 2: retrurn empty

query 3: retrurn empty

query 4: retrurn 305 INTERNAL SERVER ERROR

Image

### Anything else?

BETWEEN A AND NOT B, should returning a clear syntax error instead of a 305.

### Are you willing to submit a PR?

- [ ] I'm willing to submit a PR!

Contributor guide

Open the contributing guide

Research direction

Start by running the four SQL queries from the issue against IoTDB 2.0.5 and compare the parser response for query 4 with the other queries. Trace how the invalid `BETWEEN ... AND NOT ...` input becomes a 305 error; done means it returns a clear syntax error instead.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.