basic2.sim 4.1 KB
Newer Older
S
Shengliang Guan 已提交
1 2
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
S
Shengliang Guan 已提交
3 4
system sh/cfg.sh -n dnode1 -c debugflag -v 131
system sh/exec.sh -n dnode1 -s start
S
Shengliang Guan 已提交
5 6
sql connect

S
Shengliang Guan 已提交
7
print =============== step1: create drop show dnodes
S
Shengliang Guan 已提交
8 9 10 11 12
$x = 0
step1:
	$x = $x + 1
	sleep 1000
	if $x == 10 then
13
	  print ---> dnode not ready!
S
Shengliang Guan 已提交
14 15 16
		return -1
	endi
sql show dnodes
17
print ---> $data00 $data01 $data02 $data03 $data04 $data05
S
Shengliang Guan 已提交
18 19 20
if $rows != 1 then
  return -1
endi
21 22 23 24
if $data(1)[4] != ready then
  goto step1
endi

S
Shengliang Guan 已提交
25 26 27
$tbPrefix = tb
$tbNum = 5
$rowNum = 10
28

S
Shengliang Guan 已提交
29 30 31 32
print =============== step2: prepare data
sql create database db vgroups 2
sql use db
sql create table if not exists stb (ts timestamp, tbcol int, tbcol2 float, tbcol3 double) tags (tgcol int unsigned)
S
Shengliang Guan 已提交
33

S
Shengliang Guan 已提交
34 35 36 37 38 39 40 41 42 43 44
$i = 0
while $i < $tbNum
  $tb = $tbPrefix . $i
  sql create table $tb using stb tags( $i )
  $x = 0
  while $x < $rowNum
    $cc = $x * 60000
    $ms = 1601481600000 + $cc
    sql insert into $tb values ($ms , $x , $x , $x ) 
    $x = $x + 1
  endw 
S
Shengliang Guan 已提交
45

S
Shengliang Guan 已提交
46 47 48 49 50
  $cc = $x * 60000
  $ms = 1601481600000 + $cc
  sql insert into $tb values ($ms , NULL , NULL , NULL ) 
  $i = $i + 1
endw 
S
Shengliang Guan 已提交
51

S
Shengliang Guan 已提交
52 53
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start -v
S
Shengliang Guan 已提交
54

S
Shengliang Guan 已提交
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
print =============== step3: tb
sql select avg(tbcol) from tb1
sql select avg(tbcol) from tb1 where ts <= 1601481840000
sql select avg(tbcol) as b from tb1
sql select avg(tbcol) as b from tb1 interval(1d)
sql select avg(tbcol) as b from tb1 where ts <= 1601481840000 interval(1m)
sql select bottom(tbcol, 2) from tb1 where ts <= 1601481840000 
sql select top(tbcol, 2) from tb1 where ts <= 1601481840000 
sql select percentile(tbcol, 2) from tb1 where ts <= 1601481840000 
sql select leastsquares(tbcol, 1, 1) as b from tb1 where ts <= 1601481840000
sql show table distributed tb1
sql select count(tbcol) as b from tb1 where ts <= 1601481840000 interval(1m)
sql select diff(tbcol) from tb1 where ts <= 1601481840000 
sql select diff(tbcol) from tb1 where tbcol > 5 and tbcol < 20
sql select first(tbcol), last(tbcol) as b from tb1 where ts <= 1601481840000 interval(1m)
sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), sum(tbcol), stddev(tbcol) from tb1 where ts <= 1601481840000 partition by tgcol interval(1m)
#sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from tb1 where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0)
sql select last_row(*) from tb1 where tbcol > 5 and tbcol < 20
S
Shengliang Guan 已提交
73

S
Shengliang Guan 已提交
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
print =============== step4: stb
sql select avg(tbcol) as c from stb
sql select avg(tbcol) as c from stb where ts <= 1601481840000
sql select avg(tbcol) as c from stb where tgcol < 5 and ts <= 1601481840000
sql select avg(tbcol) as c from stb interval(1m)
sql select avg(tbcol) as c from stb interval(1d)
sql select avg(tbcol) as b from stb where ts <= 1601481840000 interval(1m)
sql select avg(tbcol) as c from stb group by tgcol
sql select avg(tbcol) as b from stb where ts <= 1601481840000 partition by tgcol interval(1m)
sql show table distributed stb
sql select count(tbcol) as b from stb where ts <= 1601481840000 partition by tgcol interval(1m)
sql select diff(tbcol) from stb where ts <= 1601481840000 
sql select first(tbcol), last(tbcol) as c from stb group by tgcol
sql select first(tbcol), last(tbcol) as b from stb where ts <= 1601481840000 and tbcol2 is null partition by tgcol interval(1m)
sql select first(tbcol), last(tbcol) as b from stb where ts <= 1601481840000 partition by tgcol interval(1m)
sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), sum(tbcol), stddev(tbcol) from stb where ts <= 1601481840000 partition by tgcol interval(1m)
#sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from stb where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0)
sql select last_row(tbcol), stddev(tbcol) from stb where tbcol > 5 and tbcol < 20 group by tgcol
92

S
Shengliang Guan 已提交
93
_OVER:
S
Shengliang Guan 已提交
94
system sh/exec.sh -n dnode1 -s stop -x SIGINT
95
print =============== check
S
Shengliang Guan 已提交
96
$null=
97

S
Shengliang Guan 已提交
98
system_content sh/checkValgrind.sh -n dnode1 
99
print cmd return result ----> [ $system_content ]
S
Shengliang Guan 已提交
100
if $system_content > 0 then
S
Shengliang Guan 已提交
101
  return -1
102 103 104
endi 

if $system_content == $null then
S
Shengliang Guan 已提交
105
  return -1
106
endi