Search code examples
apache-iotdb

How to select time field when querying in Apache IoTDB?


Does anyone know how to use query statement to return time field in Apache IoTDB(Internet of Things Database)?

I tried select s_1,time from root.ln.** limit 5 command in IoTDB, & the message reported Fail to execute select s_1,time from root.ln.** limit 5 error.

While the fields & time series are already set in IoTDB. The time field is typically represented by a reserved keyword like time or timestamp.

How can I check the time related to query results in IoTDB?


Solution

  • Unless doing aggregation query, the time column of the query results in Apache IoTDB will be returned by default. For example, if you execute query statement like select s_1 from root.ln.** limit 5, then the result column will look like the following (which should already give you the time data you want) :

    time | s_1
       1 | a
       2 | b
       3 | c
       4 | d
       5 | e