# 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)