tdSql.query("select count(*) from (select * from dev_001) session(ts,5a)")
tdSql.checkRows(15)
tdSql.checkData(0,1,2)
# session(ts,1s)
tdSql.query("select count(*) from dev_001 session(ts,1s)")
tdSql.checkRows(12)
tdSql.checkData(0,1,5)
# session(ts,1s) main query
tdSql.query("select count(*) from (select * from dev_001) session(ts,1s)")
tdSql.checkRows(12)
tdSql.checkData(0,1,5)
tdSql.query("select count(*) from dev_001 session(ts,1000a)")
tdSql.checkRows(12)
tdSql.checkData(0,1,5)
tdSql.query("select count(*) from (select * from dev_001) session(ts,1000a)")
tdSql.checkRows(12)
tdSql.checkData(0,1,5)
# session(ts,1m)
tdSql.query("select count(*) from dev_001 session(ts,1m)")
tdSql.checkRows(9)
tdSql.checkData(0,1,8)
# session(ts,1m)
tdSql.query("select count(*) from (select * from dev_001) session(ts,1m)")
tdSql.checkRows(9)
tdSql.checkData(0,1,8)
# session(ts,1h)
tdSql.query("select count(*) from dev_001 session(ts,1h)")
tdSql.checkRows(6)
tdSql.checkData(0,1,11)
# session(ts,1h)
tdSql.query("select count(*) from (select * from dev_001) session(ts,1h)")
tdSql.checkRows(6)
tdSql.checkData(0,1,11)
# session(ts,1d)
tdSql.query("select count(*) from dev_001 session(ts,1d)")
tdSql.checkRows(4)
tdSql.checkData(0,1,13)
# session(ts,1d)
tdSql.query("select count(*) from (select * from dev_001) session(ts,1d)")
tdSql.checkRows(4)
tdSql.checkData(0,1,13)
# session(ts,1w)
tdSql.query("select count(*) from dev_001 session(ts,1w)")
tdSql.checkRows(2)
tdSql.checkData(0,1,15)
# session(ts,1w)
tdSql.query("select count(*) from (select * from dev_001) session(ts,1w)")
tdSql.checkRows(2)
tdSql.checkData(0,1,15)
# session with where
tdSql.query("select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1),spread(tagtype),stddev(tagtype),percentile(tagtype,0) from dev_001 where ts <'2020-05-20 0:0:0' session(ts,1d)")
tdSql.checkRows(2)
tdSql.checkData(0,1,13)
tdSql.checkData(0,2,1)
...
...
@@ -97,6 +132,20 @@ class TDTestCase:
tdSql.checkData(0,11,1)
tdSql.checkData(1,11,14)
# session with where main
tdSql.query("select count(*),first(tagtype),last(tagtype),avg(tagtype),sum(tagtype),min(tagtype),max(tagtype),leastsquares(tagtype, 1, 1) from (select * from dev_001 where ts <'2020-05-20 0:0:0') session(ts,1d)")