From 0e525a8e224e86e6d4bf9fa92c6b651aefefc445 Mon Sep 17 00:00:00 2001 From: slzhou Date: Thu, 18 Jan 2024 14:57:12 +0800 Subject: [PATCH] fix: add test case --- tests/parallel_test/cases.task | 1 + tests/system-test/2-query/partition_expr.py | 35 +++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 tests/system-test/2-query/partition_expr.py diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 0687a3271c..8eeecce750 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -43,6 +43,7 @@ fi #,,n,system-test,python3 ./test.py -f 8-stream/snode_restart.py -N 4 ,,n,system-test,python3 ./test.py -f 8-stream/snode_restart_with_checkpoint.py -N 4 +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/partition_expr.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/project_group.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tbname_vgroup.py ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/count_interval.py diff --git a/tests/system-test/2-query/partition_expr.py b/tests/system-test/2-query/partition_expr.py new file mode 100644 index 0000000000..c03d7eccb3 --- /dev/null +++ b/tests/system-test/2-query/partition_expr.py @@ -0,0 +1,35 @@ +from wsgiref.headers import tspecials +from util.log import * +from util.cases import * +from util.sql import * +import numpy as np + + +class TDTestCase: + def init(self, conn, logSql, replicaVar=1): + self.replicaVar = int(replicaVar) + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + self.rowNum = 10 + self.batchNum = 5 + self.ts = 1537146000000 + + def run(self): + dbname = "db" + tdSql.prepare() + + tdSql.execute(f'''create table sta(ts timestamp, f int, col2 bigint) tags(tg1 int, tg2 binary(20))''') + tdSql.execute(f"create table sta1 using sta tags(1, 'a')") + tdSql.execute(f"insert into sta1 values(1537146000001, 11, 110)") + tdSql.execute(f"insert into sta1 values(1537146000002, 12, 120)") + tdSql.execute(f"insert into sta1 values(1537146000003, 13, 130)") + + tdSql.query("select _wstart, f+100, count(*) from db.sta partition by f+100 session(ts, 1a) order by _wstart"); + tdSql.checkData(0, 1, 111.0) + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase())