TDengine/tests/script/general/parser/limit.sim

83 lines
2.1 KiB
Text
Raw Normal View History

2020-04-19 15:28:22 +00:00
system sh/stop_dnodes.sh
2020-04-29 09:30:03 +00:00
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1
2020-07-04 07:43:13 +00:00
system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1
2020-04-19 15:28:22 +00:00
system sh/exec.sh -n dnode1 -s start
2021-01-09 06:25:54 +00:00
sleep 100
2020-04-19 15:28:22 +00:00
sql connect
$dbPrefix = lm_db
$tbPrefix = lm_tb
$stbPrefix = lm_stb
$tbNum = 10
$rowNum = 10
$totalNum = $tbNum * $rowNum
$ts0 = 1537146000000
$delta = 600000
print ========== limit.sim
$i = 0
$db = $dbPrefix . $i
$stb = $stbPrefix . $i
sql drop database $db -x step1
step1:
sql create database $db
print ====== create tables
sql use $db
sql create table $stb (ts timestamp, c1 int, c2 bigint, c3 float, c4 double, c5 smallint, c6 tinyint, c7 bool, c8 binary(10), c9 nchar(10)) tags(t1 int)
$i = 0
$ts = $ts0
$halfNum = $tbNum / 2
while $i < $halfNum
$tbId = $i + $halfNum
$tb = $tbPrefix . $i
$tb1 = $tbPrefix . $tbId
sql create table $tb using $stb tags( $i )
sql create table $tb1 using $stb tags( $tbId )
$x = 0
while $x < $rowNum
$xs = $x * $delta
$ts = $ts0 + $xs
$c = $x / 10
$c = $c * 10
$c = $x - $c
$binary = 'binary . $c
$binary = $binary . '
$nchar = 'nchar . $c
$nchar = $nchar . '
2020-12-04 14:33:41 +00:00
$ts = $ts + $i
sql insert into $tb values ( $ts , $c , $c , $c , $c , $c , $c , true, $binary , $nchar )
$ts = $ts + $halfNum
sql insert into $tb1 values ( $ts , $c , NULL , $c , NULL , $c , $c , true, $binary , $nchar )
2020-04-19 15:28:22 +00:00
$x = $x + 1
endw
$i = $i + 1
endw
print ====== tables created
2020-05-07 09:36:56 +00:00
run general/parser/limit_tb.sim
run general/parser/limit_stb.sim
2020-04-19 15:28:22 +00:00
print ================== restart server to commit data into disk
system sh/exec.sh -n dnode1 -s stop -x SIGINT
2021-02-04 03:34:05 +00:00
sleep 500
2020-04-19 15:28:22 +00:00
system sh/exec.sh -n dnode1 -s start
print ================== server restart completed
sql connect
2021-01-09 06:25:54 +00:00
sleep 100
2020-04-19 15:28:22 +00:00
2020-05-07 09:36:56 +00:00
run general/parser/limit_tb.sim
run general/parser/limit_stb.sim
2020-05-12 10:28:00 +00:00
print ========> TD-6017
sql use $db
sql select * from (select ts, top(c1, 5) from $tb where ts >= $ts0 order by ts desc limit 3 offset 1)
sql select * from (select ts, top(c1, 5) from $stb where ts >= $ts0 order by ts desc limit 3 offset 1)
2020-05-12 10:28:00 +00:00
system sh/exec.sh -n dnode1 -s stop -x SIGINT