Hi all,
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|
+----+----------------+——+


Any better Suggestions?




Best
----
Dawei Liu

Reply via email to