[v0.12.2] Error when using aggregate query and nested expressions
- Langage dominant
- Java
- Étoiles
- 6.4k
- Forks
- 1.2k
- Merge moyen
- 1 j 23 h
- PR mergées (30 j)
- 115
Description
**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.
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par reproduire les deux requêtes d’agrégation avec IoTDB v0.12.2 et retracez l’erreur d’analyse SQL-to-physical-plan. C’est terminé lorsque les deux requêtes, y compris les expressions imbriquées telles que AVG(...) + AVG(...), renvoient les valeurs calculées au lieu d’erreurs de l’analyseur.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- java, sql
- Domaine
- databases
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 38/100