未验证 提交 178d2cac 编写于 作者: D dapan1121 提交者: GitHub

Merge pull request #20156 from taosdata/fix/TD-22520

fix(query): fix apply limit error for doMultiwayMerge operator if datablocks belongs to the same group
......@@ -672,7 +672,9 @@ SSDataBlock* getMultiwaySortedBlockData(SSortHandle* pHandle, SSDataBlock* pData
}
bool limitReached = applyLimitOffset(&pInfo->limitInfo, p, pTaskInfo);
if (limitReached) {
// if limit is reached within a group, do not clear limiInfo otherwise the next block
// will be processed.
if (newgroup && limitReached) {
resetLimitInfoForNextGroup(&pInfo->limitInfo);
}
......
......@@ -25,7 +25,7 @@ class TDTestCase:
def init(self, conn, logSql, replicaVar):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
def getBuildPath(self):
selfPath = os.path.dirname(os.path.realpath(__file__))
......@@ -41,9 +41,9 @@ class TDTestCase:
buildPath = root[:len(root)-len("/build/bin")]
break
return buildPath
def run_benchmark(self,dbname,tables,per_table_num,order,replica):
#O :Out of order
#O :Out of order
#A :Repliaca
buildPath = self.getBuildPath()
if (buildPath == ""):
......@@ -53,135 +53,147 @@ class TDTestCase:
binPath = buildPath+ "/build/bin/"
os.system("%staosBenchmark -d %s -t %d -n %d -O %d -a %d -b float,double,nchar\(200\),binary\(50\) -T 50 -y " % (binPath,dbname,tables,per_table_num,order,replica))
def sql_base(self,dbname):
self.check_sub(dbname)
sql1 = "select count(*) from %s.meters" %dbname
self.sql_base_check(sql1,sql1)
self.check_sub(dbname)
sql2 = "select count(ts) from %s.meters" %dbname
self.sql_base_check(sql1,sql2)
self.check_sub(dbname)
sql2 = "select count(_c0) from %s.meters" %dbname
self.sql_base_check(sql1,sql2)
self.check_sub(dbname)
sql2 = "select count(c0) from %s.meters" %dbname
self.sql_base_check(sql1,sql2)
self.check_sub(dbname)
sql2 = "select count(c1) from %s.meters" %dbname
self.sql_base_check(sql1,sql2)
self.check_sub(dbname)
sql2 = "select count(c2) from %s.meters" %dbname
self.sql_base_check(sql1,sql2)
self.check_sub(dbname)
sql2 = "select count(c3) from %s.meters" %dbname
self.sql_base_check(sql1,sql2)
self.check_sub(dbname)
sql2 = "select count(t0) from %s.meters" %dbname
self.sql_base_check(sql1,sql2)
self.check_sub(dbname)
sql2 = "select count(t1) from %s.meters" %dbname
self.sql_base_check(sql1,sql2)
self.check_sub(dbname)
sql2 = "select count(ts) from (select * from %s.meters)" %dbname
self.sql_base_check(sql1,sql2)
self.check_sub(dbname)
sql2 = "select count(_c0) from (select * from %s.meters)" %dbname
self.sql_base_check(sql1,sql2)
self.check_sub(dbname)
sql2 = "select count(c0) from (select * from %s.meters)" %dbname
self.sql_base_check(sql1,sql2)
self.check_sub(dbname)
sql2 = "select count(c1) from (select * from %s.meters)" %dbname
self.sql_base_check(sql1,sql2)
self.check_sub(dbname)
sql2 = "select count(c2) from (select * from %s.meters)" %dbname
self.sql_base_check(sql1,sql2)
self.check_sub(dbname)
sql2 = "select count(c3) from (select * from %s.meters)" %dbname
self.sql_base_check(sql1,sql2)
self.check_sub(dbname)
sql2 = "select count(t0) from (select * from %s.meters)" %dbname
self.sql_base_check(sql1,sql2)
self.check_sub(dbname)
sql2 = "select count(t1) from (select * from %s.meters)" %dbname
self.sql_base_check(sql1,sql2)
# TD-22520
tdSql.query("select tbname, ts from %s.meters where ts < '2017-07-14 10:40:00' order by ts asc limit 150;" %dbname)
tdSql.checkRows(150)
tdSql.query("select tbname, ts from %s.meters where ts < '2017-07-14 10:40:00' order by ts asc limit 300;" %dbname)
tdSql.checkRows(300)
tdSql.query("select tbname, ts from %s.meters where ts < '2017-07-14 10:40:00' order by ts desc limit 150;" %dbname)
tdSql.checkRows(150)
tdSql.query("select tbname, ts from %s.meters where ts < '2017-07-14 10:40:00' order by ts desc limit 300;" %dbname)
tdSql.checkRows(300)
def sql_base_check(self,sql1,sql2):
tdSql.query(sql1)
sql1_result = tdSql.getData(0,0)
tdLog.info("sql:%s , result: %s" %(sql1,sql1_result))
tdSql.query(sql2)
sql2_result = tdSql.getData(0,0)
tdLog.info("sql:%s , result: %s" %(sql2,sql2_result))
if sql1_result==sql2_result:
tdLog.info(f"checkEqual success, sql1_result={sql1_result},sql2_result={sql2_result}")
tdLog.info(f"checkEqual success, sql1_result={sql1_result},sql2_result={sql2_result}")
else :
tdLog.exit(f"checkEqual error, sql1_result=={sql1_result},sql2_result={sql2_result}")
tdLog.exit(f"checkEqual error, sql1_result=={sql1_result},sql2_result={sql2_result}")
def run_sql(self,dbname):
self.sql_base(dbname)
tdSql.execute(" flush database %s;" %dbname)
self.sql_base(dbname)
def check_sub(self,dbname):
sql = "select count(*) from (select distinct(tbname) from %s.meters)" %dbname
tdSql.query(sql)
num = tdSql.getData(0,0)
for i in range(0,num):
sql1 = "select count(*) from %s.d%d" %(dbname,i)
tdSql.query(sql1)
sql1_result = tdSql.getData(0,0)
tdLog.info("sql:%s , result: %s" %(sql1,sql1_result))
def check_out_of_order(self,dbname,tables,per_table_num,order,replica):
self.run_benchmark(dbname,tables,per_table_num,order,replica)
print("sleep 10 seconds")
#time.sleep(10)
print("sleep 10 seconds finish")
self.run_sql(dbname)
def run(self):
startTime = time.time()
#self.check_out_of_order('db1',10,random.randint(10000,50000),random.randint(1,10),1)
self.check_out_of_order('db1',random.randint(50,200),random.randint(10000,20000),random.randint(1,5),1)
# self.check_out_of_order('db2',random.randint(50,200),random.randint(10000,50000),random.randint(5,50),1)
# self.check_out_of_order('db3',random.randint(50,200),random.randint(10000,50000),random.randint(50,100),1)
# self.check_out_of_order('db4',random.randint(50,200),random.randint(10000,50000),100,1)
startTime = time.time()
#self.check_out_of_order('db1',10,random.randint(10000,50000),random.randint(1,10),1)
self.check_out_of_order('db1',random.randint(50,200),random.randint(10000,20000),random.randint(1,5),1)
# self.check_out_of_order('db2',random.randint(50,200),random.randint(10000,50000),random.randint(5,50),1)
# self.check_out_of_order('db3',random.randint(50,200),random.randint(10000,50000),random.randint(50,100),1)
# self.check_out_of_order('db4',random.randint(50,200),random.randint(10000,50000),100,1)
endTime = time.time()
print("total time %ds" % (endTime - startTime))
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册