checkError6.sim 7.2 KB
Newer Older
S
Shengliang Guan 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c debugflag -v 131
system sh/exec.sh -n dnode1 -s start -v
sql connect

print =============== step1: create drop show dnodes
$x = 0
step1:
	$x = $x + 1
	sleep 1000
	if $x == 10 then
	  print ---> dnode not ready!
		return -1
	endi
sql show dnodes
print ---> $data00 $data01 $data02 $data03 $data04 $data05
if $rows != 1 then
  return -1
endi
if $data(1)[4] != ready then
  goto step1
endi

$tbPrefix = tb
$tbNum = 5
$rowNum = 10

print =============== step2: prepare data
sql create database db vgroups 2
sql use db
S
Shengliang Guan 已提交
32
sql create table if not exists stb (ts timestamp, tbcol int, tbcol2 float, tbcol3 double, tbcol4 binary(30), tbcol5 binary(30)) tags (tgcol int unsigned)
S
Shengliang Guan 已提交
33 34 35 36 37 38 39 40 41

$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
S
Shengliang Guan 已提交
42
    sql insert into $tb values ($ms , $x , $x , $x , "abcd1234=-+*" , "123456 0" ) 
S
Shengliang Guan 已提交
43 44
    $x = $x + 1
  endw 
S
Shengliang Guan 已提交
45 46 47

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

S
Shengliang Guan 已提交
52
print =============== step3: tb
S
Shengliang Guan 已提交
53 54 55 56
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)
S
Shengliang Guan 已提交
57 58 59 60 61 62
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
S
Shengliang Guan 已提交
63
sql select count(1) from tb1
S
Shengliang Guan 已提交
64 65 66 67 68
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)
S
Shengliang Guan 已提交
69
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)
S
Shengliang Guan 已提交
70
sql select last_row(*) from tb1 where tbcol > 5 and tbcol < 20
S
Shengliang Guan 已提交
71 72 73 74 75 76 77
sql select _wstart, _wend, _wduration, _qstart, _qend,  count(*) from tb1 interval(10s, 2s) sliding(10s)
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 log(tbcol), abs(tbcol), pow(tbcol, 2), sqrt(tbcol), sin(tbcol), cos(tbcol), tan(tbcol), asin(tbcol), acos(tbcol), atan(tbcol), ceil(tbcol), floor(tbcol), round(tbcol), atan(tbcol) from tb1
sql select length("abcd1234"), char_length("abcd1234=-+*") from tb1
sql select tbcol4, length(tbcol4), lower(tbcol4), upper(tbcol4), ltrim(tbcol4), rtrim(tbcol4), concat(tbcol4, tbcol5), concat_ws('_', tbcol4, tbcol5), substr(tbcol4, 1, 4)  from tb1
sql select * from tb1 where tbcol not in (1,2,3,null);
sql select * from tb1 where tbcol + 3 <> null;
S
Shengliang Guan 已提交
78 79

print =============== step4: stb
S
Shengliang Guan 已提交
80 81 82 83 84
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)
S
Shengliang Guan 已提交
85
sql select avg(tbcol) as b from stb where ts <= 1601481840000 interval(1m)
S
Shengliang Guan 已提交
86
sql select avg(tbcol) as c from stb group by tgcol
S
Shengliang Guan 已提交
87 88
sql select avg(tbcol) as b from stb where ts <= 1601481840000 partition by tgcol interval(1m)
sql show table distributed stb
S
Shengliang Guan 已提交
89
sql select count(1) from stb
S
Shengliang Guan 已提交
90 91 92 93 94 95
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)
S
Shengliang Guan 已提交
96
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)
S
Shengliang Guan 已提交
97
sql select last_row(tbcol), stddev(tbcol) from stb where tbcol > 5 and tbcol < 20 group by tgcol
S
Shengliang Guan 已提交
98 99 100 101 102 103 104 105 106
sql select _wstart, _wend, _wduration, _qstart, _qend,  count(*) from stb interval(10s, 2s) sliding(10s)
sql select log(tbcol), abs(tbcol), pow(tbcol, 2), sqrt(tbcol), sin(tbcol), cos(tbcol), tan(tbcol), asin(tbcol), acos(tbcol), atan(tbcol), ceil(tbcol), floor(tbcol), round(tbcol), atan(tbcol) from stb
sql select length("abcd1234"), char_length("abcd1234=-+*") from stb
sql select tbcol4, length(tbcol4), lower(tbcol4), upper(tbcol4), ltrim(tbcol4), rtrim(tbcol4), concat(tbcol4, tbcol5), concat_ws('_', tbcol4, tbcol5), substr(tbcol4, 1, 4)  from stb
sql select * from stb where tbcol not in (1,2,3,null);
sql select * from stb where tbcol + 3 <> null;

print =============== step5: explain

S
Shengliang Guan 已提交
107

S
Shengliang Guan 已提交
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
print =============== check
$null=

system_content sh/checkValgrind.sh -n dnode1 
print cmd return result ----> [ $system_content ]
if $system_content > 0 then
  return -1
endi 

if $system_content == $null then
  return -1
endi 

print =============== restart
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start -v

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 last_row(tbcol), stddev(tbcol) from stb where tbcol > 5 and tbcol < 20 group by tgcol

S
Shengliang Guan 已提交
142 143 144 145 146 147 148
_OVER:
system sh/exec.sh -n dnode1 -s stop -x SIGINT
print =============== check
$null=

system_content sh/checkValgrind.sh -n dnode1 
print cmd return result ----> [ $system_content ]
149
if $system_content > 0 then
S
Shengliang Guan 已提交
150 151 152 153 154 155
  return -1
endi 

if $system_content == $null then
  return -1
endi