Li Yu Heng
Li Yu Heng

Reputation: 151

How to add time condition to the `count` query statement of the total fields for certain path in Apache IoTDB?

Can time conditions be added to the syntax for counting the total amount of fields under a certain path in Apache IoTDB? I tried command count TIMESERIES root.OLC, and this query is executed successfully, but when I tried count TIMESERIES root.OLC WHERE time >= NOW() -10h and time <= now(), this query is failed to execute. The error message of this query is 700: Error occurred while parsing SQL to physical plan: line 1:59 mismatched input 'time' expecting, prompting that the time keyword is incorrect. If I need to add time condition to this kind of query, how can I write the query statement alternatively?

Upvotes: -1

Views: 33

Answers (1)

caozhijia
caozhijia

Reputation: 478

This feature is expected to be implemented in version 1.3.3 of Apache IoTDB. For alternative now, you can execute select last_value(s1) from root.OLC.** where time >= now() - 10h and time <= now() having last_value(s1) is not null align by device command, and then count the returned number of rows, which should be the total number of fields you need.

Upvotes: 0

Related Questions