iotdb
iotdb copied to clipboard
[Feature request] 查询时间区间较大范围的数据, 期望可以按每分钟(5分钟)一条数据返回
Search before asking
- [X] I searched in the issues and found nothing similar.
Motivation
版本: <iotdb.version>1.0.0</iotdb.version> 业务场景:
- 查询的时段类型有四种: 一小时, 一天, 一周, 一个月
- 设备的上报频率为1秒钟一次,一天就是86400条数据
- 当我根据时间区间查询一周或一个月的数据, 总是会抛出内存溢出异常
sql
select batteryVoltage, odometer from root.389d79c1a12147deaafca6b8f6b3665c.e1d1896803a34422935517b108d9bce3.03625aa0be1443cdb5bf8af89ebd69fe where time >= 2023-02-17T02:00:00 and time < 2023-02-24T02:00:00
Solution
No response
Alternatives
No response
Are you willing to submit a PR?
- [ ] I'm willing to submit a PR!
Hi, this is your first issue in IoTDB project. Thanks for your report. Welcome to join the community!
you can use group by time
clause.
IoTDB> select batteryVoltage, odometer from root.389d79c1a12147deaafca6b8f6b3665c.e1d1896803a34422935517b108d9bce3.03625aa0be1443cdb5bf8af89ebd69fe where time >= 2023-02-17T02:00:00 and time < 2023-02-24T02:00:00 group by time Msg: 700: Error occurred while parsing SQL to physical plan: line 1:219 no viable alternative at input 'select batteryVoltage, odometer from root.389d79c1a12147deaafca6b8f6b3665c.e1d1896803a34422935517b108d9bce3.03625aa0be1443cdb5bf8af89ebd69fe where time >= 2023-02-17T02:00:00 and time < 2023-02-24T02:00:00 group by time'
总是会报错
IoTDB> select batteryVoltage, odometer from root.389d79c1a12147deaafca6b8f6b3665c.e1d1896803a34422935517b108d9bce3.03625aa0be1443cdb5bf8af89ebd69fe where time >= 2023-02-17T02:00:00 and time < 2023-02-24T02:00:00 group by time Msg: 700: Error occurred while parsing SQL to physical plan: line 1:219 no viable alternative at input 'select batteryVoltage, odometer from root.389d79c1a12147deaafca6b8f6b3665c.e1d1896803a34422935517b108d9bce3.03625aa0be1443cdb5bf8af89ebd69fe where time >= 2023-02-17T02:00:00 and time < 2023-02-24T02:00:00 group by time'
总是会报错
你可以看一下这个文档,里面也有相应的例子,select里面要用聚合函数比如max_value,min_value,avg这些 https://iotdb.apache.org/zh/UserGuide/V1.2.x/User-Manual/Query-Data.html#%E5%88%86%E6%AE%B5%E5%88%86%E7%BB%84%E8%81%9A%E5%90%88-group-by-%E5%AD%90%E5%8F%A5