提交 15fae241 编写于 作者: X Xiaoyu Wang

enh: show command optimize

上级 4155a3be
......@@ -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)
......
......@@ -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
......
......@@ -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
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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 :
......
......@@ -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:
......
......@@ -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:
......
......@@ -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")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册