apache / apache/iotdb

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

Abierto
#17,108 3 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Java
Estrellas
6.4k
Forks
1.2k
Merge medio
1 d 23 h
PR fusionados (30 d)
115

Descripción

### 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!

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza localizando el punto de entrada de la cláusula SQL GROUP BY y el manejo de los límites finales de los intervalos. Reproduce los ejemplos del issue y, después, verifica que se acepte un ] de cierre y que se incluyan los datos exactamente en la marca de tiempo final sin cambiar el comportamiento existente de [start, end).

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
java, sql
Área
databases
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.