sql select _wstart, count(*) from sliding_tb0 interval(30s) sliding(30s);
sql select _wstart, count(*) from sliding_tb0 interval(3s) sliding(3s);
if $row != 10 then
if $row != 10 then
return -1
return -1
endi
endi
if $data00 != @00-01-01 00:00:00.000@ then
if $data00 != @00-01-01 00:00:00.000@ then
return -1
return -1
endi
endi
if $data01 != 1000 then
if $data01 != 100 then
return -1
return -1
endi
endi
if $data10 != @00-01-01 00:00:30.000@ then
if $data10 != @00-01-01 00:00:03.000@ then
return -1
return -1
endi
endi
if $data11 != 1000 then
if $data11 != 100 then
return -1
return -1
endi
endi
sql select _wstart, stddev(c1) from sliding_tb0 interval(10a) sliding(10a);
sql select _wstart, stddev(c1) from sliding_tb0 interval(10a) sliding(10a);
if $row != 10000 then
if $row != 1000 then
return -1
return -1
endi
endi
if $data00 != @00-01-01 00:00:00.000@ then
if $data00 != @00-01-01 00:00:00.000@ then
...
@@ -123,10 +123,10 @@ if $data91 != 0.000000000 then
...
@@ -123,10 +123,10 @@ if $data91 != 0.000000000 then
endi
endi
sql select _wstart, stddev(c1),count(c2),first(c3),last(c4) from sliding_tb0 interval(10a) sliding(10a) order by _wstart desc;
sql select _wstart, stddev(c1),count(c2),first(c3),last(c4) from sliding_tb0 interval(10a) sliding(10a) order by _wstart desc;
if $row != 10000 then
if $row != 1000 then
return -1
return -1
endi
endi
if $data00 != @00-01-01 00:04:59.970@ then
if $data00 != @00-01-01 00:00:29.970@ then
return -1
return -1
endi
endi
if $data01 != 0.000000000 then
if $data01 != 0.000000000 then
...
@@ -141,7 +141,7 @@ endi
...
@@ -141,7 +141,7 @@ endi
if $data04 != 99 then
if $data04 != 99 then
return -1
return -1
endi
endi
if $data90 != @00-01-01 00:04:59.700@ then
if $data90 != @00-01-01 00:00:29.700@ then
return -1
return -1
endi
endi
if $data91 != 0.000000000 then
if $data91 != 0.000000000 then
...
@@ -157,41 +157,41 @@ if $data94 != 90 then
...
@@ -157,41 +157,41 @@ if $data94 != 90 then
return -1
return -1
endi
endi
sql select _wstart, count(c2),last(c4) from sliding_tb0 interval(30s) sliding(10s) order by _wstart asc;
sql select _wstart, count(c2),last(c4) from sliding_tb0 interval(3s) sliding(1s) order by _wstart asc;
if $row != 32 then
if $row != 32 then
return -1
return -1
endi
endi
if $data00 != @99-12-31 23:59:40.000@ then
if $data00 != @99-12-31 23:59:58.000@ then
print expect 12-31 23:59:40.000, actual: $data00
print expect 12-31 23:59:58.000, actual: $data00
return -1
return -1
endi
endi
if $data01 != 334 then
if $data01 != 34 then
return -1
return -1
endi
endi
if $data02 != 33 then
if $data02 != 33 then
return -1
return -1
endi
endi
sql select _wstart, count(c2),stddev(c3),first(c4),last(c4) from sliding_tb0 where ts>'2000-01-01 0:0:0' and ts<'2000-1-1 0:0:31' interval(30s) sliding(30s) order by _wstart asc;
sql select _wstart, count(c2),stddev(c3),first(c4),last(c4) from sliding_tb0 where ts>'2000-01-01 0:0:0' and ts<'2000-1-1 0:0:4' interval(3s) sliding(3s) order by _wstart asc;
if $row != 2 then
if $row != 2 then
return -1
return -1
endi
endi
if $data04 != 99 then
if $data04 != 99 then
return -1
return -1
endi
endi
if $data01 != 999 then
if $data01 != 99 then
return -1
return -1
endi
endi
if $data02 != 28.837977152 then
if $data02 != 28.577380332 then
return -1
return -1
endi
endi
#interval offset + limit
#interval offset + limit
sql select _wstart, count(c2), first(c3),stddev(c4) from sliding_tb0 interval(10a) sliding(10a) order by _wstart desc limit 10 offset 990;
sql select _wstart, count(c2), first(c3),stddev(c4) from sliding_tb0 interval(10a) sliding(10a) order by _wstart desc limit 10 offset 90;
if $row != 10 then
if $row != 10 then
return -1
return -1
endi
endi
if $data00 != @00-01-01 00:04:30.270@ then
if $data00 != @00-01-01 00:00:27.270@ then
return -1
return -1
endi
endi
if $data01 != 1 then
if $data01 != 1 then
...
@@ -203,7 +203,7 @@ endi
...
@@ -203,7 +203,7 @@ endi
if $data03 != 0.000000000 then
if $data03 != 0.000000000 then
return -1
return -1
endi
endi
if $data90 != @00-01-01 00:04:30.000@ then
if $data90 != @00-01-01 00:00:27.000@ then
return -1
return -1
endi
endi
if $data91 != 1 then
if $data91 != 1 then
...
@@ -217,43 +217,43 @@ if $data93 != 0.000000000 then
...
@@ -217,43 +217,43 @@ if $data93 != 0.000000000 then
endi
endi
#interval offset test
#interval offset test
sql select _wstart, count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(30s) order by _wstart asc limit 1000 offset 1;
sql select _wstart, count(c2),last(c4),stddev(c3) from sliding_tb0 interval(3s) sliding(3s) order by _wstart asc limit 100 offset 1;
if $row != 9 then
if $row != 9 then
return -1
return -1
endi
endi
if $data00 != @00-01-01 00:00:30.000@ then
if $data00 != @00-01-01 00:00:03.000@ then
return -1
return -1
endi
endi
if $data01 != 1000 then
if $data01 != 100 then
return -1
return -1
endi
endi
if $data02 != 99 then
if $data02 != 99 then
return -1
return -1
endi
endi
if $data80 != @00-01-01 00:04:30.000@ then
if $data80 != @00-01-01 00:00:27.000@ then
return -1
return -1
endi
endi
if $data81 != 1000 then
if $data81 != 100 then
return -1
return -1
endi
endi
sql select _wstart, count(c2),last(c4),stddev(c3) from sliding_tb0 where ts>'2000-1-1 0:0:0' and ts<'2000-1-1 0:0:31' interval(30s) sliding(30s) order by _wstart asc limit 1000 offset 0;
sql select _wstart, count(c2),last(c4),stddev(c3) from sliding_tb0 where ts>'2000-1-1 0:0:0' and ts<'2000-1-1 0:0:4' interval(3s) sliding(3s) order by _wstart asc limit 100 offset 0;
if $row != 2 then
if $row != 2 then
return -1
return -1
endi
endi
if $data00 != @00-01-01 00:00:00.000@ then
if $data00 != @00-01-01 00:00:00.000@ then
return -1
return -1
endi
endi
if $data01 != 999 then
if $data01 != 99 then
return -1
return -1
endi
endi
if $data02 != 99 then
if $data02 != 99 then
return -1
return -1
endi
endi
if $data03 != 28.837977152 then
if $data03 != 28.577380332 then
return -1
return -1
endi
endi
if $data10 != @00-01-01 00:00:30.000@ then
if $data10 != @00-01-01 00:00:03.000@ then
return -1
return -1
endi
endi
if $data11 != 34 then
if $data11 != 34 then
...
@@ -266,14 +266,14 @@ if $data13 != 9.810708435 then
...
@@ -266,14 +266,14 @@ if $data13 != 9.810708435 then
return -1
return -1
endi
endi
sql select _wstart, count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by _wstart asc limit 100 offset 1;
sql select _wstart, count(c2),last(c4),stddev(c3) from sliding_tb0 interval(3s) sliding(2s) order by _wstart asc limit 100 offset 1;
if $row != 15 then
if $row != 15 then
return -1
return -1
endi
endi
if $data00 != @00-01-01 00:00:00.000@ then
if $data00 != @00-01-01 00:00:00.000@ then
return -1
return -1
endi
endi
if $data01 != 1000 then
if $data01 != 100 then
return -1
return -1
endi
endi
if $data02 != 99 then
if $data02 != 99 then
...
@@ -282,85 +282,85 @@ endi
...
@@ -282,85 +282,85 @@ endi
if $data03 != 28.866070048 then
if $data03 != 28.866070048 then
return -1
return -1
endi
endi
if $data90 != @00-01-01 00:03:00.000@ then
if $data90 != @00-01-01 00:00:18.000@ then
return -1
return -1
endi
endi
if $data91 != 1000 then
if $data91 != 100 then
return -1
return -1
endi
endi
if $data92 != 99 then
if $data92 != 99 then
return -1
return -1
endi
endi
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by _wstart asc limit 100 offset 5;
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(3s) sliding(2s) order by _wstart asc limit 100 offset 5;
if $row != 11 then
if $row != 11 then
return -1
return -1
endi
endi
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by _wstart asc limit 100 offset 6;
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(3s) sliding(2s) order by _wstart asc limit 100 offset 6;
if $row != 10 then
if $row != 10 then
return -1
return -1
endi
endi
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by _wstart asc limit 100 offset 7;
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(3s) sliding(2s) order by _wstart asc limit 100 offset 7;
if $row != 9 then
if $row != 9 then
return -1
return -1
endi
endi
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by _wstart asc limit 100 offset 8;
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(3s) sliding(2s) order by _wstart asc limit 100 offset 8;
if $row != 8 then
if $row != 8 then
return -1
return -1
endi
endi
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by _wstart asc limit 100 offset 9;
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(3s) sliding(2s) order by _wstart asc limit 100 offset 9;
if $row != 7 then
if $row != 7 then
return -1
return -1
endi
endi
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by _wstart asc limit 100 offset 10;
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(3s) sliding(2s) order by _wstart asc limit 100 offset 10;
if $row != 6 then
if $row != 6 then
return -1
return -1
endi
endi
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by _wstart asc limit 100 offset 11;
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(3s) sliding(2s) order by _wstart asc limit 100 offset 11;
if $row != 5 then
if $row != 5 then
return -1
return -1
endi
endi
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by _wstart asc limit 100 offset 12;
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(3s) sliding(2s) order by _wstart asc limit 100 offset 12;
if $row != 4 then
if $row != 4 then
return -1
return -1
endi
endi
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by _wstart asc limit 100 offset 13;
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(3s) sliding(2s) order by _wstart asc limit 100 offset 13;
if $row != 3 then
if $row != 3 then
return -1
return -1
endi
endi
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by _wstart asc limit 100 offset 14;
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(3s) sliding(2s) order by _wstart asc limit 100 offset 14;
if $row != 2 then
if $row != 2 then
return -1
return -1
endi
endi
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by _wstart asc limit 100 offset 15;
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(3s) sliding(2s) order by _wstart asc limit 100 offset 15;
if $row != 1 then
if $row != 1 then
return -1
return -1
endi
endi
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by _wstart asc limit 100 offset 16;
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(3s) sliding(2s) order by _wstart asc limit 100 offset 16;
if $row != 0 then
if $row != 0 then
return -1
return -1
endi
endi
sql select _wstart, count(c2),last(c4),stddev(c3),spread(c3) from sliding_tb0 where c2 = 0 interval(30s) order by _wstart desc;
sql select _wstart, count(c2),last(c4),stddev(c3),spread(c3) from sliding_tb0 where c2 = 0 interval(3s) order by _wstart desc;
# select count(*), t1, t2, t3, t4, t5, t6 from $stb where t1 > $val1 and t1 < $val2 group by t1, t2, t3, t4, t5, t6 order by t1 asc limit 1 offset 0
# select count(*), t1, t2, t3, t4, t5, t6 from $stb where t1 > $val1 and t1 < $val2 group by t1, t2, t3, t4, t5, t6 order by t1 asc limit 1 offset 0
sqlStr=f"select count(*), t1, t2, t3, t4, t5, t6 from %s where t1 > %d and t1 < %d group by t1, t2, t3, t4, t5, t6 order by t1 asc limit 1 offset 0"%(paraDict["stbName"],val1,val2)
sqlStr=f"select count(*), t1, t2, t3, t4, t5, t6 from %s where t1 > %d and t1 < %d group by t1, t2, t3, t4, t5, t6 order by t1 asc limit 1 offset 0"%(paraDict["stbName"],val1,val2)
print("====sql:%s"%(sqlStr))
# tdLog.info("====sql:%s"%(sqlStr))
tdSql.query(sqlStr)
tdSql.query(sqlStr)
tdSql.checkRows(1)
tdSql.checkRows(1)
tdSql.checkData(0,0,paraDict["rowsPerTbl"])
tdSql.checkData(0,0,paraDict["rowsPerTbl"])
...
@@ -152,7 +152,7 @@ class TDTestCase:
...
@@ -152,7 +152,7 @@ class TDTestCase:
# select count(*), t3, t4 from $stb where t2 like '%' and t1 > 2 and t1 < 5 group by t3, t4 order by t3 desc limit 2 offset 0
# select count(*), t3, t4 from $stb where t2 like '%' and t1 > 2 and t1 < 5 group by t3, t4 order by t3 desc limit 2 offset 0
sqlStr=f"select count(*), t3, t4 from %s where t2 like '%%' and t1 > 2 and t1 < 5 group by t3, t4 order by t3 desc limit 2 offset 0"%(paraDict["stbName"])
sqlStr=f"select count(*), t3, t4 from %s where t2 like '%%' and t1 > 2 and t1 < 5 group by t3, t4 order by t3 desc limit 2 offset 0"%(paraDict["stbName"])
print("====sql:%s"%(sqlStr))
# tdLog.info("====sql:%s"%(sqlStr))
tdSql.query(sqlStr)
tdSql.query(sqlStr)
tdSql.checkRows(2)
tdSql.checkRows(2)
tdSql.checkData(0,0,paraDict["rowsPerTbl"])
tdSql.checkData(0,0,paraDict["rowsPerTbl"])
...
@@ -164,7 +164,7 @@ class TDTestCase:
...
@@ -164,7 +164,7 @@ class TDTestCase:
# select count(*) from $stb where t2 like '%' and t1 > 2 and t1 < 5 group by t3, t4 order by t3 desc limit 1 offset 1
# select count(*) from $stb where t2 like '%' and t1 > 2 and t1 < 5 group by t3, t4 order by t3 desc limit 1 offset 1
sqlStr=f"select count(*) from %s where t2 like '%%' and t1 > 2 and t1 < 5 group by t3, t4 order by t3 desc limit 1 offset 1"%(paraDict["stbName"])
sqlStr=f"select count(*) from %s where t2 like '%%' and t1 > 2 and t1 < 5 group by t3, t4 order by t3 desc limit 1 offset 1"%(paraDict["stbName"])
print("====sql:%s"%(sqlStr))
# tdLog.info("====sql:%s"%(sqlStr))
tdSql.query(sqlStr)
tdSql.query(sqlStr)
tdSql.checkRows(1)
tdSql.checkRows(1)
...
@@ -179,18 +179,18 @@ class TDTestCase:
...
@@ -179,18 +179,18 @@ class TDTestCase:
tb=paraDict["ctbPrefix"]+'0'
tb=paraDict["ctbPrefix"]+'0'
# select _wstart, max(c1) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, -1) limit 10 offset 1
# select _wstart, max(c1) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, -1) limit 10 offset 1
sqlStr=f"select _wstart, max(c1) from %s where ts >= %d and ts <= %d interval(5m) fill(value, -1) limit 10 offset 1"%(tb,ts0,tsu)
sqlStr=f"select _wstart, max(c1) from %s where ts >= %d and ts <= %d interval(5m) fill(value, -1) limit 10 offset 1"%(tb,ts0,tsu)
print("====sql:%s"%(sqlStr))
# tdLog.info("====sql:%s"%(sqlStr))
tdSql.query(sqlStr)
tdSql.query(sqlStr)
tdSql.checkRows(10)
tdSql.checkRows(10)
tdSql.checkData(0,0,"18-09-17 09:05:00.000")
tdSql.checkData(0,0,"2018-09-17 09:05:00.000")
tdSql.checkData(0,1,-1)
tdSql.checkData(0,1,-1)
tdSql.checkData(1,1,1)
tdSql.checkData(1,1,1)
tdSql.checkData(9,0,"18-09-17 09:50:00.000")
tdSql.checkData(9,0,"2018-09-17 09:50:00.000")
tdSql.checkData(9,1,5)
tdSql.checkData(9,1,5)
tb5=paraDict["ctbPrefix"]+'5'
tb5=paraDict["ctbPrefix"]+'5'
sqlStr=f"select max(c1), min(c2) from %s where ts >= %d and ts <= %d interval(5m) fill(value, -1, -2) limit 10 offset 1"%(tb5,ts0,tsu)
sqlStr=f"select max(c1), min(c2) from %s where ts >= %d and ts <= %d interval(5m) fill(value, -1, -2) limit 10 offset 1"%(tb5,ts0,tsu)