[v0.12.2] Error when using aggregate query and nested expressions
- Lenguaje dominante
- Java
- Estrellas
- 6.4k
- Forks
- 1.2k
- Merge medio
- 1 d 23 h
- PR fusionados (30 d)
- 115
Descripción
**Describe the bug**
When combining an aggregate query with nested expressions, I get an error - e.g.:
```
Msg: 401: Error occurred while parsing SQL to physical plan: line 1:39 mismatched input '+' expecting {'*', '.', ')'}
```
Or:
```
Msg: 401: Error occurred while parsing SQL to physical plan: line 1:7 extraneous input '(' expecting {CREATE, INSERT, UPDATE, DELETE, SELECT, SHOW, GRANT, INTO, SET, WHERE, FROM, TO, BY, DEVICE, CONFIGURATION, DESCRIBE, SLIMIT, LIMIT, UNLINK, OFFSET, SOFFSET, FILL, LINEAR, PREVIOUS, PREVIOUSUNTILLAST, METADATA, TIMESERIES, TIMESTAMP, PROPERTY, WITH, DATATYPE, COMPRESSOR, STORAGE, GROUP, LABEL, INT32, INT64, FLOAT, DOUBLE, BOOLEAN, TEXT, PLAIN, PLAIN_DICTIONARY, RLE, DIFF, TS_2DIFF, GORILLA, REGULAR, ADD, UPSERT, VALUES, NOW, LINK, INDEX, USING, TRACING, ON, OFF, SYSTEM, READONLY, WRITABLE, DROP, MERGE, LIST, USER, PRIVILEGES, ROLE, ALL, OF, ALTER, PASSWORD, REVOKE, LOAD, WATERMARK_EMBEDDING, UNSET, TTL, FLUSH, TASK, INFO, VERSION, REMOVE, MOVE, CHILD, PATHS, DEVICES, COUNT, NODES, LEVEL, MIN_TIME, MAX_TIME, MIN_VALUE, MAX_VALUE, AVG, FIRST_VALUE, SUM, LAST_VALUE, LAST, DISABLE, ALIGN, COMPRESSION, TIME, ATTRIBUTES, TAGS, RENAME, GLOBAL, FULL, CLEAR, CACHE, TRUE, FALSE, UNCOMPRESSED, SNAPPY, GZIP, LZ4, PARTITION, SNAPSHOT, FOR, SCHEMA, DESC, ASC, TOP, '*', OPERATOR_IN, '-', '[', INT, EXPONENT, DURATION, DATETIME, ID, DOUBLE_QUOTE_STRING_LITERAL, SINGLE_QUOTE_STRING_LITERAL}
```
**To Reproduce**
Steps to reproduce the behavior:
1. Add some timelines with data
2. Run a query combining an aggregate query with nested expressions
4. See error
**Expected behavior**
A result should be given containing the calculated values.
**Desktop (please complete the following information):**
- OS: Linux
- Browser n\a
- Version 0.12.2
**Additional context**
I have more than 3 time series with data from `2021-10-18` until today where I ran the following queries:
```
SELECT avg(mp3.1_0_31_7_0.temperature) + avg(mp4.1_0_31_7_0.temperature), avg(mp5.1_0_31_7_0.temperature) from root.test WHERE (time > 2021-11-01T00:05:00.000 and time < 2021-11-01T00:06:00.000) group by ([2021-11-01T00:05:00.000, 2021-11-01T00:06:10.000),1s)
SELECT (avg(mp3.1_0_31_7_0.temperature) + avg(mp4.1_0_31_7_0.temperature)), avg(mp5.1_0_31_7_0.temperature) from root.test WHERE (time > 2021-11-01T00:05:00.000 and time < 2021-11-01T00:06:00.000) group by ([2021-11-01T00:05:00.000, 2021-11-01T00:06:10.000),1s)
```
If there's anything I missed, please let me know. I want to use these queries as continuous query. If there's something I should keep in mind for that, I would appreciate if you'd let me know.
Guía de contribución
Línea de trabajo
Comienza reproduciendo las dos consultas de agregación contra IoTDB v0.12.2 y rastrea el error de análisis de SQL-to-physical-plan. Se considera terminado cuando ambas consultas, incluidas las expresiones anidadas como AVG(...) + AVG(...), devuelvan los valores calculados en lugar de errores del analizador.
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
- 38/100