basic3.sim 4.6 KB
Newer Older
5
54liuyao 已提交
1 2
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
5
54liuyao 已提交
3 4
system sh/cfg.sh -n dnode1 -c debugflag -v 131
system sh/cfg.sh -n dnode1 -c keepColumnName -v 1
5
54liuyao 已提交
5
system sh/exec.sh -n dnode1 -s start
5
54liuyao 已提交
6 7 8 9 10 11 12

sleep 5000

sql connect

print ========== interval\session\state window

5
54liuyao 已提交
13
sql CREATE DATABASE test1 VGROUPS 2;
5
54liuyao 已提交
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
sql use test1;
sql CREATE STABLE st (time TIMESTAMP, ca DOUBLE, cb DOUBLE, cc int) TAGS (ta VARCHAR(10) );

print ========== create table before stream

sql CREATE TABLE t1 using st TAGS ('aaa');
sql CREATE TABLE t2 using st TAGS ('bbb');
sql CREATE TABLE t3 using st TAGS ('ccc');
sql CREATE TABLE t4 using st TAGS ('ddd');

sql create stream streamd1 into streamt1 as select ca, _wstart,_wend, count(*) from st where time > "2022-01-01 00:00:00" and time < "2032-01-01 00:00:00" partition by ca interval(60m) fill(linear);
sql create stream streamd2 into streamt2 as select tbname, _wstart,_wend, count(*) from st where time > "2022-01-01 00:00:00" and time < "2032-01-01 00:00:00" partition by tbname interval(60m) fill(linear);

sql create stream streamd3 into streamt3 as select ca, _wstart,_wend, count(*), max(ca), min(cb), APERCENTILE(cc, 20) from st where time > "2022-01-01 00:00:00" and time < "2032-01-01 00:00:00" partition by ca session(time, 60m);
sql create stream streamd4 into streamt4 as select tbname, _wstart,_wend, count(*), max(ca), min(cb), APERCENTILE(cc, 20) from st where time > "2022-01-01 00:00:00" and time < "2032-01-01 00:00:00" partition by tbname session(time, 60m);

sql create stream streamd5 into streamt5 as select tbname, _wstart,_wend, count(*), max(ca), min(cb) from st where time > "2022-01-01 00:00:00" and time < "2032-01-01 00:00:00" partition by tbname state_window(cc);
sql create stream streamd6 into streamt6 as select ca, _wstart,_wend, count(*), max(ca), min(cb) from t1 where time > "2022-01-01 00:00:00" and time < "2032-01-01 00:00:00" partition by ca state_window(cc);

5
54liuyao 已提交
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83

sql alter local 'keepColumnName' '1'

sql CREATE STABLE `meters_test_data` (`ts` TIMESTAMP, `close` FLOAT, `parttime` TIMESTAMP, `parttime_str` VARCHAR(32)) TAGS (`id` VARCHAR(32));

sql_error create stream realtime_meters fill_history 1 into realtime_meters as select last(parttime),first(close),last(close) from meters_test_data partition by tbname state_window(parttime_str);
sql_error create stream streamd7 into streamt7 as select  _wstart, _wend, count(*), first(ca), last(ca) from t1 interval(10s);
sql_error create stream streamd71 into streamt71 as select _wstart, _wend, count(*) as ca, first(ca), last(ca) as c2 from t1 interval(10s);

sql create stream streamd8 into streamt8 as select _wstart, _wend, count(*), first(ca) as c1, last(ca) as c2 from t1 interval(10s);
sql desc streamt8;

if $rows == 0 then
  return -1
endi

sql create stream streamd9 into streamt9 as select  _wstart, _wend, count(*), first(ca) as c1, last(ca) from t1 interval(10s);
sql desc streamt9;

if $rows == 0 then
  return -1
endi

sql_error create stream streamd11 into streamd11 as select _wstart, _wend, count(*), last(ca), last(ca) from t1 interval(10s);

sql alter local 'keepColumnName' '0'

sql create stream realtime_meters fill_history 1 into realtime_meters as select last(parttime),first(close),last(close) from meters_test_data partition by tbname state_window(parttime_str);

sql desc realtime_meters;

if $rows == 0 then
  return -1
endi

sql create stream streamd7 into streamt7 as select  _wstart, _wend, count(*), first(ca), last(ca) from t1 interval(10s);

sql desc streamt7;

if $rows == 0 then
  return -1
endi

sql create stream streamd71 into streamt71 as select _wstart, _wend, count(*) as ca, first(ca), last(ca) as c2 from t1 interval(10s);

sql desc streamt71;

if $rows == 0 then
  return -1
endi

5
54liuyao 已提交
84 85 86 87 88 89 90 91 92
sleep 3000

sql drop stream if exists streamd1;
sql drop stream if exists streamd2;
sql drop stream if exists streamd3;
sql drop stream if exists streamd4;
sql drop stream if exists streamd5;
sql drop stream if exists streamd6;

5
54liuyao 已提交
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
sql create stream streamd10 into streamd10 as select _wstart, _wend, count(*), first(ca), last(cb) as c2 from t1 interval(10s);

sql desc streamd10;

if $rows == 0 then
  return -1
endi

sql_error create stream streamd11 into streamd11 as select _wstart, _wend, count(*), last(ca), last(ca) from t1 interval(10s);


sql create stream streamd12 into streamd12 as select _wstart, _wend, count(*), last(ca), last(cb) as c2 from t1 interval(10s);

sql desc streamd12;

if $rows == 0 then
  return -1
endi

5
54liuyao 已提交
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126

_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