From 79b4b4bec151224c2ddc4d5f094100911e348294 Mon Sep 17 00:00:00 2001 From: factosea <285808407@qq.com> Date: Tue, 24 Dec 2024 09:53:11 +0800 Subject: [PATCH 1/5] fix: use limit with join --- source/libs/executor/src/mergejoin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/libs/executor/src/mergejoin.c b/source/libs/executor/src/mergejoin.c index 61809b99e0..adf1b4f0d1 100755 --- a/source/libs/executor/src/mergejoin.c +++ b/source/libs/executor/src/mergejoin.c @@ -46,7 +46,7 @@ static FORCE_INLINE bool mJoinBlkReachThreshold(SMJoinOperatorInfo* pInfo, int64 return blkRows >= pInfo->ctx.mergeCtx.blkThreshold; } - return (pInfo->execInfo.resRows + blkRows) >= pInfo->ctx.mergeCtx.limit; + return (pInfo->execInfo.resRows + blkRows) >= pInfo->ctx.mergeCtx.limit || blkRows >= pInfo->ctx.mergeCtx.blkThreshold; } From 4779f4a16fcb12c0af6a20363027152b69e367cf Mon Sep 17 00:00:00 2001 From: factosea <285808407@qq.com> Date: Tue, 24 Dec 2024 17:22:39 +0800 Subject: [PATCH 2/5] test case --- tests/parallel_test/cases.task | 1 + tests/pytest/util/cases.py | 38 ++++++++++++++++++++ tests/system-test/2-query/large_data.py | 46 +++++++++++++++++++++++++ 3 files changed, 85 insertions(+) create mode 100644 tests/system-test/2-query/large_data.py diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index c9d28e0623..9e4e6f9c71 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -247,6 +247,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/agg_group_NotReturnValue.py -Q 4 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/td-32548.py +,,n,system-test,python3 ./test.py -f 2-query/large_data.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/stddev_test.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/stddev_test.py -Q 2 diff --git a/tests/pytest/util/cases.py b/tests/pytest/util/cases.py index 536b8f30d3..8d31cda78c 100644 --- a/tests/pytest/util/cases.py +++ b/tests/pytest/util/cases.py @@ -19,6 +19,7 @@ import inspect import importlib import traceback from util.log import * +import platform class TDCase: @@ -146,5 +147,42 @@ class TDCases: tdLog.notice("total %d Cluster test case(s) executed" % (runNum)) + def getTaosBenchmarkPath(self, tool="taosBenchmark"): + if (platform.system().lower() == 'windows'): + tool = tool + ".exe" + selfPath = os.path.dirname(os.path.realpath(__file__)) + if "community" in selfPath: + projPath = selfPath[: selfPath.find("community")] + else: + projPath = selfPath[: selfPath.find("tests")] + + paths = [] + for root, dirs, files in os.walk(projPath): + if (tool) in files: + rootRealPath = os.path.dirname(os.path.realpath(root)) + if "packaging" not in rootRealPath: + paths.append(os.path.join(root, tool)) + break + if len(paths) == 0: + tdLog.exit("taosBenchmark not found!") + return + else: + tdLog.info("taosBenchmark found in %s" % paths[0]) + return paths[0] + + def taosBenchmarkExec(self, param): + buildPath = tdCases.getTaosBenchmarkPath() + + if (platform.system().lower() == 'windows'): + cmdStr1 = ' mintty -h never %s %s '%(buildPath, param) + tdLog.info(cmdStr1) + os.system(cmdStr1) + else: + cmdStr1 = '%s %s &'%(buildPath, param) + tdLog.info(cmdStr1) + os.system(cmdStr1) + + time.sleep(15) + tdCases = TDCases() diff --git a/tests/system-test/2-query/large_data.py b/tests/system-test/2-query/large_data.py new file mode 100644 index 0000000000..6a5e3ca53c --- /dev/null +++ b/tests/system-test/2-query/large_data.py @@ -0,0 +1,46 @@ +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * + +class TDTestCase: + + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor(), True) + + def prepare_data(self): + tdSql.execute("drop database if exists test;") + + tdCases.taosBenchmarkExec("-t 2 -n 1000000 -b int,float,nchar -y") + + def ts5803(self): + tdSql.query("select d0.ts,d0.c1,d0.c2 from test.d0 join test.d1 on d0.ts=d1.ts;") + num1 = tdSql.queryRows + + tdSql.query("select d0.ts,d0.c1,d0.c2 from test.d0 join test.d1 on d0.ts=d1.ts limit 1000000;") + tdSql.checkRows(num1) + + tdSql.query("select d0.ts from test.d0 join test.d1 on d0.ts=d1.ts limit 1000000;") + tdSql.checkRows(num1) + + tdSql.query("select d0.ts,d0.c1,d0.c2 from test.d0 left join test.d1 on d0.ts=d1.ts;") + num1 = tdSql.queryRows + + tdSql.query("select d0.ts,d0.c1,d0.c2 from test.d0 left join test.d1 on d0.ts=d1.ts limit 1000000;") + tdSql.checkRows(num1) + + tdSql.query("select d0.ts from test.d0 left join test.d1 on d0.ts=d1.ts limit 1000000;") + tdSql.checkRows(num1) + + def run(self): + self.prepare_data() + self.ts5803() + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) From faaaa243afb4081e79c9591b781e467b48b9df4b Mon Sep 17 00:00:00 2001 From: factosea <285808407@qq.com> Date: Wed, 25 Dec 2024 09:09:27 +0800 Subject: [PATCH 3/5] fix: test case --- tests/system-test/2-query/large_data.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/system-test/2-query/large_data.py b/tests/system-test/2-query/large_data.py index 6a5e3ca53c..69b15ce821 100644 --- a/tests/system-test/2-query/large_data.py +++ b/tests/system-test/2-query/large_data.py @@ -14,6 +14,15 @@ class TDTestCase: tdSql.execute("drop database if exists test;") tdCases.taosBenchmarkExec("-t 2 -n 1000000 -b int,float,nchar -y") + + while True: + tdSql.query("select d0.ts from test.d0;") + num1 = tdSql.queryRows + tdSql.query("select d0.ts from test.d1;") + num2 = tdSql.queryRows + if num1 == 1000000 and num2 == 1000000: + break + time.sleep(1) def ts5803(self): tdSql.query("select d0.ts,d0.c1,d0.c2 from test.d0 join test.d1 on d0.ts=d1.ts;") From f4180ec3d0c0ba166cab9daaeba6263b3946c0cd Mon Sep 17 00:00:00 2001 From: factosea <285808407@qq.com> Date: Wed, 25 Dec 2024 09:11:54 +0800 Subject: [PATCH 4/5] fix: win system error desc --- source/util/src/terror.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/source/util/src/terror.c b/source/util/src/terror.c index d2d551a539..b2a8c422f7 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -908,12 +908,6 @@ const char* tstrerror(int32_t err) { (void)taosThreadOnce(&tsErrorInit, tsSortError); // this is a system errno - if ((err & 0x00ff0000) == 0x00ff0000) { - int32_t code = err & 0x0000ffff; - // strerror can handle any invalid code - // invalid code return Unknown error - return strerror(code); - } #ifdef WINDOWS if ((err & 0x01ff0000) == 0x01ff0000) { snprintf(WinAPIErrDesc, 256, "windows api error, code: 0x%08x", err & 0x0000ffff); @@ -923,6 +917,13 @@ const char* tstrerror(int32_t err) { return WinAPIErrDesc; } #endif + if ((err & 0x00ff0000) == 0x00ff0000) { + int32_t code = err & 0x0000ffff; + // strerror can handle any invalid code + // invalid code return Unknown error + return strerror(code); + } + int32_t s = 0; int32_t e = sizeof(errors) / sizeof(errors[0]); From 4a08d6915909a0f264b685bf1f705366d080d659 Mon Sep 17 00:00:00 2001 From: factosea <285808407@qq.com> Date: Wed, 25 Dec 2024 09:18:57 +0800 Subject: [PATCH 5/5] fix: test case --- tests/pytest/util/cases.py | 2 +- tests/system-test/2-query/large_data.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/pytest/util/cases.py b/tests/pytest/util/cases.py index 8d31cda78c..eee8809ad0 100644 --- a/tests/pytest/util/cases.py +++ b/tests/pytest/util/cases.py @@ -183,6 +183,6 @@ class TDCases: tdLog.info(cmdStr1) os.system(cmdStr1) - time.sleep(15) + time.sleep(5) tdCases = TDCases() diff --git a/tests/system-test/2-query/large_data.py b/tests/system-test/2-query/large_data.py index 69b15ce821..2279c3ce70 100644 --- a/tests/system-test/2-query/large_data.py +++ b/tests/system-test/2-query/large_data.py @@ -16,12 +16,13 @@ class TDTestCase: tdCases.taosBenchmarkExec("-t 2 -n 1000000 -b int,float,nchar -y") while True: - tdSql.query("select d0.ts from test.d0;") + tdSql.query("select ts from test.d0;") num1 = tdSql.queryRows - tdSql.query("select d0.ts from test.d1;") + tdSql.query("select ts from test.d1;") num2 = tdSql.queryRows if num1 == 1000000 and num2 == 1000000: break + tdLog.info(f"waiting for data ready, d0: {num1}, d1: {num2}") time.sleep(1) def ts5803(self):