update test case

This commit is contained in:
yihaoDeng 2024-11-26 11:17:01 +08:00
parent 3bae675108
commit 34ca4ca81f
2 changed files with 40 additions and 785 deletions

View File

@ -1576,6 +1576,7 @@
,,y,script,./test.sh -f tsim/tag/tinyint.sim
,,y,script,./test.sh -f tsim/tag/drop_tag.sim
,,y,script,./test.sh -f tsim/tag/tbNameIn.sim
,,y,script,./test.sh -f tsim/tag/change_multi_tag.sim
,,y,script,./test.sh -f tmp/monitor.sim
,,y,script,./test.sh -f tsim/tagindex/add_index.sim
,,n,script,./test.sh -f tsim/tagindex/sma_and_tag_index.sim

View File

@ -20,827 +20,81 @@ sql create database $db
sql use $db
print =============== step2
$j = 3
$i = 2
$mt = $mtPrefix . $i
$tb = $tbPrefix . $i
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tagCol2 tinyint, tagCol3 smallint, tagCol4 int, tagCol5 bigint, tagCol6 nchar(10), tagCol7 binary(8))
sql create table $tb using $mt tags( 1, 2, 3, 5, "test", "test")
$tbj = $tbPrefix . $j
$ntable = tb_normal_table
sql create table $mt (ts timestamp, tbcol int) TAGS(tagCol1 bool, tagCol2 tinyint, tagCol3 smallint, tagCol4 int, tagCol5 bigint, tagCol6 nchar(10), tagCol7 binary(8))
sql create table $tb using $mt tags( 1, 2, 3, 5,7, "test", "test")
sql create table $tbj using $mt tags( 2, 3, 4, 6,8, "testj", "testj")
sql create table $ntable (ts timestamp, f int)
sql insert into $tb values(now, 1)
sql select * from $mt where tgcol2 = 2
if $rows != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data02 != 1 then
return -1
endi
if $data03 != 2 then
return -1
endi
sql alter table
sql alter table $mt drop tag tgcol2
sql alter table $mt add tag tgcol4 int
sql reset query cache
sql alter table $tb set tag tgcol4 =4
sql reset query cache
sql select * from $mt where tgcol4 = 4
print $data01 $data02 $data03
if $rows != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data02 != 1 then
return -1
endi
if $data03 != 4 then
return -1
endi
sql select * from $mt where tgcol2 = 1 -x step2
return -1
step2:
print =============== step3
$i = 3
$mt = $mtPrefix . $i
$tb = $tbPrefix . $i
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint)
sql create table $tb using $mt tags( 1, 2 )
sql insert into $tb values(now, 1)
sql select * from $mt where tgcol2 = 2
if $rows != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data02 != 1 then
return -1
endi
if $data03 != 2 then
sql_error alter table $mt set tag tgcol1 = 1,tagcol2 = 2, tag3 = 4 # set tag value on supertable
sql_error alter table $ntable set tag f = 10 # set normal table value
sql_error alter table $tbj set tag tagCol1=1,tagCol1 = 2 # dumplicate tag name
sql_error alter table $tbj set tag tagCol1=1,tagCol1 = 2 # not exist tag
sql_error alter table $tbj set tag tagCol1 = 1, tagCol5="xxxxxxxxxxxxxxxx"
sql_error alter table $tbj set tag tagCol1 = 1, tagCol5="xxxxxxxxxxxxxxxx", tagCol7="yyyyyyyyyyyyyyyyyyyyyyyyy"
sql alter table $tbj set tag tagCol1 = 100, tagCol2 = 100
sql select * from $mt where tagCol2 = 100
if $rows != 0 then
return -1
endi
sql alter table $mt drop tag tgcol2
sql alter table $mt add tag tgcol4 tinyint
sql reset query cache
sql alter table $tb set tag tgcol4=4
sql reset query cache
sql select * from $mt where tgcol4 = 4
print $data01 $data02 $data03
if $rows != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data02 != 1 then
return -1
endi
if $data03 != 4 then
sql select * from $mt where tagCol1 = 1
if $rows != 2 then
return -1
endi
sql select * from $mt where tgcol2 = 1 -x step3
return -1
step3:
sql alter table $tbj set tag tagCol1=true,tagCol2=-1,tagcol3=-10, tagcol4=-100,tagcol5=-1000,tagCol6="empty",tagCol7="empty"
sql alter table $tb set tag tagCol1=0
print =============== step4
$i = 4
$mt = $mtPrefix . $i
$tb = $tbPrefix . $i
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float)
sql create table $tb using $mt tags( 1, 2 )
sql insert into $tb values(now, 1)
sql select * from $mt where tgcol2 = 2
if $rows != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data02 != 1 then
return -1
endi
if $data03 != 2.00000 then
sql select * from $mt where tagCol1 = true
if $rows != 0 then
return -1
endi
sql describe $tb
print sql describe $tb
if $data21 != BIGINT then
return -1
endi
if $data31 != FLOAT then
return -1
endi
if $data23 != TAG then
return -1
endi
if $data33 != TAG then
sql select * from $mt where tagCol2 = -1
if $rows != 0 then
return -1
endi
sql alter table $mt drop tag tgcol2
sql alter table $mt add tag tgcol4 float
sql reset query cache
sql alter table $tb set tag tgcol4=4
sql reset query cache
sql select * from $mt where tgcol4 = 4
print $data01 $data02 $data03
if $rows != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data02 != 1 then
return -1
endi
if $data03 != 4.00000 then
sql select * from $mt where tagCol3 = -10
if $rows != 0 then
return -1
endi
sql select * from $mt where tgcol2 = 1 -x step4
return -1
step4:
print =============== step5
$i = 5
$mt = $mtPrefix . $i
$tb = $tbPrefix . $i
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10))
sql create table $tb using $mt tags( 1, '2' )
sql insert into $tb values(now, 1)
sql select * from $mt where tgcol2 = '2'
if $rows != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data02 != 1.000000000 then
return -1
endi
if $data03 != 2 then
sql select * from $mt where tagCol4 = -100
if $rows != 0 then
return -1
endi
sql alter table $mt drop tag tgcol2
sql alter table $mt add tag tgcol4 smallint
sql reset query cache
sql alter table $tb set tag tgcol4=4
sql reset query cache
sql select * from $mt where tgcol4 = 4
print $data01 $data02 $data03
if $rows != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data02 != 1.000000000 then
return -1
endi
if $data03 != 4 then
sql select * from $mt where tagCol4 = -1000
if $rows != 0 then
return -1
endi
sql select * from $mt where tgcol3 = '1' -x step5
return -1
step5:
print =============== step6
$i = 6
$mt = $mtPrefix . $i
$tb = $tbPrefix . $i
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 tinyint)
sql create table $tb using $mt tags( 1, 2, 3 )
sql insert into $tb values(now, 1)
sql select * from $mt where tgcol2 = 2
if $rows != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data02 != 1 then
return -1
endi
if $data03 != 2 then
return -1
endi
if $data04 != 3 then
sql select * from $mt where tagCol5 = -10000
if $rows != 0 then
return -1
endi
sql alter table $mt rename tag tgcol1 tgcol4
sql alter table $mt drop tag tgcol2
sql alter table $mt drop tag tgcol3
sql alter table $mt add tag tgcol5 binary(10)
sql alter table $mt add tag tgcol6 binary(10)
sql reset query cache
sql alter table $tb set tag tgcol4=false
sql alter table $tb set tag tgcol5='5'
sql alter table $tb set tag tgcol6='6'
sql reset query cache
sql select * from $mt where tgcol5 = '5'
print $data01 $data02 $data03
if $rows != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data02 != 0 then
return -1
endi
if $data03 != 5 then
return -1
endi
if $data04 != 6 then
sql select * from $mt where tagCol6 = "empty"
if $rows != 0 then
return -1
endi
sql select * from $mt where tgcol6 = '6'
print $data01 $data02 $data03
if $rows != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data02 != 0 then
return -1
endi
if $data03 != 5 then
return -1
endi
if $data04 != 6 then
sql select * from $mt where tagCol6 = "empty1"
if $rows != 0 then
return -1
endi
sql select * from $mt where tgcol4 = 1
if $rows != 0 then
return -1
endi
sql select * from $mt where tgcol3 = 1 -x step52
return -1
step52:
print =============== step7
$i = 7
$mt = $mtPrefix . $i
$tb = $tbPrefix . $i
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 smallint, tgcol2 tinyint, tgcol3 binary(10))
sql create table $tb using $mt tags( 1, 2, '3' )
sql insert into $tb values(now, 1)
sql select * from $mt where tgcol3 = '3'
if $rows != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data02 != 1 then
return -1
endi
if $data03 != 2 then
return -1
endi
if $data04 != 3 then
return -1
endi
sql alter table $mt rename tag tgcol1 tgcol4
sql alter table $mt drop tag tgcol2
sql alter table $mt drop tag tgcol3
sql alter table $mt add tag tgcol5 bigint
sql alter table $mt add tag tgcol6 tinyint
sql reset query cache
sql alter table $tb set tag tgcol4=4
sql alter table $tb set tag tgcol5=5
sql alter table $tb set tag tgcol6=6
sql reset query cache
sql select * from $mt where tgcol6 = 6
print $data01 $data02 $data03
if $rows != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data02 != 4 then
return -1
endi
if $data03 != 5 then
return -1
endi
if $data04 != 6 then
return -1
endi
sql select * from $mt where tgcol2 = 1 -x step71
return -1
step71:
sql select * from $mt where tgcol3 = 1 -x step72
return -1
step72:
print =============== step8
$i = 8
$mt = $mtPrefix . $i
$tb = $tbPrefix . $i
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bigint, tgcol2 float, tgcol3 binary(10))
sql create table $tb using $mt tags( 1, 2, '3' )
sql insert into $tb values(now, 1)
sql select * from $mt where tgcol3 = '3'
if $rows != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data02 != 1 then
return -1
endi
if $data03 != 2.00000 then
return -1
endi
if $data04 != 3 then
return -1
endi
sql alter table $mt rename tag tgcol1 tgcol4
sql alter table $mt drop tag tgcol2
sql alter table $mt drop tag tgcol3
sql alter table $mt add tag tgcol5 binary(17)
sql alter table $mt add tag tgcol6 bool
sql reset query cache
sql alter table $tb set tag tgcol4=4
sql alter table $tb set tag tgcol5='5'
sql alter table $tb set tag tgcol6='1'
sql reset query cache
sql select * from $mt where tgcol5 = '5'
print select * from $mt where tgcol5 = 5
print $data01 $data02 $data03 $data04
if $rows != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data02 != 4 then
return -1
endi
if $data03 != 5 then
return -1
endi
if $data04 != 1 then
return -1
endi
sql select * from $mt where tgcol2 = 1 -x step81
return -1
step81:
sql select * from $mt where tgcol3 = 1 -x step82
return -1
step82:
print =============== step9
$i = 9
$mt = $mtPrefix . $i
$tb = $tbPrefix . $i
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10), tgcol3 binary(10))
sql create table $tb using $mt tags( 1, '2', '3' )
sql insert into $tb values(now, 1)
sql select * from $mt where tgcol2 = '2'
if $rows != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data02 != 1.000000000 then
return -1
endi
if $data03 != 2 then
return -1
endi
if $data04 != 3 then
return -1
endi
sql alter table $mt rename tag tgcol1 tgcol4
sql alter table $mt drop tag tgcol2
sql alter table $mt drop tag tgcol3
sql alter table $mt add tag tgcol5 bool
sql alter table $mt add tag tgcol6 float
sql reset query cache
sql alter table $tb set tag tgcol4=4
sql alter table $tb set tag tgcol5=1
sql alter table $tb set tag tgcol6=6
sql reset query cache
sql select * from $mt where tgcol5 = 1
print $data01 $data02 $data03
if $rows != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data02 != 4.000000000 then
return -1
endi
if $data03 != 1 then
return -1
endi
if $data04 != 6.00000 then
return -1
endi
sql select * from $mt where tgcol3 = 1 -x step91
return -1
step91:
sql select * from $mt where tgcol2 = 1 -x step92
return -1
step92:
print =============== step10
$i = 10
$mt = $mtPrefix . $i
$tb = $tbPrefix . $i
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 binary(10), tgcol3 binary(10), tgcol4 binary(10))
sql create table $tb using $mt tags( '1', '2', '3', '4' )
sql insert into $tb values(now, 1)
sql select * from $mt where tgcol4 = '4'
if $rows != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data02 != 1 then
return -1
endi
if $data03 != 2 then
return -1
endi
if $data04 != 3 then
return -1
endi
if $data05 != 4 then
return -1
endi
sql alter table $mt rename tag tgcol1 tgcol4 -x step103
return -1
step103:
sql alter table $mt drop tag tgcol2
sql alter table $mt drop tag tgcol3
sql alter table $mt drop tag tgcol4
sql reset query cache
sql alter table $mt add tag tgcol4 binary(10)
sql alter table $mt add tag tgcol5 bool
sql reset query cache
sql alter table $tb set tag tgcol4='4'
sql alter table $tb set tag tgcol5=false
sql reset query cache
sql select * from $mt where tgcol4 = '4'
print $data01 $data02 $data03
if $rows != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data02 != 1 then
return -1
endi
if $data03 != 4 then
return -1
endi
if $data04 != 0 then
return -1
endi
if $data05 != null then
return -1
endi
sql select * from $mt where tgcol2 = 1 -x step101
return -1
step101:
sql select * from $mt where tgcol3 = 1 -x step102
return -1
step102:
print =============== step11
$i = 11
$mt = $mtPrefix . $i
$tb = $tbPrefix . $i
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int, tgcol3 smallint, tgcol4 float, tgcol5 binary(10))
sql create table $tb using $mt tags( 1, 2, 3, 4, '5' )
sql insert into $tb values(now, 1)
sql select * from $mt where tgcol1 = 1
if $rows != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data02 != 1 then
return -1
endi
if $data03 != 2 then
return -1
endi
if $data04 != 3 then
return -1
endi
if $data05 != 4.00000 then
return -1
endi
if $data06 != 5 then
return -1
endi
sql alter table $mt rename tag tgcol1 tgcol4 -x step114
return -1
step114:
sql alter table $mt drop tag tgcol2
sql alter table $mt drop tag tgcol3
sql alter table $mt drop tag tgcol4
sql alter table $mt drop tag tgcol5
sql reset query cache
sql alter table $mt add tag tgcol4 binary(10)
sql alter table $mt add tag tgcol5 int
sql alter table $mt add tag tgcol6 binary(10)
sql alter table $mt add tag tgcol7 bigint
sql alter table $mt add tag tgcol8 smallint
sql reset query cache
sql alter table $tb set tag tgcol4='4'
sql alter table $tb set tag tgcol5=5
sql alter table $tb set tag tgcol6='6'
sql alter table $tb set tag tgcol7=7
sql alter table $tb set tag tgcol8=8
sql reset query cache
sql select * from $mt where tgcol5 =5
print $data01 $data02 $data03
if $rows != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data02 != 1 then
return -1
endi
if $data03 != 4 then
return -1
endi
if $data04 != 5 then
return -1
endi
if $data05 != 6 then
return -1
endi
if $data06 != 7 then
return -1
endi
if $data07 != 8 then
return -1
endi
sql select * from $mt where tgcol2 = 1 -x step111
return -1
step111:
sql select * from $mt where tgcol3 = 1 -x step112
return -1
step112:
sql select * from $mt where tgcol9 = 1 -x step113
return -1
step113:
print =============== step12
$i = 12
$mt = $mtPrefix . $i
$tb = $tbPrefix . $i
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 smallint, tgcol3 float, tgcol4 double, tgcol5 binary(10), tgcol6 binary(20))
sql create table $tb using $mt tags( 1, 2, 3, 4, '5', '6' )
sql insert into $tb values(now, 1)
sql select * from $mt where tgcol1 = 1
if $rows != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data02 != 1 then
return -1
endi
if $data03 != 2 then
return -1
endi
if $data04 != 3.00000 then
return -1
endi
if $data05 != 4.000000000 then
return -1
endi
if $data06 != 5 then
return -1
endi
if $data07 != 6 then
return -1
endi
sql alter table $mt drop tag tgcol2
sql alter table $mt drop tag tgcol3
sql alter table $mt drop tag tgcol4
sql alter table $mt drop tag tgcol5
sql reset query cache
sql alter table $mt add tag tgcol2 binary(10)
sql alter table $mt add tag tgcol3 int
sql alter table $mt add tag tgcol4 binary(10)
sql alter table $mt add tag tgcol5 bigint
sql reset query cache
sql alter table $tb set tag tgcol1=false
sql alter table $tb set tag tgcol2='5'
sql alter table $tb set tag tgcol3=4
sql alter table $tb set tag tgcol4='3'
sql alter table $tb set tag tgcol5=2
sql alter table $tb set tag tgcol6='1'
sql reset query cache
sql select * from $mt where tgcol4 = '3'
print $data01 $data02 $data03
if $rows != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data02 != 0 then
return -1
endi
if $data03 != 1 then
return -1
endi
if $data04 != 5 then
return -1
endi
if $data05 != 4 then
return -1
endi
if $data06 != 3 then
return -1
endi
if $data07 != 2 then
return -1
endi
sql select * from $mt where tgcol2 = '5'
if $rows != 1 then
return -1
endi
sql select * from $mt where tgcol3 = 4
if $rows != 1 then
return -1
endi
sql select * from $mt where tgcol5 = 2
if $rows != 1 then
return -1
endi
sql select * from $mt where tgcol6 = '1'
if $rows != 1 then
return -1
endi
print =============== step13
$i = 13
$mt = $mtPrefix . $i
$tb = $tbPrefix . $i
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20))
sql create table $tb using $mt tags( '1', 2, 3, '4', 5, '6' )
sql insert into $tb values(now, 1)
sql select * from $mt where tgcol1 = '1'
if $rows != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data02 != 1 then
return -1
endi
if $data03 != 2 then
return -1
endi
if $data04 != 3 then
return -1
endi
if $data05 != 4 then
return -1
endi
if $data06 != 5.000000000 then
return -1
endi
if $data07 != 6 then
return -1
endi
sql alter table $mt drop tag tgcol2
sql alter table $mt drop tag tgcol4
sql alter table $mt drop tag tgcol6
sql reset query cache
sql alter table $mt add tag tgcol2 binary(10)
sql alter table $mt add tag tgcol4 int
sql alter table $mt add tag tgcol6 bigint
sql reset query cache
sql alter table $tb set tag tgcol1='7'
sql alter table $tb set tag tgcol2='8'
sql alter table $tb set tag tgcol3=9
sql alter table $tb set tag tgcol4=10
sql alter table $tb set tag tgcol5=11
sql alter table $tb set tag tgcol6=12
sql reset query cache
sql select * from $mt where tgcol2 = '8'
print $data01 $data02 $data03
if $rows != 1 then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data02 != 7 then
return -1
endi
if $data03 != 9 then
return -1
endi
if $data04 != 11.000000000 then
return -1
endi
if $data05 != 8 then
return -1
endi
if $data06 != 10 then
return -1
endi
if $data07 != 12 then
return -1
endi
print =============== step14
$i = 14
$mt = $mtPrefix . $i
$tb = $tbPrefix . $i
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 bigint)
sql create table $tb using $mt tags( 1, 1 )
sql insert into $tb values(now, 1)
sql alter table $mt add tag tgcol3 binary(10)
sql alter table $mt add tag tgcol4 int
sql alter table $mt add tag tgcol5 bigint
sql alter table $mt add tag tgcol6 bigint
sql reset query cache
sql alter table $mt drop tag tgcol6
sql alter table $mt add tag tgcol7 bigint
sql alter table $mt add tag tgcol8 bigint
print =============== clear
sql drop database $db
sql select * from information_schema.ins_databases
if $rows != 2 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT