fix: last_row error
This commit is contained in:
parent
d44d945b09
commit
b83bb8c150
|
@ -941,7 +941,7 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
|
||||||
}
|
}
|
||||||
|
|
||||||
if(lastrowTmpIndexArray != NULL) {
|
if(lastrowTmpIndexArray != NULL) {
|
||||||
mergeLastCid(uid, pTsdb, &lastrowTmpColArray, pr, lastrowColIds, lastrowIndex, lastrowSlotIds);
|
mergeLastRowCid(uid, pTsdb, &lastrowTmpColArray, pr, lastrowColIds, lastrowIndex, lastrowSlotIds);
|
||||||
for(int i = 0; i < taosArrayGetSize(lastrowTmpColArray); i++) {
|
for(int i = 0; i < taosArrayGetSize(lastrowTmpColArray); i++) {
|
||||||
taosArrayInsert(pTmpColArray, *(int32_t*)taosArrayGet(lastrowTmpIndexArray, i), taosArrayGet(lastrowTmpColArray, i));
|
taosArrayInsert(pTmpColArray, *(int32_t*)taosArrayGet(lastrowTmpIndexArray, i), taosArrayGet(lastrowTmpColArray, i));
|
||||||
}
|
}
|
||||||
|
|
|
@ -861,11 +861,55 @@ class TDTestCase:
|
||||||
|
|
||||||
self.support_super_table_test()
|
self.support_super_table_test()
|
||||||
|
|
||||||
|
def initLastRowDelayTest(self, dbname="db"):
|
||||||
|
tdSql.execute(f"drop database if exists {dbname} ")
|
||||||
|
create_db_sql = f"create database if not exists {dbname} keep 3650 duration 1000 cachemodel 'NONE' REPLICA 1"
|
||||||
|
tdSql.execute(create_db_sql)
|
||||||
|
|
||||||
|
tdSql.execute(f"use {dbname}")
|
||||||
|
tdSql.execute(f'create stable {dbname}.st(ts timestamp, v_int int, v_float float) TAGS (ctname varchar(32))')
|
||||||
|
|
||||||
|
tdSql.execute(f"create table {dbname}.ct1 using st tags('ct1')")
|
||||||
|
tdSql.execute(f"create table {dbname}.ct2 using st tags('ct2')")
|
||||||
|
|
||||||
|
tdSql.execute(f"insert into {dbname}.st(tbname,ts,v_float, v_int) values('ct1',1630000000000,86,86)")
|
||||||
|
tdSql.execute(f"insert into {dbname}.st(tbname,ts,v_float, v_int) values('ct1',1630000021255,59,59)")
|
||||||
|
tdSql.execute(f'flush database {dbname}')
|
||||||
|
tdSql.execute(f'select last(*) from {dbname}.st')
|
||||||
|
tdSql.execute(f'select last_row(*) from {dbname}.st')
|
||||||
|
tdSql.execute(f"insert into {dbname}.st(tbname,ts) values('ct1',1630000091255)")
|
||||||
|
tdSql.execute(f'flush database {dbname}')
|
||||||
|
tdSql.execute(f'select last(*) from {dbname}.st')
|
||||||
|
tdSql.execute(f'select last_row(*) from {dbname}.st')
|
||||||
|
tdSql.execute(f'alter database {dbname} cachemodel "both"')
|
||||||
|
tdSql.query(f'select last(*) from {dbname}.st')
|
||||||
|
tdSql.checkData(0 , 1 , 59)
|
||||||
|
|
||||||
|
tdSql.query(f'select last_row(*) from {dbname}.st')
|
||||||
|
tdSql.checkData(0 , 1 , None)
|
||||||
|
tdSql.checkData(0 , 2 , None)
|
||||||
|
|
||||||
|
tdLog.printNoPrefix("========== delay test init success ==============")
|
||||||
|
|
||||||
|
def lastRowDelayTest(self, dbname="db"):
|
||||||
|
tdLog.printNoPrefix("========== delay test start ==============")
|
||||||
|
|
||||||
|
tdSql.execute(f"use {dbname}")
|
||||||
|
|
||||||
|
tdSql.query(f'select last(*) from {dbname}.st')
|
||||||
|
tdSql.checkData(0 , 1 , 59)
|
||||||
|
|
||||||
|
tdSql.query(f'select last_row(*) from {dbname}.st')
|
||||||
|
tdSql.checkData(0 , 1 , None)
|
||||||
|
tdSql.checkData(0 , 2 , None)
|
||||||
|
|
||||||
def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring
|
def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring
|
||||||
# tdSql.prepare()
|
# tdSql.prepare()
|
||||||
|
|
||||||
tdLog.printNoPrefix("==========step1:create table ==============")
|
tdLog.printNoPrefix("==========step1:create table ==============")
|
||||||
|
|
||||||
|
self.initLastRowDelayTest("DELAYTEST")
|
||||||
|
|
||||||
# cache_last 0
|
# cache_last 0
|
||||||
self.prepare_datas("'NONE' ")
|
self.prepare_datas("'NONE' ")
|
||||||
self.prepare_tag_datas("'NONE'")
|
self.prepare_tag_datas("'NONE'")
|
||||||
|
@ -890,6 +934,8 @@ class TDTestCase:
|
||||||
self.insert_datas_and_check_abs(self.tb_nums,self.row_nums,self.time_step,"'BOTH'")
|
self.insert_datas_and_check_abs(self.tb_nums,self.row_nums,self.time_step,"'BOTH'")
|
||||||
self.basic_query()
|
self.basic_query()
|
||||||
|
|
||||||
|
self.lastRowDelayTest("DELAYTEST")
|
||||||
|
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
tdSql.close()
|
tdSql.close()
|
||||||
|
|
Loading…
Reference in New Issue