193 lines
6.6 KiB
Plaintext
193 lines
6.6 KiB
Plaintext
system sh/stop_dnodes.sh
|
|
system sh/deploy.sh -n dnode1 -i 1
|
|
system sh/exec.sh -n dnode1 -s start
|
|
sql connect
|
|
|
|
print =============== failed to create anode on '127.0.0.1:1101'
|
|
sql_error create anode '127.0.0.1:1101'
|
|
|
|
sql show anodes
|
|
if $rows != 0 then
|
|
return -1
|
|
endi
|
|
|
|
sql_error drop anode 1
|
|
|
|
print ================ create anode
|
|
sql create anode '192.168.1.116:6050'
|
|
|
|
sql show anodes
|
|
if $rows != 1 then
|
|
return -1
|
|
endi
|
|
|
|
print =============== show info
|
|
sql show anodes full
|
|
if $rows != 10 then
|
|
print expect 10 , actual $rows
|
|
return -1
|
|
endi
|
|
|
|
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, c1 int, c2 float, c3 double, c4 tinyint, c5 bigint, c6 varchar(12)) tags (t1 int unsigned)
|
|
|
|
sql show stables
|
|
if $rows != 1 then
|
|
return -1
|
|
endi
|
|
|
|
print =============== create child table
|
|
sql create table ct1 using stb tags(1000)
|
|
|
|
print ==================== insert data
|
|
# input_list = [5, 14, 15, 15, 14, 19, 17, 16, 20, 22, 8, 21, 28, 11, 9, 29, 40]
|
|
sql insert into ct1(ts, c1, c2, c3, c4, c5, c6) values(now-1a, 5, 5, 5, 5, 5, 'a')(now+1a, 14, 14, 14, 14, 14, 'a')(now+2a, 15, 15, 15, 15, 15, 'a')
|
|
sql insert into ct1 values(now+3a, 15, 15, 15, 15, 15, 'a')(now+4a, 14, 14, 14, 14, 14, 'a')(now+5a, 19, 19, 19, 19, 19, 'a')(now+6a, 17, 17, 17, 17, 17, 'a')
|
|
sql insert into ct1 values(now+7a, 16, 16, 16, 16, 16, 'a')(now+8a, 20, 20, 20, 20, 20, 'a')(now+9a, 22, 22, 22, 22, 22, 'a')
|
|
sql insert into ct1 values(now+10a, 8, 8, 8, 8, 8, 'a')(now+11a, 21, 21, 21, 21, 21, 'a')(now+12a, 28, 28, 28, 28, 28, 'a')(now+13a, 11, 11, 11, 11, 11, 'a')(now+14a, 9, 9, 9, 9, 9, 'a')
|
|
sql insert into ct1 values(now+15a, 29, 29, 29, 29, 29, 'a')(now+16a, 40, 40, 40, 40, 40, 'a')
|
|
|
|
sql select count(*) from ct1
|
|
if $data00 != 17 then
|
|
print expect 17 , actual $data00
|
|
return -1
|
|
endi
|
|
|
|
sql select count(*) from ct1 anomaly_window(c1, 'algo=iqr')
|
|
if $data00 != 1 then
|
|
return -1
|
|
endi
|
|
|
|
print ================= too many rows error
|
|
sql_error select forecast(c6, 'algo=holtwinters, rows=1025') from ct1;
|
|
|
|
print ================= try every loaded anomaly detection algorithm
|
|
sql select count(*) from ct1 anomaly_window(c1, 'algo=iqr');
|
|
sql select count(*) from ct1 anomaly_window(c1, 'algo=ksigma');
|
|
sql select count(*) from ct1 anomaly_window(c1, 'algo=lof');
|
|
sql select count(*) from ct1 anomaly_window(c1, 'algo=shesd');
|
|
sql select count(*) from ct1 anomaly_window(c1, 'algo=grubbs');
|
|
|
|
print ================= try every column type of column
|
|
sql select count(*) from ct1 anomaly_window(c1, 'algo=ksigma,k=2');
|
|
sql select count(*) from ct1 anomaly_window(c2, 'algo=ksigma,k=2');
|
|
sql select count(*) from ct1 anomaly_window(c3, 'algo=ksigma,k=2');
|
|
sql select count(*) from ct1 anomaly_window(c4, 'algo=ksigma,k=2');
|
|
sql select count(*) from ct1 anomaly_window(c5, 'algo=ksigma,k=2');
|
|
|
|
print =================== invalid column type
|
|
sql_error select count(*) from ct1 anomaly_window(c6, 'algo=ksigma,k=2');
|
|
sql_error select forecast(c6, 'algo=holtwinters,conf=0.5,wncheck=1,period=0') from ct1
|
|
|
|
|
|
print ==================== invalid timeout parameter, will reset the parameters.
|
|
sql select forecast(c1, 'algo=holtwinters, timeout=6000') from ct1;
|
|
sql select forecast(c1, 'algo=holtwinters, timeout=0') from ct1;
|
|
|
|
print =========================== valid timeout
|
|
sql select forecast(c1, 'algo=holtwinters, timeout=120') from ct1;
|
|
|
|
|
|
sql_error select _frowts, _flow, _fhigh, forecast(c1, 'algo=holtwinters,conf=0.5,wncheck=1,period=0') from ct1
|
|
sql_error select _frowts, _flow, _fhigh, forecast(c1, 'algo=holtwinters,conf=119,wncheck=1,period=0') from ct1
|
|
sql_error select _frowts, _flow, _fhigh, forecast(c1, 'algo=holtwinters1,conf=0.5,wncheck=1,period=0') from ct1
|
|
sql_error select forecast(c1, 'conf=50 ,algo = arima, rows=0') from ct1
|
|
sql_error select forecast(c1, 'conf=50 ,algo = arima, rows=-10') from ct1
|
|
sql_error select forecast(c1, 'conf=50 ,algo = arima, every=0') from ct1
|
|
|
|
sql select _frowts, _flow, _fhigh, forecast(c1, 'algo=holtwinters, conf=50 ') from ct1
|
|
sql select _frowts, _flow, _fhigh, forecast(c1, ' algo=holtwinters , conf=50 ') from ct1
|
|
sql select _frowts, _flow, _fhigh, forecast(c1, ' algo = holtwinters , conf = 50 ') from ct1
|
|
sql select _frowts, _flow, _fhigh, forecast(c1, 'conf=50 ,algo = holtwinters, ') from ct1
|
|
sql select _frowts, _flow, _fhigh, forecast(c1, 'conf=50 ,algo = holtwinters, ,') from ct1
|
|
sql select _frowts, _flow, _fhigh, forecast(c1, 'conf=50 ,algo = holtwinters, , ,') from ct1
|
|
sql select _frowts, _flow, _fhigh, forecast(c1, 'conf=50 ,algo = holtwinters, a =') from ct1
|
|
sql select _frowts, _flow, _fhigh, forecast(c1, 'conf=50 ,algo = holtwinters, = a ,') from ct1
|
|
|
|
print =================== valid column type
|
|
sql select forecast(c1, 'conf=50 ,algo = arima') from ct1
|
|
sql select forecast(c1, 'conf=50 ,algo = arima, rows=1') from ct1
|
|
sql select forecast(c2, 'conf=50 ,algo = arima, rows=1') from ct1
|
|
sql select forecast(c3, 'conf=50 ,algo = arima, rows=1') from ct1
|
|
sql select forecast(c4, 'conf=50 ,algo = arima, rows=1') from ct1
|
|
sql select forecast(c5, 'conf=50 ,algo = arima, rows=1') from ct1
|
|
sql select forecast(c5, 'conf=50 ,algo = arima, rows=1') from ct1
|
|
|
|
sql select _frowts, _flow, _fhigh, forecast(c1, 'algo=holtwinters,conf=50,wncheck=1,period=0,start=1700000000000,every=2') from ct1
|
|
if $rows != 10 then
|
|
return -1
|
|
endi
|
|
|
|
if $data03 != 28 then
|
|
return -1
|
|
endi
|
|
|
|
if $data00 != @23-11-15 06:13:20.000@ then
|
|
print expect 23-11-15 06:13:20.000 , actual $data00
|
|
return -1
|
|
endi
|
|
|
|
if $data10 != @23-11-15 06:13:20.002@ then
|
|
print expect 23-11-15 06:13:20.002 , actual $data10
|
|
return -1
|
|
endi
|
|
|
|
if $data20 != @23-11-15 06:13:20.004@ then
|
|
return -1
|
|
endi
|
|
|
|
print test the every option and rows option
|
|
|
|
sql select _frowts, _flow, _fhigh, forecast(c1, 'algo=holtwinters,conf=50,wncheck=1,period=0,start=1700000000000,every=100,rows=5') from ct1
|
|
if $rows != 5 then
|
|
return -1
|
|
endi
|
|
|
|
if $data00 != @23-11-15 06:13:20.000@ then
|
|
return -1
|
|
endi
|
|
|
|
if $data10 != @23-11-15 06:13:20.100@ then
|
|
return -1
|
|
endi
|
|
|
|
sql drop anode 1
|
|
sql show anodes
|
|
|
|
if $rows != 0 then
|
|
return -1
|
|
endi
|
|
|
|
sleep 1000
|
|
|
|
print ===================== query without anodes
|
|
sql_error select forecast(c5, 'conf=50 ,algo = arima, rows=1') from ct1
|
|
sql_error select count(*) from ct1 anomaly_window(c1, 'algo=iqr');
|
|
|
|
|
|
_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
|