From 51f58ffeab0b59563dbcb31ff13fca3b830bcb21 Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Sat, 18 Mar 2023 17:44:03 +0800 Subject: [PATCH 1/3] add test case --- tests/pytest/util/common.py | 6 +++ .../0-others/information_schema.py | 43 +++++++++++++++++-- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/tests/pytest/util/common.py b/tests/pytest/util/common.py index 5b73989d6f..6d813a4166 100644 --- a/tests/pytest/util/common.py +++ b/tests/pytest/util/common.py @@ -739,6 +739,11 @@ class TDCom: else: os.system("unset LD_PRELOAD; pkill %s " % processorName) + def gen_tag_col_str(self, gen_type, data_type, count): + """ + gen multi tags or cols by gen_type + """ + return ','.join(map(lambda i: f'{gen_type}{i} {data_type}', range(count))) def is_json(msg): if isinstance(msg, str): @@ -775,4 +780,5 @@ def dict2toml(in_dict: dict, file:str): with open(file, 'w') as f: toml.dump(in_dict, f) + tdCom = TDCom() diff --git a/tests/system-test/0-others/information_schema.py b/tests/system-test/0-others/information_schema.py index 23ddb12d79..e0799ab4b7 100644 --- a/tests/system-test/0-others/information_schema.py +++ b/tests/system-test/0-others/information_schema.py @@ -93,7 +93,6 @@ class TDTestCase: tdSql.checkEqual(i[2],len(self.perf_list)) tdSql.execute('create table db1.ntb (ts timestamp,c0 int)') tdSql.query(f'select db_name, count(*) from information_schema.ins_tables group by db_name') - print(tdSql.queryResult) for i in tdSql.queryResult: if i[0].lower() == 'information_schema': tdSql.checkEqual(i[1],len(self.ins_list)) @@ -109,10 +108,46 @@ class TDTestCase: tdSql.query(f'select * from information_schema.ins_columns where db_name="db2" and table_type="CHILD_TABLE"') tdSql.checkEqual(20000,len(tdSql.queryResult)) print("number of ins_columns of child table in db2 is %s" % len(tdSql.queryResult)) + + def ins_col_check_4096(self): + tdSql.execute('create database db3 vgroups 2 replica 1') + col_str = tdCom.gen_tag_col_str("col", "int",4094) + tdSql.execute(f'create stable if not exists db3.stb (col_ts timestamp, {col_str}) tags (t1 int)') + for i in range(100): + tdLog.info(f"create table db3.ctb{i} using db3.stb tags({i})") + tdSql.execute(f"create table db3.ctb{i} using db3.stb tags({i})") + col_value_str = '1, ' * 4093 + '1' + tdSql.execute(f"insert into db3.ctb{i} values(now,{col_value_str})") + tdSql.query("select * from information_schema.ins_columns") + + tdSql.execute('drop database db3') + def ins_stable_check(self): + tdSql.execute('create database db3 vgroups 2 replica 1') + tbnum = 10 + ctbnum = 10 + for i in range(tbnum): + tdSql.execute(f'create stable db3.stb_{i} (ts timestamp,c0 int) tags(t0 int)') + tdSql.execute(f'create table db3.ntb_{i} (ts timestamp,c0 int)') + for j in range(ctbnum): + tdSql.execute(f"create table db3.ctb_{i}_{j} using db3.stb_{i} tags({j})") + tdSql.query("select stable_name,count(table_name) from information_schema.ins_tables where db_name = 'db3' group by stable_name order by stable_name") + result = tdSql.queryResult + for i in range(len(result)): + if result[i][0] == None: + tdSql.checkEqual(result[0][1],tbnum) + else: + tdSql.checkEqual(result[i][0],f'stb_{i-1}') + tdSql.checkEqual(result[i][1],ctbnum) + + + def run(self): - self.prepare_data() - self.count_check() - self.ins_columns_check() + # self.prepare_data() + # self.count_check() + # self.ins_columns_check() + # self.ins_col_check_4096() + self.ins_stable_check() + def stop(self): tdSql.close() tdLog.success("%s successfully executed" % __file__) From d2b53b516e30632ea518cb236f1b3af5c2a3a283 Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Mon, 20 Mar 2023 10:00:48 +0800 Subject: [PATCH 2/3] update --- tests/system-test/0-others/information_schema.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/system-test/0-others/information_schema.py b/tests/system-test/0-others/information_schema.py index e0799ab4b7..05736537c2 100644 --- a/tests/system-test/0-others/information_schema.py +++ b/tests/system-test/0-others/information_schema.py @@ -117,7 +117,7 @@ class TDTestCase: tdLog.info(f"create table db3.ctb{i} using db3.stb tags({i})") tdSql.execute(f"create table db3.ctb{i} using db3.stb tags({i})") col_value_str = '1, ' * 4093 + '1' - tdSql.execute(f"insert into db3.ctb{i} values(now,{col_value_str})") + tdSql.execute(f"insert into db3.ctb{i} values(now,{col_value_str})(now+1s,{col_value_str})(now+2s,{col_value_str})") tdSql.query("select * from information_schema.ins_columns") tdSql.execute('drop database db3') @@ -142,9 +142,9 @@ class TDTestCase: def run(self): - # self.prepare_data() - # self.count_check() - # self.ins_columns_check() + self.prepare_data() + self.count_check() + self.ins_columns_check() # self.ins_col_check_4096() self.ins_stable_check() From 86823ab90fc6a6a59c039d49968e8c1c51a9f74c Mon Sep 17 00:00:00 2001 From: jiacy-jcy <714897623@qq.com> Date: Mon, 20 Mar 2023 19:40:07 +0800 Subject: [PATCH 3/3] update --- tests/system-test/0-others/information_schema.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system-test/0-others/information_schema.py b/tests/system-test/0-others/information_schema.py index 05736537c2..43e0d5fbc7 100644 --- a/tests/system-test/0-others/information_schema.py +++ b/tests/system-test/0-others/information_schema.py @@ -117,7 +117,7 @@ class TDTestCase: tdLog.info(f"create table db3.ctb{i} using db3.stb tags({i})") tdSql.execute(f"create table db3.ctb{i} using db3.stb tags({i})") col_value_str = '1, ' * 4093 + '1' - tdSql.execute(f"insert into db3.ctb{i} values(now,{col_value_str})(now+1s,{col_value_str})(now+2s,{col_value_str})") + tdSql.execute(f"insert into db3.ctb{i} values(now,{col_value_str})(now+1s,{col_value_str})(now+2s,{col_value_str})(now+3s,{col_value_str})") tdSql.query("select * from information_schema.ins_columns") tdSql.execute('drop database db3')