You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@iotdb.apache.org by "DaweiLiu (Jira)" <ji...@apache.org> on 2020/08/24 11:10:00 UTC
[jira] [Created] (IOTDB-848) support order by time asc/desc
DaweiLiu created IOTDB-848:
------------------------------
Summary: support order by time asc/desc
Key: IOTDB-848
URL: https://issues.apache.org/jira/browse/IOTDB-848
Project: Apache IoTDB
Issue Type: New Feature
Components: Core/Engine
Reporter: DaweiLiu
Assignee: DaweiLiu
Fix For: master branch
I've noticed that some github users have mentioned the need for time-based sorting.
So I would like to discuss the design of this function with you in the email.
We are ready to support the following statements for time-based sorting:
1. select * from root order by time desc
+----+----------------+
|Time|root.liudw.d0.s0|
+----+----------------+
| 4| 100|
| 3| 100|
| 2| 100|
| 1| 100|
+----+----------------+
2. select max_time(s0) from root.liudw.d0 group by ((0,5],1ms) order by time desc
+----+--------------------------+
|Time|max_time(root.liudw.d0.s0)|
+----+--------------------------+
| 5| null|
| 4| 4|
| 3| 3|
| 2| 2|
| 1| 1|
+----+--------------------------+
3. select last_value(s0) from root.liudw.d0 group by ((0,5],1ms) fill (int32[Previous]) order by time desc
+----+----------------------------+
|Time|last_value(root.liudw.d0.s0)|
+----+----------------------------+
| 5| 100|
| 4| 100|
| 3| 100|
| 2| 100|
| 1| 100|
+----+----------------------------+
4. select * from root align by device order by time desc
+----+-------------+---+----+
|Time| Device| s0| s1|
+----+-------------+---+----+
| 4|root.liudw.d0|100|null|
| 3|root.liudw.d0|100| 3|
| 2|root.liudw.d0|100|null|
| 1|root.liudw.d0|100| 1|
+----+-------------+---+----+
5. select * from root disable align order by time desc
+----+----------------+----+----------------+
|Time|root.liudw.d0.s0|Time|root.liudw.d0.s1|
+----+----------------+----+----------------+
| 4| 100| 3| 3|
| 3| 100| 1| 1|
| 2| 100|null| null|
| 1| 100|null| null|
+----+----------------+----+----------------+
6. select last * from root order by time desc
+----+----------------+-----+
|Time| timeseries|value|
+----+----------------+-----+
| 4|root.liudw.d0.s0| 100|
| 3|root.liudw.d0.s1| 3|
+----+----------------+——+
--
This message was sent by Atlassian Jira
(v8.3.4#803005)