apache / apache/iotdb

[Bug] Support inclusive end time syntax ] in GROUP BY clause IoTDB 2.0.5

Aperta
#17,108 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Java
Stelle
6.4k
Fork
1.2k
Merge medio
1g 23h
PR unite (30g)
115

Descrizione

### Search before asking

- [x] I searched in the [issues](https://github.com/apache/iotdb/issues) and found nothing similar.

### Version

OS: Ubuntu 24.04 LTS
IoTDB: 2.0.5

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

Currently, the `GROUP BY` clause in IoTDB strictly uses the left-closed, right-open `[start, end)` time interval format. Users often need to include the data point exactly at the end time (e.g., `[start, end])`, but the current syntax does not support using `]` to specify an inclusive end time.

When querying time-series data, it is common to want a precise inclusive range (e.g., from `12:00` to `13:00` inclusive). To achieve this now, users must manually extend the end_time by a small fraction (e.g., `+1ms`) or by a full time interval unit, which is unintuitive and can lead to errors or off-by-one queries.

### What did you expect to see?

Support the standard interval syntax `]` to denote an inclusive end time in the `GROUP BY` clause.

Example:
Allow this syntax:
```SQL
SELECT count(s1) FROM root.sg.d1
GROUP BY ([2026-01-27T12:00:00, 2026-01-27T13:00:00], 1m)
```

### What did you see instead?

Current syntex doesn't allow `]` for end time. I have to use the below syntex:

```SQL
SELECT count(s1) FROM root.sg.d1
GROUP BY ([2026-01-27T12:00:00, 2026-01-27T13:00:00), 1m)
```
but it excludes the value at 13:00:00

### Anything else?

Current Workaround:
Users currently have to modify the timestamp manually:
```SQL
-- Extended by 1ms to capture the last point
GROUP BY ([2026-01-27T12:00:00, 2026-01-27T13:00:00.001), 1m)
```

### Are you willing to submit a PR?

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

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia individuando il punto di ingresso della clausola SQL GROUP BY e la gestione dei limiti finali degli intervalli. Riproduci gli esempi dell'issue, quindi verifica che una ] di chiusura venga accettata e che i dati esattamente al timestamp finale siano inclusi senza modificare il comportamento esistente di [start, end).

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java, sql
Ambito
databases
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.