From 15fae2418ca7359551ba72d67fc16634aac4f900 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Thu, 11 Aug 2022 23:13:45 +0800 Subject: [PATCH] enh: show command optimize --- tests/pytest/insert/insert_locking.py | 2 +- tests/script/tmp/data.sim | 4 ++-- tests/script/tmp/prepare.sim | 2 +- tests/script/tsim/stable/alter_comment.sim | 16 ++++++++-------- tests/script/tsim/stable/column_add.sim | 8 ++++---- tests/script/tsim/stable/column_drop.sim | 8 ++++---- tests/script/tsim/stable/metrics.sim | 6 +++--- tests/script/tsim/stable/tag_add.sim | 8 ++++---- tests/script/tsim/stable/tag_drop.sim | 10 +++++----- tests/script/tsim/table/autocreate.sim | 6 +++--- tests/script/tsim/table/basic3.sim | 8 ++++---- tests/script/tsim/table/createmulti.sim | 8 ++++---- tests/script/tsim/user/privilege_sysinfo.sim | 4 ++-- tests/script/tsim/valgrind/checkError5.sim | 4 ++-- tests/system-test/1-insert/table_comment.py | 4 ++-- tests/system-test/2-query/distribute_agg_sum.py | 2 +- tests/system-test/2-query/twa.py | 2 +- .../5-taos-tools/taosdump/taosdumpTestColTag.py | 10 +++++----- 18 files changed, 56 insertions(+), 56 deletions(-) diff --git a/tests/pytest/insert/insert_locking.py b/tests/pytest/insert/insert_locking.py index dc320edd1f..d62c2e525d 100644 --- a/tests/pytest/insert/insert_locking.py +++ b/tests/pytest/insert/insert_locking.py @@ -41,7 +41,7 @@ class TDTestCase: tdSql.execute('''create stable db.stable_1 (ts timestamp, payload binary(256)) tags(t1 binary(16),t2 int);''') - sql = '''show db.stables;''' + sql = '''select * from information_schema.ins_stables where db_name = 'db';''' tdSql.query(sql) tdSql.checkRows(1) diff --git a/tests/script/tmp/data.sim b/tests/script/tmp/data.sim index 6b7ab81529..c59a43263b 100644 --- a/tests/script/tmp/data.sim +++ b/tests/script/tmp/data.sim @@ -118,8 +118,8 @@ sql use db; sql create table stb (ts timestamp, c int) tags (t int); sql create table t0 using stb tags (0); sql insert into t0 values(now, 1); -sql show db.stables; -sql show db.tables; +sql select * from information_schema.ins_stables where db_name = 'db'; +sql select * from information_schema.ins_tables where db_name = 'db'; sql show db.vgroups; return diff --git a/tests/script/tmp/prepare.sim b/tests/script/tmp/prepare.sim index 2e16ee7bda..0ddd6a3ba7 100644 --- a/tests/script/tmp/prepare.sim +++ b/tests/script/tmp/prepare.sim @@ -35,5 +35,5 @@ sql use db; sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned); sql create table ct1 using stb tags(1000); sql create table ct2 using stb tags(1000) ; -sql show db.tables; +sql select * from information_schema.ins_tables where db_name = 'db'; sql insert into ct1 values(now+0s, 10, 2.0, 3.0); \ No newline at end of file diff --git a/tests/script/tsim/stable/alter_comment.sim b/tests/script/tsim/stable/alter_comment.sim index 19f4858585..beb049985c 100644 --- a/tests/script/tsim/stable/alter_comment.sim +++ b/tests/script/tsim/stable/alter_comment.sim @@ -8,7 +8,7 @@ sql create database db sql use db sql create table db.stb (ts timestamp, c1 int, c2 binary(4)) tags(t1 int, t2 float, t3 binary(16)) comment "abd" -sql show db.stables +sql select * from information_schema.ins_stables where db_name = 'db' if $rows != 1 then return -1 endi @@ -33,7 +33,7 @@ sql alter table db.stb add column c3 int sql alter table db.stb add column c4 bigint sql alter table db.stb add column c5 binary(12) -sql show db.stables +sql select * from information_schema.ins_stables where db_name = 'db' if $rows != 1 then return -1 endi @@ -54,7 +54,7 @@ sql_error alter table db.stb drop column t3 sql alter table db.stb drop column c1 sql alter table db.stb drop column c4 -sql show db.stables +sql select * from information_schema.ins_stables where db_name = 'db' if $rows != 1 then return -1 endi @@ -73,7 +73,7 @@ sql_error alter table db.stb MODIFY column t3 binary(20) sql_error alter table db.stb MODIFY column c2 binary(3) sql alter table db.stb MODIFY column c2 binary(32) -sql show db.stables +sql select * from information_schema.ins_stables where db_name = 'db' if $rows != 1 then return -1 endi @@ -98,7 +98,7 @@ sql alter table db.stb add tag t4 bigint sql alter table db.stb add tag c1 int sql alter table db.stb add tag t5 binary(12) -sql show db.stables +sql select * from information_schema.ins_stables where db_name = 'db' if $rows != 1 then return -1 endi @@ -119,7 +119,7 @@ sql_error alter table db.stb drop tag tx sql alter table db.stb drop tag c1 sql alter table db.stb drop tag t5 -sql show db.stables +sql select * from information_schema.ins_stables where db_name = 'db' if $rows != 1 then return -1 endi @@ -139,7 +139,7 @@ sql_error alter table db.stb MODIFY tag t1 binary(20) sql_error alter table db.stb MODIFY tag tx binary(20) sql alter table db.stb MODIFY tag t3 binary(32) -sql show db.stables +sql select * from information_schema.ins_stables where db_name = 'db' if $rows != 1 then return -1 endi @@ -161,7 +161,7 @@ print ========== alter common sql alter table db.stb comment 'abcde' ; sql_error alter table db.stb ttl 10 ; -sql show db.stables; +sql select * from information_schema.ins_stables where db_name = 'db'; if $data[0][6] != abcde then return -1 endi diff --git a/tests/script/tsim/stable/column_add.sim b/tests/script/tsim/stable/column_add.sim index db592e6c69..c0f3b4f490 100644 --- a/tests/script/tsim/stable/column_add.sim +++ b/tests/script/tsim/stable/column_add.sim @@ -9,7 +9,7 @@ sql create table db.stb (ts timestamp, c1 int, c2 binary(4)) tags(t1 int, t2 flo sql create table db.ctb using db.stb tags(101, 102, "103") sql insert into db.ctb values(now, 1, "2") -sql show db.stables +sql select * from information_schema.ins_stables where db_name = 'db' if $rows != 1 then return -1 endi @@ -29,7 +29,7 @@ if $data[0][6] != abd then return -1 endi -sql show db.tables +sql select * from information_schema.ins_tables where db_name = 'db' if $rows != 1 then return -1 endi @@ -74,12 +74,12 @@ sql_error alter table db.stb add column c1 int print ========== step1 add column c3 sql alter table db.stb add column c3 int -sql show db.stables +sql select * from information_schema.ins_stables where db_name = 'db' if $data[0][3] != 4 then return -1 endi -sql show db.tables +sql select * from information_schema.ins_tables where db_name = 'db' if $data[0][3] != 4 then return -1 endi diff --git a/tests/script/tsim/stable/column_drop.sim b/tests/script/tsim/stable/column_drop.sim index 63ac44eccd..0aa7c7035f 100644 --- a/tests/script/tsim/stable/column_drop.sim +++ b/tests/script/tsim/stable/column_drop.sim @@ -9,7 +9,7 @@ sql create table db.stb (ts timestamp, c1 int, c2 binary(4), c3 int, c4 bigint, sql create table db.ctb using db.stb tags(101, 102, "103") sql insert into db.ctb values(now, 1, "2", 3, 4, 5, 6) -sql show db.stables +sql select * from information_schema.ins_stables where db_name = 'db' if $rows != 1 then return -1 endi @@ -29,7 +29,7 @@ if $data[0][6] != abd then return -1 endi -sql show db.tables +sql select * from information_schema.ins_tables where db_name = 'db' if $rows != 1 then return -1 endi @@ -86,12 +86,12 @@ sql_error alter table db.stb drop column c9 print ========== step1 drop column c6 sql alter table db.stb drop column c6 -sql show db.stables +sql select * from information_schema.ins_stables where db_name = 'db' if $data[0][3] != 6 then return -1 endi -sql show db.tables +sql select * from information_schema.ins_tables where db_name = 'db' if $data[0][3] != 6 then return -1 endi diff --git a/tests/script/tsim/stable/metrics.sim b/tests/script/tsim/stable/metrics.sim index 055c7ea78d..896f6fa3c8 100644 --- a/tests/script/tsim/stable/metrics.sim +++ b/tests/script/tsim/stable/metrics.sim @@ -34,7 +34,7 @@ endi print =============== step3 sql create table $mt (ts timestamp, speed int) TAGS(sp int) -sql show stables +sql select * from information_schema.ins_stables where db_name = '$@db@' if $rows != 1 then return -1 endi @@ -60,7 +60,7 @@ $i = 2 $tb = $tbPrefix . $i sql create table $tb using $mt tags(3) -sql show tables +sql select * from information_schema.ins_tables where db_name = '$@db@' if $rows != 3 then return -1 endi @@ -68,7 +68,7 @@ if $data04 != $mt then return -1 endi -sql show stables +sql select * from information_schema.ins_stables where db_name = '$@db@' if $rows != 1 then return -1 endi diff --git a/tests/script/tsim/stable/tag_add.sim b/tests/script/tsim/stable/tag_add.sim index a7615df14c..7ee9aee974 100644 --- a/tests/script/tsim/stable/tag_add.sim +++ b/tests/script/tsim/stable/tag_add.sim @@ -9,7 +9,7 @@ sql create table db.stb (ts timestamp, c1 int, c2 binary(4)) tags(t1 int, t2 bin sql create table db.ctb using db.stb tags(101, "102") sql insert into db.ctb values(now, 1, "2") -sql show db.stables +sql select * from information_schema.ins_stables where db_name = 'db' if $rows != 1 then return -1 endi @@ -29,7 +29,7 @@ if $data[0][6] != abd then return -1 endi -sql show db.tables +sql select * from information_schema.ins_tables where db_name = 'db' if $rows != 1 then return -1 endi @@ -78,12 +78,12 @@ sql_error alter table db.stb add tag c2 int print ========== step1 add tag t3 sql alter table db.stb add tag t3 int -sql show db.stables +sql select * from information_schema.ins_stables where db_name = 'db' if $data[0][3] != 3 then return -1 endi -sql show db.tables +sql select * from information_schema.ins_tables where db_name = 'db' if $data[0][3] != 3 then return -1 endi diff --git a/tests/script/tsim/stable/tag_drop.sim b/tests/script/tsim/stable/tag_drop.sim index 50907be23e..7902358817 100644 --- a/tests/script/tsim/stable/tag_drop.sim +++ b/tests/script/tsim/stable/tag_drop.sim @@ -9,7 +9,7 @@ sql create table db.stb (ts timestamp, c1 int, c2 binary(4)) tags(t1 int, t2 bin sql create table db.ctb using db.stb tags(101, "102") sql insert into db.ctb values(now, 1, "2") -sql show db.stables +sql select * from information_schema.ins_stables where db_name = 'db' if $rows != 1 then return -1 endi @@ -29,7 +29,7 @@ if $data[0][6] != abd then return -1 endi -sql show db.tables +sql select * from information_schema.ins_tables where db_name = 'db' if $rows != 1 then return -1 endi @@ -78,7 +78,7 @@ sql_error alter table db.stb drop tag c2 int print ========== step1 drop tag t2 sql alter table db.stb drop tag t2 -sql show db.stables +sql select * from information_schema.ins_stables where db_name = 'db' if $data[0][4] != 1 then return -1 endi @@ -112,7 +112,7 @@ endi print ========== step2 add tag t3 sql alter table db.stb add tag t3 int -sql show db.stables +sql select * from information_schema.ins_stables where db_name = 'db' if $data[0][4] != 2 then return -1 endi @@ -300,7 +300,7 @@ endi print ========== step7 drop tag t1 sql alter table db.stb drop tag t1 -sql show db.stables +sql select * from information_schema.ins_stables where db_name = 'db' if $data[0][4] != 3 then return -1 endi diff --git a/tests/script/tsim/table/autocreate.sim b/tests/script/tsim/table/autocreate.sim index 50ce0c6af7..9d1d1563b8 100644 --- a/tests/script/tsim/table/autocreate.sim +++ b/tests/script/tsim/table/autocreate.sim @@ -15,7 +15,7 @@ print $data00 $data01 $data02 print =============== create super table sql create table db.st1 (ts timestamp, i int) tags (j int) sql create table db.st2 (ts timestamp, i int, j int) tags (t1 int, t2 int, t3 int) -sql show db.stables +sql select * from information_schema.ins_stables where db_name = 'db' if $rows != 2 then return -1 endi @@ -32,7 +32,7 @@ sql insert into db.c2 using db.st1 tags(2) values(now+1s, 2); sql insert into db.c3 using db.st1 tags(3) values(now+1s, 3); sql insert into db.c4 using db.st1 tags(4) values(now+1s, 4); -sql show db.tables +sql select * from information_schema.ins_tables where db_name = 'db' if $rows != 4 then return -1 endi @@ -76,7 +76,7 @@ sql insert into db.s2 using db.st2 tags(2, 2, 2) values(now+2s, 2, 3); sql insert into db.s3 using db.st2 tags(3, 3, 3) values(now+2s, 3, 4); sql insert into db.s4 using db.st2 tags(4, 4, 4) values(now+2s, 4, 5); -sql show db.tables +sql select * from information_schema.ins_tables where db_name = 'db' if $rows != 8 then return -1 endi diff --git a/tests/script/tsim/table/basic3.sim b/tests/script/tsim/table/basic3.sim index 35cdb74b99..69bf9bb926 100644 --- a/tests/script/tsim/table/basic3.sim +++ b/tests/script/tsim/table/basic3.sim @@ -14,7 +14,7 @@ print $data00 $data01 $data02 print =============== create normal table sql create table db.n1 (ts timestamp, i int) -sql show db.tables +sql select * from information_schema.ins_tables where db_name = 'db' if $rows != 1 then return -1 endi @@ -23,7 +23,7 @@ print $data00 $data01 $data02 print =============== create super table sql create table db.st (ts timestamp, i int) tags (j int) -sql show db.stables +sql select * from information_schema.ins_stables where db_name = 'db' if $rows != 1 then return -1 endi @@ -33,7 +33,7 @@ print $data00 $data01 $data02 print =============== create child table sql create table db.c1 using db.st tags(1) sql create table db.c2 using db.st tags(2) -sql show db.tables +sql select * from information_schema.ins_tables where db_name = 'db' if $rows != 3 then return -1 endi @@ -71,7 +71,7 @@ endi print =============== drop stable sql drop table db.st -sql show db.stables +sql select * from information_schema.ins_stables where db_name = 'db' if $rows != 0 then return -1 endi diff --git a/tests/script/tsim/table/createmulti.sim b/tests/script/tsim/table/createmulti.sim index a73b1bfe8a..c9ba4e643e 100644 --- a/tests/script/tsim/table/createmulti.sim +++ b/tests/script/tsim/table/createmulti.sim @@ -15,7 +15,7 @@ print $data00 $data01 $data02 print =============== create super table sql create table db.st1 (ts timestamp, i int) tags (j int) sql create table db.st2 (ts timestamp, i int, j int) tags (t1 int, t2 int, t3 int) -sql show db.stables +sql select * from information_schema.ins_stables where db_name = 'db' if $rows != 2 then return -1 endi @@ -25,19 +25,19 @@ print $data00 $data01 $data02 print =============== create multiple child tables sql create table db.ct1 using db.st1 tags(1) db.ct2 using db.st1 tags(2); -sql show db.tables +sql select * from information_schema.ins_tables where db_name = 'db' if $rows != 2 then return -1 endi sql create table db.ct3 using db.st2 tags(1, 1, 1) db.ct4 using db.st2 tags(2, 2, 2); -sql show db.tables +sql select * from information_schema.ins_tables where db_name = 'db' if $rows != 4 then return -1 endi sql create table db.ct5 using db.st1 tags(3) db.ct6 using db.st2 tags(3, 3, 3); -sql show db.tables +sql select * from information_schema.ins_tables where db_name = 'db' if $rows != 6 then return -1 endi diff --git a/tests/script/tsim/user/privilege_sysinfo.sim b/tests/script/tsim/user/privilege_sysinfo.sim index 3f81037af4..718083f0d9 100644 --- a/tests/script/tsim/user/privilege_sysinfo.sim +++ b/tests/script/tsim/user/privilege_sysinfo.sim @@ -45,8 +45,8 @@ sql_error drop database db sql_error use db sql_error alter database db replica 1; sql_error show db.vgroups -sql_error show db.stables -sql_error show db.tables +sql_error select * from information_schema.ins_stables where db_name = 'db' +sql_error select * from information_schema.ins_tables where db_name = 'db' print =============== check show sql_error select * from information_schema.ins_users diff --git a/tests/script/tsim/valgrind/checkError5.sim b/tests/script/tsim/valgrind/checkError5.sim index ef37951e77..fe8f588a44 100644 --- a/tests/script/tsim/valgrind/checkError5.sim +++ b/tests/script/tsim/valgrind/checkError5.sim @@ -68,13 +68,13 @@ sql select * from tb order by ts desc print =============== step5: alter stb and insert data sql create table stb (ts timestamp, c1 int, c2 binary(4)) tags(t1 int, t2 float, t3 binary(16)) comment "abd" -sql show db.stables +sql select * from information_schema.ins_stables where db_name = 'db' sql describe stb sql_error alter table stb add column ts int sql create table db.ctb using db.stb tags(101, 102, "103") sql insert into db.ctb values(now, 1, "2") -sql show db.tables +sql select * from information_schema.ins_tables where db_name = 'db' sql select * from db.stb sql select * from tb diff --git a/tests/system-test/1-insert/table_comment.py b/tests/system-test/1-insert/table_comment.py index 465179855e..a0ae364fcd 100644 --- a/tests/system-test/1-insert/table_comment.py +++ b/tests/system-test/1-insert/table_comment.py @@ -105,13 +105,13 @@ class TDTestCase: tdSql.error(f'alter table {tbname} comment "{comment_info}"') def check_comment_info(self,comment_info=None,tb_type=''): if tb_type == '' or tb_type == 'normal_table' or tb_type == 'child_table': - tdSql.query('show tables') + tdSql.query('select * from information_schema.ins_tables where db_name = \'db\'') if comment_info == None: tdSql.checkEqual(tdSql.queryResult[0][8],None) else : tdSql.checkEqual(tdSql.queryResult[0][8],comment_info) elif tb_type == 'stable': - tdSql.query('show stables') + tdSql.query('select * from information_schema.ins_stables where db_name = \'db\'') if comment_info == None: tdSql.checkEqual(tdSql.queryResult[0][6],None) else : diff --git a/tests/system-test/2-query/distribute_agg_sum.py b/tests/system-test/2-query/distribute_agg_sum.py index 90946f388d..9be4602fd9 100644 --- a/tests/system-test/2-query/distribute_agg_sum.py +++ b/tests/system-test/2-query/distribute_agg_sum.py @@ -109,7 +109,7 @@ class TDTestCase: vnode_tables[vgroup_id[0]]=[] # check sub_table of per vnode ,make sure sub_table has been distributed - tdSql.query(f"show {dbname}.tables like 'ct%'") + tdSql.query(f"select * from information_schema.ins_tables where db_name = '{dbname}' and table_name like 'ct%'") table_names = tdSql.queryResult tablenames = [] for table_name in table_names: diff --git a/tests/system-test/2-query/twa.py b/tests/system-test/2-query/twa.py index 108f955977..8281527bd4 100644 --- a/tests/system-test/2-query/twa.py +++ b/tests/system-test/2-query/twa.py @@ -69,7 +69,7 @@ class TDTestCase: vnode_tables[vgroup_id[0]]=[] # check sub_table of per vnode ,make sure sub_table has been distributed - tdSql.query("show tables like 'ct%'") + tdSql.query(f"select * from information_schema.ins_tables where db_name = 'testdb' and table_name like 'ct%'") table_names = tdSql.queryResult tablenames = [] for table_name in table_names: diff --git a/tests/system-test/5-taos-tools/taosdump/taosdumpTestColTag.py b/tests/system-test/5-taos-tools/taosdump/taosdumpTestColTag.py index eb4de435ec..8c62f713b8 100644 --- a/tests/system-test/5-taos-tools/taosdump/taosdumpTestColTag.py +++ b/tests/system-test/5-taos-tools/taosdump/taosdumpTestColTag.py @@ -288,16 +288,16 @@ class TDTestCase: datacheck = self.table1_checkall(sql) tdSql.checkRows(4) - tdSql.query("show db.stables like 'stable_1%' ") + tdSql.query("select * from information_schema.ins_stables where db_name = 'db' like 'stable_1%' ") tdSql.checkRows(1) - tdSql.query("show db.tables like 'table%' ") + tdSql.query("select * from information_schema.ins_tables where db_name = 'db' like 'table%' ") tdSql.checkRows(2) self.cr_tb1 = "create_table_1~!@#$%^&*()-_+=[]{}':,<.>/?stST13579" tdSql.execute( "create table db.`%s` as select avg(`%s`) from db.`%s` where ts > now interval(1m) sliding(30s);" % (self.cr_tb1, self.col_bigint, self.stb1)) - tdSql.query("show db.tables like 'create_table_%' ") + tdSql.query("select * from information_schema.ins_tables where db_name = 'db' like 'create_table_%' ") tdSql.checkRows(1) print(r"==============drop\ add\ change\ modify column or tag") @@ -696,7 +696,7 @@ class TDTestCase: tdLog.exit(e) tdSql.error("select * from db.`%s`" % self.tb1) - tdSql.query("show db.stables like 'stable_1%' ") + tdSql.query("select * from information_schema.ins_stables where db_name = 'db' like 'stable_1%' ") tdSql.checkRows(1) try: @@ -785,7 +785,7 @@ class TDTestCase: tdSql.execute( "create table `%s` as select * from `%s` ;" % (self.cr_tb2, self.stb2)) - tdSql.query("show db.tables like 'create_table_%' ") + tdSql.query("select * from information_schema.ins_tables where db_name = 'db' like 'create_table_%' ") tdSql.checkRows(1) print("==============step3,#create regular_table; insert regular_table; show regular_table; select regular_table; drop regular_table")