tdLog.info("warning: the diff for performance after spliting is over 20%")
returnTrue
# init
definit(self,conn,logSql,replicaVar=1):
seed=time.clock_gettime(time.CLOCK_REALTIME)
random.seed(seed)
self.replicaVar=int(replicaVar)
tdLog.debug(f"start to excute {__file__}")
tdSql.init(conn.cursor(),True)
# check time macro
defqueryBasic(self):
# check count
expectVal=self.childCnt*self.childRow
sql=f"select count(ts) from st "
self.checkExpect(sql,expectVal)
# check diff
sql=f"select count(*) from (select diff(ts) as dif from st order by ts)"
self.checkExpect(sql,expectVal-1)
# check ts order count
sql=f"select count(*) from (select diff(ts) as dif from st order by ts) where dif!=1"
self.checkExpect(sql,0)
# check ts1 order count
sql=f"select count(*) from (select diff(ts1) as dif from st order by ts1) where dif!=1"
self.checkExpect(sql,0)
# check c3 order asc
sql=f"select count(*) from (select diff(c3) as dif from st order by c3) where dif!=1"
self.checkExpect(sql,0)
# check c3 order desc todo FIX
#sql = f"select count(*) from (select diff(c3) as dif from st order by c3 desc) where dif!=-1"
#self.checkExpect(sql, 0)
# advance
defqueryAdvance(self):
# interval order todo FIX
#sql = f"select _wstart,count(ts),max(c2),min(c2) from st interval(100u) sliding(50u) order by _wstart limit 10"
#tdSql.query(sql)
#tdSql.checkRows(10)
# simulate crash sql
sql=f"select _wstart,count(ts),max(c2),min(c2) from st interval(100a) sliding(10a) order by _wstart limit 10"
tdSql.query(sql)
tdSql.checkRows(10)
# extent
sql=f"select _wstart,count(ts),max(c2),min(c2) from st interval(100a) sliding(10a) order by _wstart desc limit 5"
tdSql.query(sql)
tdSql.checkRows(5)
# data correct checked
sql1="select sum(a),sum(b), max(c), min(d),sum(e) from (select _wstart,count(ts) as a,count(c2) as b ,max(c2) as c, min(c2) as d, sum(c2) as e from st interval(100a) sliding(100a) order by _wstart desc);"
sql2="select count(*) as a, count(c2) as b, max(c2) as c, min(c2) as d, sum(c2) as e from st;"