fix(test/query): keep cache query consistent with none model
This commit is contained in:
parent
3562ef4334
commit
85738649ce
|
@ -24,6 +24,11 @@ class TDTestCase:
|
|||
self.ctbNum = 10
|
||||
self.rowsPerTbl = 10000
|
||||
self.duraion = '1h'
|
||||
self.cachemodel = 'both'
|
||||
self.cacheEnable = True
|
||||
#self.cacheEnable = False
|
||||
if not self.cacheEnable:
|
||||
self.cachemodel = 'none'
|
||||
|
||||
def init(self, conn, logSql, replicaVar=1):
|
||||
self.replicaVar = int(replicaVar)
|
||||
|
@ -34,7 +39,7 @@ class TDTestCase:
|
|||
if dropFlag == 1:
|
||||
tsql.execute("drop database if exists %s"%(dbName))
|
||||
|
||||
tsql.execute("create database if not exists %s vgroups %d replica %d duration %s CACHEMODEL 'both'"%(dbName, vgroups, replica, duration))
|
||||
tsql.execute("create database if not exists %s vgroups %d replica %d duration %s CACHEMODEL '%s'"%(dbName, vgroups, replica, duration, self.cachemodel))
|
||||
tdLog.debug("complete to create database %s"%(dbName))
|
||||
return
|
||||
|
||||
|
@ -130,6 +135,9 @@ class TDTestCase:
|
|||
return
|
||||
|
||||
def check_explain_res_has_row(self, plan_str_expect: str, rows, sql):
|
||||
if not self.cacheEnable:
|
||||
return
|
||||
|
||||
plan_found = False
|
||||
for row in rows:
|
||||
if str(row).find(plan_str_expect) >= 0:
|
||||
|
@ -343,10 +351,10 @@ class TDTestCase:
|
|||
p.check_returncode()
|
||||
tdSql.query_success_failed("select ts, last(c1), c1, ts, c1 from meters", queryTimes=10, expectErrInfo="Invalid column name: c1")
|
||||
tdSql.query('select last(c12), c12, ts from meters', queryTimes=1)
|
||||
tdSql.checkRows(1)
|
||||
tdSql.checkCols(3)
|
||||
tdSql.checkData(0, 0, None)
|
||||
tdSql.checkData(0, 1, None)
|
||||
tdSql.checkRows(0)
|
||||
#tdSql.checkCols(3)
|
||||
#tdSql.checkData(0, 0, None)
|
||||
#tdSql.checkData(0, 1, None)
|
||||
|
||||
def test_cache_scan_with_drop_column(self):
|
||||
tdSql.query('select last(*) from meters')
|
||||
|
@ -378,41 +386,41 @@ class TDTestCase:
|
|||
p.check_returncode()
|
||||
tdSql.query_success_failed("select ts, last(c2), c12, ts, c12 from meters", queryTimes=10, expectErrInfo="Invalid column name: c2")
|
||||
tdSql.query('select last(c1), c1, ts from meters', queryTimes=1)
|
||||
tdSql.checkRows(1)
|
||||
tdSql.checkCols(3)
|
||||
tdSql.checkData(0, 0, None)
|
||||
tdSql.checkData(0, 1, None)
|
||||
tdSql.checkRows(0)
|
||||
#tdSql.checkCols(3)
|
||||
#tdSql.checkData(0, 0, None)
|
||||
#tdSql.checkData(0, 1, None)
|
||||
|
||||
def test_cache_scan_last_row_with_partition_by(self):
|
||||
tdSql.query('select last(c1) from meters partition by t1')
|
||||
print(str(tdSql.queryResult))
|
||||
tdSql.checkCols(1)
|
||||
tdSql.checkRows(5)
|
||||
#tdSql.checkCols(1)
|
||||
tdSql.checkRows(0)
|
||||
p = subprocess.run(["taos", '-s', "alter table test.meters drop column c1; alter table test.meters add column c2 int"])
|
||||
p.check_returncode()
|
||||
tdSql.query_success_failed('select last(c1) from meters partition by t1', queryTimes=10, expectErrInfo="Invalid column name: c1")
|
||||
tdSql.query('select last(c2), c2, ts from meters', queryTimes=1)
|
||||
print(str(tdSql.queryResult))
|
||||
tdSql.checkRows(1)
|
||||
tdSql.checkCols(3)
|
||||
tdSql.checkData(0, 0, None)
|
||||
tdSql.checkData(0, 1, None)
|
||||
tdSql.checkRows(0)
|
||||
#tdSql.checkCols(3)
|
||||
#tdSql.checkData(0, 0, None)
|
||||
#tdSql.checkData(0, 1, None)
|
||||
|
||||
|
||||
def test_cache_scan_last_row_with_partition_by_tbname(self):
|
||||
tdSql.query('select last(c2) from meters partition by tbname')
|
||||
print(str(tdSql.queryResult))
|
||||
tdSql.checkCols(1)
|
||||
tdSql.checkRows(10)
|
||||
#tdSql.checkCols(1)
|
||||
tdSql.checkRows(0)
|
||||
p = subprocess.run(["taos", '-s', "alter table test.meters drop column c2; alter table test.meters add column c1 int"])
|
||||
p.check_returncode()
|
||||
tdSql.query_success_failed('select last_row(c2) from meters partition by tbname', queryTimes=10, expectErrInfo="Invalid column name: c2")
|
||||
tdSql.query('select last(c1), c1, ts from meters', queryTimes=1)
|
||||
print(str(tdSql.queryResult))
|
||||
tdSql.checkRows(1)
|
||||
tdSql.checkCols(3)
|
||||
tdSql.checkData(0, 0, None)
|
||||
tdSql.checkData(0, 1, None)
|
||||
tdSql.checkRows(0)
|
||||
#tdSql.checkCols(3)
|
||||
#tdSql.checkData(0, 0, None)
|
||||
#tdSql.checkData(0, 1, None)
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue