self.check_result_auto_log(f"select c1, c2, c3 , c4, c5 ,c6 from {dbname}.sub1_bound ",f"select log(c1), log(c2) ,log(c3), log(c4), log(c5) ,log(c6) from {dbname}.sub1_bound")
self.check_result_auto_log2(f"select c1, c2, c3 , c4, c5 ,c6 from {dbname}.sub1_bound ",f"select log(c1,2), log(c2,2) ,log(c3,2), log(c4,2), log(c5,2) ,log(c6,2) from {dbname}.sub1_bound")
self.check_result_auto_log__10(f"select c1, c2, c3 , c4, c5 ,c6 from {dbname}.sub1_bound ",f"select log(c1,-10), log(c2,-10) ,log(c3,-10), log(c4,-10), log(c5,-10) ,log(c6,-10) from {dbname}.sub1_bound")
self.check_result_auto_log(None,f"select c1, c2, c3 , c4, c5 ,c6 from {dbname}.sub1_bound ",f"select log(c1), log(c2) ,log(c3), log(c4), log(c5) ,log(c6) from {dbname}.sub1_bound")
self.check_result_auto_log(2,f"select c1, c2, c3 , c4, c5 ,c6 from {dbname}.sub1_bound ",f"select log(c1,2), log(c2,2) ,log(c3,2), log(c4,2), log(c5,2) ,log(c6,2) from {dbname}.sub1_bound")
self.check_result_auto_log(10,f"select c1, c2, c3 , c4, c5 ,c6 from {dbname}.sub1_bound ",f"select log(c1,10), log(c2,10) ,log(c3,10), log(c4,10), log(c5,10) ,log(c6,10) from {dbname}.sub1_bound")
self.check_result_auto_log2(f"select c1, c2, c3 , c3, c2 ,c1 from {dbname}.sub1_bound ",f"select log(c1,2), log(c2,2) ,log(c3,2), log(c3,2), log(c2,2) ,log(c1,2) from {dbname}.sub1_bound")
self.check_result_auto_log(f"select c1, c2, c3 , c3, c2 ,c1 from {dbname}.sub1_bound ",f"select log(c1), log(c2) ,log(c3), log(c3), log(c2) ,log(c1) from {dbname}.sub1_bound")
self.check_result_auto_log(2,f"select c1, c2, c3 , c3, c2 ,c1 from {dbname}.sub1_bound ",f"select log(c1,2), log(c2,2) ,log(c3,2), log(c3,2), log(c2,2) ,log(c1,2) from {dbname}.sub1_bound")
self.check_result_auto_log(None,f"select c1, c2, c3 , c3, c2 ,c1 from {dbname}.sub1_bound ",f"select log(c1), log(c2) ,log(c3), log(c3), log(c2) ,log(c1) from {dbname}.sub1_bound")
self.check_result_auto_log2(f"select abs(abs(abs(abs(abs(abs(abs(abs(abs(c1))))))))) nest_col_func from {dbname}.sub1_bound",f"select log(abs(c1) ,2) from {dbname}.sub1_bound")
self.check_result_auto_log(2,f"select abs(abs(abs(abs(abs(abs(abs(abs(abs(c1))))))))) nest_col_func from {dbname}.sub1_bound",f"select log(abs(c1) ,2) from {dbname}.sub1_bound")
self.check_result_auto_log2(f"select c5 from {dbname}.stb1 order by ts ",f"select log(c5,2) from {dbname}.stb1 order by ts")
self.check_result_auto_log2(f"select c5 from {dbname}.stb1 order by tbname ",f"select log(c5,2) from {dbname}.stb1 order by tbname")
self.check_result_auto_log2(f"select c5 from {dbname}.stb1 where c1 > 0 order by tbname ",f"select log(c5,2) from {dbname}.stb1 where c1 > 0 order by tbname")
self.check_result_auto_log2(f"select c5 from {dbname}.stb1 where c1 > 0 order by tbname ",f"select log(c5,2) from {dbname}.stb1 where c1 > 0 order by tbname")
self.check_result_auto_log(2,f"select c5 from {dbname}.stb1 order by ts ",f"select log(c5,2) from {dbname}.stb1 order by ts")
self.check_result_auto_log(2,f"select c5 from {dbname}.stb1 order by tbname ",f"select log(c5,2) from {dbname}.stb1 order by tbname")
self.check_result_auto_log(2,f"select c5 from {dbname}.stb1 where c1 > 0 order by tbname ",f"select log(c5,2) from {dbname}.stb1 where c1 > 0 order by tbname")
self.check_result_auto_log(2,f"select c5 from {dbname}.stb1 where c1 > 0 order by tbname ",f"select log(c5,2) from {dbname}.stb1 where c1 > 0 order by tbname")
self.check_result_auto_log2(f"select t1,c5 from {dbname}.stb1 order by ts ",f"select log(t1,2), log(c5,2) from {dbname}.stb1 order by ts")
self.check_result_auto_log2(f"select t1,c5 from {dbname}.stb1 order by tbname ",f"select log(t1,2) ,log(c5,2) from {dbname}.stb1 order by tbname")
self.check_result_auto_log2(f"select t1,c5 from {dbname}.stb1 where c1 > 0 order by tbname ",f"select log(t1,2) ,log(c5,2) from {dbname}.stb1 where c1 > 0 order by tbname")
self.check_result_auto_log2(f"select t1,c5 from {dbname}.stb1 where c1 > 0 order by tbname ",f"select log(t1,2) , log(c5,2) from {dbname}.stb1 where c1 > 0 order by tbname")
self.check_result_auto_log(2,f"select t1,c5 from {dbname}.stb1 order by ts ",f"select log(t1,2), log(c5,2) from {dbname}.stb1 order by ts")
self.check_result_auto_log(2,f"select t1,c5 from {dbname}.stb1 order by tbname ",f"select log(t1,2) ,log(c5,2) from {dbname}.stb1 order by tbname")
self.check_result_auto_log(2,f"select t1,c5 from {dbname}.stb1 where c1 > 0 order by tbname ",f"select log(t1,2) ,log(c5,2) from {dbname}.stb1 where c1 > 0 order by tbname")
self.check_result_auto_log(2,f"select t1,c5 from {dbname}.stb1 where c1 > 0 order by tbname ",f"select log(t1,2) , log(c5,2) from {dbname}.stb1 where c1 > 0 order by tbname")
tdSql.query(" SELECT avg(velocity) as mean_velocity ,name,driver,fleet FROM readings WHERE ts > 1451606400000 AND ts <= 1451606460000 partition BY name,driver,fleet; ")
# print(tdSql.queryResult)
parRows=tdSql.queryRows
tdSql.query(" SELECT avg(velocity) as mean_velocity ,name,driver,fleet FROM readings WHERE ts > 1451606400000 AND ts <= 1451606460000 partition BY name,driver,fleet interval(10m); ")
# tdSql.query("insert into testsnode SELECT ts,avg(velocity) as mean_velocity,name,driver,fleet FROM readings WHERE ts > 1451606400000 AND ts <= 1451606460000 partition BY name,driver,fleet,ts interval(10m);")
# tdSql.query("insert into testsnode(ts,c1,c2,c3,c4) SELECT ts,avg(velocity) as mean_velocity,name,driver,fleet FROM readings WHERE ts > 1451606400000 AND ts <= 1451606460000 partition BY name,driver,fleet,ts interval(10m);")
...
...
@@ -141,7 +141,7 @@ class TDTestCase:
tdSql.query("SELECT ts,name,driver,current_load,load_capacity FROM (SELECT last(ts) as ts,name,driver, current_load,load_capacity FROM diagnostics WHERE fleet = 'South' partition by name,driver) WHERE current_load>= (0.9 * load_capacity) partition by name ORDER BY name ;")
# 2 stationary-trucks
# 2 stationary-trucks
tdSql.query("select name,driver from (SELECT name,driver,fleet ,avg(velocity) as mean_velocity FROM readings WHERE ts > '2016-01-01T15:07:21Z' AND ts <= '2016-01-01T16:17:21Z' partition BY name,driver,fleet interval(10m) LIMIT 1)")
tdSql.query("select name,driver from (SELECT name,driver,fleet ,avg(velocity) as mean_velocity FROM readings WHERE ts > '2016-01-01T15:07:21Z' AND ts <= '2016-01-01T16:17:21Z' partition BY name,driver,fleet interval(10m) LIMIT 1) WHERE fleet = 'West' AND mean_velocity < 1000 partition BY name")
...
...
@@ -156,7 +156,7 @@ class TDTestCase:
tdSql.query("select _wstart as ts,fleet,name,driver,count(mv)/6 as hours_driven from ( select _wstart as ts,fleet,name,driver,avg(velocity) as mv from readings where ts > '2016-01-01T00:00:00Z' and ts < '2016-01-05T00:00:01Z' partition by fleet,name,driver interval(10m)) where ts > '2016-01-01T00:00:00Z' and ts < '2016-01-05T00:00:01Z' partition by fleet,name,driver interval(1d) ;")
# # 6. avg-daily-driving-session
# # 6. avg-daily-driving-session
# #taosc core dumped
# tdSql.execute("create table random_measure2_1 (ts timestamp,ela float, name binary(40))")
# tdSql.query("SELECT ts,diff(mv) AS difka FROM (SELECT ts,name,floor(avg(velocity)/10)/floor(avg(velocity)/10) AS mv FROM readings WHERE name!='' AND ts > '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition by name,ts interval(10m) fill(value,0)) GROUP BY name,ts;")
...
...
@@ -166,7 +166,7 @@ class TDTestCase:
# 7. avg-load
tdSql.query("SELECT fleet, model,avg(ml) AS mean_load_percentage FROM (SELECT fleet, model,current_load/load_capacity AS ml FROM diagnostics partition BY name, fleet, model) partition BY fleet, model order by fleet ;")
# 8. daily-activity
# 8. daily-activity
tdSql.query(" SELECT model,ms1 FROM (SELECT _wstart as ts1,model, fleet,avg(status) AS ms1 FROM diagnostics WHERE ts >= '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition by model, fleet interval(10m) fill(value,0)) WHERE ts1 >= '2016-01-01T00:00:00Z' AND ts1 < '2016-01-05T00:00:01Z' AND ms1<1;")
tdSql.query(" SELECT model,ms1 FROM (SELECT _wstart as ts1,model, fleet,avg(status) AS ms1 FROM diagnostics WHERE ts >= '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition by model, fleet interval(10m) ) WHERE ts1 >= '2016-01-01T00:00:00Z' AND ts1 < '2016-01-05T00:00:01Z' AND ms1<1;")
...
...
@@ -184,7 +184,7 @@ class TDTestCase:
tdSql.query(" SELECT model,state_changed,count(state_changed) FROM (SELECT model,diff(broken_down) AS state_changed FROM (SELECT _wstart,model,cast(cast(floor(2*(sum(nzs)/count(nzs))) as bool) as int) AS broken_down FROM (SELECT ts,model, cast(cast(status as bool) as int) AS nzs FROM diagnostics WHERE ts >= '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' ) WHERE ts >= '2016-01-01T00:00:00Z' AND ts < '2016-01-05T00:00:01Z' partition BY model interval(10m)) partition BY model) where state_changed =1 partition BY model,state_changed ;")
#it's already supported:
# last-loc
tdSql.query("SELECT last_row(ts),latitude,longitude,name,driver FROM readings WHERE fleet='South' and name IS NOT NULL partition BY name,driver order by name ;")
...
...
@@ -192,7 +192,7 @@ class TDTestCase:
#2. low-fuel
tdSql.query("SELECT last_row(ts),name,driver,fuel_state,driver FROM diagnostics WHERE fuel_state <= 0.1 AND fleet = 'South' and name IS NOT NULL GROUP BY name,driver order by name;")
# 3. avg-vs-projected-fuel-consumption
tdSql.query("select avg(fuel_consumption) as avg_fuel_consumption,avg(nominal_fuel_consumption) as nominal_fuel_consumption from readings where velocity > 1 group by fleet")
...
...
@@ -213,16 +213,16 @@ class TDTestCase:
'ctbPrefix':'ctb',
'ctbNum':1,
}
dnodeNumbers=int(dnodeNumbers)
mnodeNums=int(mnodeNums)
vnodeNumbers=int(dnodeNumbers-mnodeNums)
tdSql.query("select * from information_schema.ins_dnodes;")
tdLog.debug(tdSql.queryResult)
clusterComCheck.checkDnodes(dnodeNumbers)
tdLog.info("create database and stable")
tdLog.info("create database and stable")
tdDnodes=cluster.dnodes
stopcount=0
threads=[]
...
...
@@ -234,7 +234,7 @@ class TDTestCase:
fortrinthreads:
tr.start()
tdLog.info("Take turns stopping %s "%stopRole)
tdLog.info("Take turns stopping %s "%stopRole)
whilestopcount<restartNumbers:
tdLog.info(" restart loop: %d"%stopcount)
ifstopRole=="mnode":
...
...
@@ -242,7 +242,7 @@ class TDTestCase:
tdDnodes[i].stoptaosd()
# sleep(10)
tdDnodes[i].starttaosd()
# sleep(10)
# sleep(10)
elifstopRole=="vnode":
foriinrange(vnodeNumbers):
tdDnodes[i+mnodeNums].stoptaosd()
...
...
@@ -254,7 +254,7 @@ class TDTestCase:
tdDnodes[i].stoptaosd()
# sleep(10)
tdDnodes[i].starttaosd()
# sleep(10)
# sleep(10)
# dnodeNumbers don't include database of schema
ifclusterComCheck.checkDnodes(dnodeNumbers):
...
...
@@ -265,12 +265,12 @@ class TDTestCase:
tdLog.exit("one or more of dnodes failed to start ")
# self.check3mnode()
stopcount+=1
fortrinthreads:
tr.join()
defrun(self):
defrun(self):
tdLog.printNoPrefix("==========step1:create database and table,insert data ==============")