apache / apache/iotdb

[v0.12.2] Error when using aggregate query and nested expressions

未关闭
#4,311 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Java
星标
6.4k
派生
1.2k
平均合并
1 天 23 小时
30 天内合并 PR
115

描述

**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.

贡献指南

打开贡献指南

调研方向

首先在 IoTDB v0.12.2 上复现这两个聚合查询,并追踪 SQL-to-physical-plan 解析错误。当两个查询(包括 AVG(...) + AVG(...) 等嵌套表达式)都返回计算值而不是解析器错误时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
java, sql
领域
databases
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
38/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。