192 lines
		
	
	
		
			3.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
			
		
		
	
	
			192 lines
		
	
	
		
			3.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
| system sh/stop_dnodes.sh
 | |
| system sh/deploy.sh -n dnode1 -i 1
 | |
| system sh/cfg.sh -n dnode1 -c qDebugflag -v 143 
 | |
| system sh/exec.sh -n dnode1 -s start
 | |
| sql connect
 | |
| 
 | |
| print =============== create database
 | |
| sql create database d0 vgroups 1
 | |
| sql select * from information_schema.ins_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
 | |
| 
 | |
| sleep 1000
 | |
| 
 | |
| 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)
 | |
| 
 | |
| run tsim/stream/checkTaskStatus.sim
 | |
| 
 | |
| sql show stables
 | |
| if $rows != 2 then 
 | |
|   return -1
 | |
| endi
 | |
| 
 | |
| print =============== insert data
 | |
| 
 | |
| sql insert into ct1 values('2022-05-08 03:42:00.000', 234)
 | |
| sleep 100
 | |
| 
 | |
| #===================================================================
 | |
| print =============== query data from child table
 | |
| 
 | |
| $loop_count = 0
 | |
| 
 | |
| loop0:
 | |
| sleep 1000
 | |
| 
 | |
| $loop_count = $loop_count + 1
 | |
| if $loop_count == 20 then
 | |
|   return -1
 | |
| endi
 | |
| 
 | |
| sql select `_wstart`,`min(k)`,`max(k)`,sum_alias from outstb
 | |
| 
 | |
| print rows: $rows 
 | |
| print $data00  $data01 $data02 $data03
 | |
| if $rows != 1 then
 | |
|   goto loop0
 | |
| endi
 | |
| 
 | |
| if $data01 != 234 then 
 | |
|   goto loop0
 | |
| endi
 | |
| 
 | |
| if $data02 != 234 then 
 | |
|   goto loop0
 | |
| endi
 | |
| 
 | |
| if $data03 != 234 then
 | |
|   print expect 234, actual $data03
 | |
|   goto loop0
 | |
| endi
 | |
| 
 | |
| #===================================================================
 | |
| print =============== insert data
 | |
| 
 | |
| sql insert into ct1 values('2022-05-08 03:43:00.000', -111)
 | |
| sleep 100
 | |
| 
 | |
| #===================================================================
 | |
| print =============== query data from child table
 | |
| 
 | |
| $loop_count = 0
 | |
| 
 | |
| loop1:
 | |
| sleep 1000
 | |
| 
 | |
| $loop_count = $loop_count + 1
 | |
| if $loop_count == 20 then
 | |
|   return -1
 | |
| endi
 | |
| 
 | |
| sql select `_wstart`,`min(k)`,`max(k)`,sum_alias from outstb
 | |
| 
 | |
| print rows: $rows 
 | |
| print $data00  $data01 $data02 $data03
 | |
| if $rows != 1 then
 | |
|   goto loop1
 | |
| endi
 | |
| 
 | |
| if $data01 != -111 then 
 | |
|   goto loop1
 | |
| endi
 | |
| 
 | |
| if $data02 != 234 then 
 | |
|   goto loop1
 | |
| endi
 | |
| 
 | |
| if $data03 != 123 then 
 | |
|   goto loop1
 | |
| 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
 | |
| 
 | |
| $loop_count = 0
 | |
| 
 | |
| loop2:
 | |
| sleep 1000
 | |
| 
 | |
| $loop_count = $loop_count + 1
 | |
| if $loop_count == 20 then
 | |
|   return -1
 | |
| endi
 | |
| 
 | |
| sql select `_wstart`,`min(k)`,`max(k)`,sum_alias from outstb
 | |
| print rows: $rows 
 | |
| print $data00  $data01 $data02 $data03
 | |
| print $data10  $data11 $data12 $data13
 | |
| if $rows != 2 then
 | |
|   goto loop2
 | |
| endi
 | |
| 
 | |
| if $data01 != -111 then 
 | |
|   goto loop2
 | |
| endi
 | |
| 
 | |
| if $data02 != 234 then 
 | |
|   goto loop2
 | |
| endi
 | |
| 
 | |
| if $data03 != 123 then 
 | |
|   goto loop2
 | |
| endi
 | |
| 
 | |
| if $data11 != 789 then 
 | |
|   goto loop2
 | |
| endi
 | |
| 
 | |
| if $data12 != 789 then 
 | |
|   goto loop2
 | |
| endi
 | |
| 
 | |
| if $data13 != 789 then 
 | |
|   goto loop2
 | |
| endi
 | |
| 
 | |
| sql drop stream s1
 | |
| 
 | |
| _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 ]
 | |
| if $system_content > 0 then
 | |
|   return -1
 | |
| endi 
 | |
| 
 | |
| if $system_content == $null then
 | |
|   return -1
 | |
| endi 
 |