Hi Dawei, Great work! Supporting order by time desc in the six query will meet most users' need.
The align by device query will also be easily supported based on these. Thanks, -- Jialin Qiao School of Software, Tsinghua University 乔嘉林 清华大学 软件学院 > -----原始邮件----- > 发件人: "Dawei Liu" <[email protected]> > 发送时间: 2020-08-24 14:13:50 (星期一) > 收件人: "[email protected]" <[email protected]> > 抄送: > 主题: The semantic and functional design of 'ORDER BY TIME DESC/ASC' > > 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
