basic0.sim 3.1 KB
Newer Older
L
Liu Jicong 已提交
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 -v
L
Liu Jicong 已提交
5 6 7 8
sql connect

print =============== create database
sql create database d0 vgroups 1
X
Xiaoyu Wang 已提交
9
sql select * from information_schema.ins_databases
L
Liu Jicong 已提交
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
if $rows != 3 then
  return -1
endi

print $data00 $data01 $data02

sql use d0

print =============== create super table, include column type for count/sum/min/max/first
sql create table if not exists stb (ts timestamp, k int) tags (a int)

sql show stables
if $rows != 1 then 
  return -1
endi

print =============== create child table
sql create table ct1 using stb tags(1000)
sql create table ct2 using stb tags(2000)
sql create table ct3 using stb tags(3000)

sql show tables
if $rows != 3 then 
  return -1
endi

36
sql create stream s1 trigger at_once into outstb as select _wstart, min(k), max(k), sum(k) as sum_alias from ct1 interval(10m)
L
Liu Jicong 已提交
37 38 39 40 41 42 43 44

sql show stables
if $rows != 2 then 
  return -1
endi

print =============== insert data

L
Liu Jicong 已提交
45
sql insert into ct1 values('2022-05-08 03:42:00.000', 234)
L
Liu Jicong 已提交
46 47 48 49
sleep 100

#===================================================================
print =============== query data from child table
L
Liu Jicong 已提交
50

51
sql select `_wstart`,`min(k)`,`max(k)`,sum_alias from outstb
L
Liu Jicong 已提交
52 53 54 55 56 57 58 59 60 61 62 63 64 65
print rows: $rows 
print $data00  $data01 $data02 $data03
if $rows != 1 then
  return -1
endi

if $data01 != 234 then 
  return -1
endi

if $data02 != 234 then 
  return -1
endi

66 67
if $data03 != 234 then
  print expect 234, actual $data03
L
Liu Jicong 已提交
68 69 70
  return -1
endi

L
Liu Jicong 已提交
71 72 73 74 75 76 77 78 79
#===================================================================
print =============== insert data

sql insert into ct1 values('2022-05-08 03:43:00.000', -111)
sleep 100

#===================================================================
print =============== query data from child table

80
sql select `_wstart`,`min(k)`,`max(k)`,sum_alias from outstb
L
Liu Jicong 已提交
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
print rows: $rows 
print $data00  $data01 $data02 $data03
if $rows != 1 then
  return -1
endi

if $data01 != -111 then 
  return -1
endi

if $data02 != 234 then 
  return -1
endi

if $data03 != 123 then 
  return -1
endi

#===================================================================
print =============== insert data

sql insert into ct1 values('2022-05-08 03:53:00.000', 789)
sleep 100

#===================================================================
print =============== query data from child table

108
sql select `_wstart`,`min(k)`,`max(k)`,sum_alias from outstb
L
Liu Jicong 已提交
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
print rows: $rows 
print $data00  $data01 $data02 $data03
print $data10  $data11 $data12 $data13
if $rows != 2 then
  return -1
endi

if $data01 != -111 then 
  return -1
endi

if $data02 != 234 then 
  return -1
endi

if $data03 != 123 then 
  return -1
endi

if $data11 != 789 then 
  return -1
endi

if $data12 != 789 then 
  return -1
endi

if $data13 != 789 then 
  return -1
endi

S
Shengliang Guan 已提交
140
_OVER:
L
Liu Jicong 已提交
141
system sh/exec.sh -n dnode1 -s stop -x SIGINT
S
Shengliang Guan 已提交
142 143 144 145 146 147 148 149 150 151 152 153
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