test(stream): add stream case
This commit is contained in:
parent
d17b478e96
commit
b78918c72a
|
@ -65,6 +65,9 @@
|
|||
./test.sh -f tsim/tmq/basic3.sim
|
||||
./test.sh -f tsim/tmq/basic4.sim
|
||||
|
||||
# ---- tstream
|
||||
./test.sh -f tstream/basic0.sim
|
||||
|
||||
# --- stable
|
||||
./test.sh -f tsim/stable/disk.sim
|
||||
./test.sh -f tsim/stable/dnode3.sim
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
system sh/stop_dnodes.sh
|
||||
system sh/deploy.sh -n dnode1 -i 1
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
sleep 50
|
||||
sql connect
|
||||
|
||||
print =============== create database
|
||||
sql create database d0 vgroups 1
|
||||
sql show databases
|
||||
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
|
||||
|
||||
sql create stream s1 into outstb as select _wstartts, min(k), max(k), sum(k) from ct1 interval(10m)
|
||||
|
||||
sql show stables
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== insert data
|
||||
|
||||
sql insert into ct1 values(now+0s, 234)
|
||||
|
||||
sleep 100
|
||||
|
||||
#===================================================================
|
||||
#===================================================================
|
||||
print =============== query data from child table
|
||||
sql select `_wstartts`,`min(k)`,`max(k)`,`sum(k)` from outstb
|
||||
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
|
||||
|
||||
if $data03 != 234 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
Loading…
Reference in New Issue