apache / apache/iotdb

[Bug] 'order by name desc' can't work

Open
#8,905 2 comments 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

1.0.0

### Describe the bug and provide the minimal reproduce step

exec:
'select _state_id_, name from root.G9990002.terminal where _state_id_<='Sck-20-13' order by name desc'

produced a error:
700: Error occurred while parsing SQL to physical plan: line 1:91 no viable alternative at input

However,
select _state_id_, name from root.G9990002.terminal where _state_id_<='Sck-20-13' order by time desc

executed correctly.

### What did you expect to see?

the following sql execute failed:

select _state_id_, name from root.G9990002.terminal where _state_id_<='Sck-20-13' order by name desc

### What did you see instead?

select _state_id_, name from root.G9990002.terminal where _state_id_<='Sck-20-13' order by name desc

can be executed correctly.

### Anything else?

_No response_

### Are you willing to submit a PR?

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

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported query and the working `order by time desc` variant against IoTDB 1.0.0, then trace the SQL parsing path for `order by name desc`. Done means the name-sorted query parses and executes consistently while the existing time-sorted query still works.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.