system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c walLevel -v 1 system sh/exec.sh -n dnode1 -s start sleep 100 sql connect print ======================== dnode1 start $dbPrefix = nest_db $tbPrefix = nest_tb $mtPrefix = nest_mt $tbNum = 10 $rowNum = 10000 $totalNum = $tbNum * $rowNum print =============== nestquery.sim $i = 0 $db = $dbPrefix . $i $mt = $mtPrefix . $i sql drop database if exists $db sql create database if not exists $db sql use $db sql create table $mt (ts timestamp, c1 int, c2 float, c3 bigint, c4 smallint, c5 tinyint, c6 double, c7 bool, c8 binary(10), c9 nchar(9)) TAGS(t1 int) $half = $tbNum / 2 $i = 0 while $i < $half $tb = $tbPrefix . $i $nextSuffix = $i + $half $tb1 = $tbPrefix . $nextSuffix sql create table $tb using $mt tags( $i ) sql create table $tb1 using $mt tags( $nextSuffix ) $x = 0 while $x < $rowNum $y = $x * 60000 $ms = 1600099200000 + $y $c = $x / 100 $c = $c * 100 $c = $x - $c $binary = 'binary . $c $binary = $binary . ' $nchar = 'nchar . $c $nchar = $nchar . ' sql insert into $tb values ($ms , $c , $c , $c , $c , $c , $c , $c , $binary , $nchar ) $tb1 values ($ms , $c , $c , $c , $c , $c , $c , $c , $binary , $nchar ) $x = $x + 1 endw $i = $i + 1 endw sleep 100 $i = 1 $tb = $tbPrefix . $i print ==============> simple nest query test sql select count(*) from (select count(*) from nest_mt0) if $rows != 1 then return -1 endi if $data00 != 1 then return -1 endi sql select count(*) from (select count(*) from nest_mt0 group by tbname) if $rows != 1 then return -1 endi if $data00 != 10 then return -1 endi sql select count(*) from (select count(*) from nest_mt0 interval(10h) group by tbname) if $rows != 1 then return -1 endi if $data00 != 170 then return -1 endi sql select sum(a) from (select count(*) a from nest_mt0 interval(10h) group by tbname) if $rows != 1 then return -1 endi if $data00 != 100000 then return -1 endi print =================> alias name test sql select ts from (select count(*) a from nest_tb0 interval(1h)) if $rows != 167 then return -1 endi if $data00 != @20-09-15 00:00:00.000@ then return -1 endi sql select count(a) from (select count(*) a from nest_tb0 interval(1h)) if $rows != 1 then return -1 endi if $data00 != 167 then return -1 endi print ================>master query + filter sql select t.* from (select count(*) a from nest_tb0 interval(10h)) t where t.a <= 520; if $rows != 2 then return -1 endi sql select * from (select count(*) a, tbname f1 from nest_mt0 group by tbname) t where t.a<0 and f1 = 'nest_tb0'; if $rows != 0 then return -1 endi sql select * from (select count(*) a, tbname f1 from nest_mt0 group by tbname) t where t.a>0 and f1 = 'nest_tb0'; if $rows != 1 then return -1 endi if $data00 != 10000 then return -1 endi if $data01 != @nest_tb0@ then return -1 endi if $data02 != @nest_tb0@ then return -1 endi print ===================> nest query interval sql_error select ts, avg(c1) from (select ts, c1 from nest_tb0); sql select avg(c1) from (select * from nest_tb0) interval(3d) if $rows != 3 then return -1 endi if $data00 != @20-09-14 00:00:00.000@ then return -1 endi if $data01 != 49.222222222 then return -1 endi if $data10 != @20-09-17 00:00:00.000@ then print expect 20-09-17 00:00:00.000, actual: $data10 return -1 endi if $data11 != 49.685185185 then return -1 endi if $data20 != @20-09-20 00:00:00.000@ then return -1 endi if $data21 != 49.500000000 then return -1 endi sql_error select stddev(c1) from (select c1 from nest_tb0); sql_error select percentile(c1, 20) from (select * from nest_tb0); #sql_error select interp(c1) from (select * from nest_tb0); sql_error select derivative(val, 1s, 0) from (select c1 val from nest_tb0); sql_error select twa(c1) from (select c1 from nest_tb0); sql_error select irate(c1) from (select c1 from nest_tb0); sql_error select diff(c1), twa(c1) from (select * from nest_tb0); sql_error select mavg(c1,2), twa(c1) from (select * from nest_tb0); sql_error select csum(c1), twa(c1) from (select * from nest_tb0); sql_error select irate(c1), interp(c1), twa(c1) from (select * from nest_tb0); sql select apercentile(c1, 50) from (select * from nest_tb0) interval(1d) if $rows != 7 then return -1 endi if $data00 != @20-09-15 00:00:00.000@ then return -1 endi if $data01 != 47.571428571 then return -1 endi if $data10 != @20-09-16 00:00:00.000@ then return -1 endi if $data11 != 49.666666667 then return -1 endi if $data20 != @20-09-17 00:00:00.000@ then return -1 endi if $data21 != 49.000000000 then return -1 endi if $data30 != @20-09-18 00:00:00.000@ then return -1 endi if $data31 != 48.333333333 then return -1 endi sql select twa(c1) from (select * from nest_tb0); if $rows != 1 then return -1 endi if $data00 != 49.500000000 then return -1 endi sql select leastsquares(c1, 1, 1) from (select * from nest_tb0); if $rows != 1 then return -1 endi if $data00 != @{slop:0.000100, intercept:49.000000}@ then return -1 endi sql select irate(c1) from (select * from nest_tb0); if $data00 != 0.016666667 then return -1 endi sql select derivative(c1, 1s, 0) from (select * from nest_tb0); if $rows != 9999 then return -1 endi if $data00 != @20-09-15 00:01:00.000@ then return -1 endi if $data01 != 0.016666667 then return -1 endi if $data10 != @20-09-15 00:02:00.000@ then return -1 endi if $data11 != 0.016666667 then return -1 endi sql select diff(c1) from (select * from nest_tb0); if $rows != 9999 then return -1 endi sql select mavg(c1,2) from (select * from nest_tb0); if $rows != 9999 then return -1 endi sql select csum(c1) from (select * from nest_tb0); if $rows != 10000 then return -1 endi sql select avg(c1),sum(c2), max(c3), min(c4), count(*), first(c7), last(c7),spread(c6) from (select * from nest_tb0) interval(1d); if $rows != 7 then return -1 endi if $data00 != @20-09-15 00:00:00.000@ then return -1 endi if $data01 != 48.666666667 then print expect 48.666666667, actual: $data01 return -1 endi if $data02 != 70080.000000000 then return -1 endi if $data03 != 99 then return -1 endi if $data04 != 0 then return -1 endi if $data05 != 1440 then return -1 endi if $data06 != 0 then print $data06 return -1 endi if $data07 != 1 then return -1 endi if $data08 != 99.000000000 then print expect 99.000000000, actual: $data08 return -1 endi if $data10 != @20-09-16 00:00:00.000@ then return -1 endi if $data11 != 49.777777778 then return -1 endi if $data12 != 71680.000000000 then return -1 endi sql select sample(x, 20) from (select c1 x from nest_tb0); sql select top(x, 20) from (select c1 x from nest_tb0); sql select bottom(x, 20) from (select c1 x from nest_tb0) print ===================> group by + having print =========================> ascending order/descending order print =========================> nest query join sql select a.ts,a.k,b.ts from (select count(*) k from nest_tb0 interval(30a)) a, (select count(*) f from nest_tb1 interval(30a)) b where a.ts = b.ts ; if $rows != 10000 then return -1 endi if $data00 != @20-09-15 00:00:00.000@ then return -1 endi if $data01 != 1 then return -1 endi if $data02 != @20-09-15 00:00:00.000@ then return -1 endi if $data10 != @20-09-15 00:01:00.000@ then return -1 endi if $data11 != 1 then return -1 endi if $data12 != @20-09-15 00:01:00.000@ then return -1 endi sql select sum(a.k), sum(b.f) from (select count(*) k from nest_tb0 interval(30a)) a, (select count(*) f from nest_tb1 interval(30a)) b where a.ts = b.ts ; if $rows != 1 then return -1 endi if $data00 != 10000 then return -1 endi if $data01 != 10000 then return -1 endi sql select a.ts,a.k,b.ts,c.ts,c.ts,c.x from (select count(*) k from nest_tb0 interval(30a)) a, (select count(*) f from nest_tb1 interval(30a)) b, (select count(*) x from nest_tb2 interval(30a)) c where a.ts = b.ts and a.ts = c.ts if $rows != 10000 then return -1 endi if $data00 != @20-09-15 00:00:00.000@ then return -1 endi if $data01 != 1 then return -1 endi if $data02 != @20-09-15 00:00:00.000@ then return -1 endi if $data03 != @20-09-15 00:00:00.000@ then return -1 endi sql_error select diff(val) from (select c1 val from nest_tb0); sql select diff(val) from (select ts,c1 val from nest_tb0); if $rows != 9999 then return -1 endi if $data00 != @20-09-15 00:01:00.000@ then return -1 endi if $data01 != 1 then return -1 endi sql select mavg(val, 2) from (select c1 val from nest_tb0); if $rows != 9999 then return -1 endi if $data00 != @70-01-01 08:00:00.000@ then return -1 endi if $data01 != 0.500000000 then return -1 endi sql select csum(val) from (select c1 val from nest_tb0); if $rows != 10000 then return -1 endi if $data00 != @70-01-01 08:00:00.000@ then return -1 endi if $data01 != 0 then return -1 endi if $data41 != 10 then return -1 endi sql_error select last_row(*) from (select * from nest_tb0) having c1 > 0 print ===========>td-4805 sql_error select tbname, i from (select * from nest_tb0) group by i; sql select count(*),c1 from (select * from nest_tb0) where c1 < 2 group by c1; if $rows != 2 then return -1 endi if $data00 != 100 then return -1 endi if $data01 != 0 then return -1 endi if $data10 != 100 then return -1 endi if $data11 != 1 then return -1 endi print =====================>TD-5157 sql select twa(c1) from nest_tb1 interval(19a); if $rows != 10000 then return -1 endi if $data00 != @20-09-14 23:59:59.992@ then return -1 endi if $data01 != 0.000083333 then return -1 endi print ======================>TD-5271 sql select min(val),max(val),first(val),last(val),count(val),sum(val),avg(val) from (select count(*) val from nest_mt0 group by tbname) if $rows != 1 then return -1 endi if $data00 != 10000 then return -1 endi if $data01 != 10000 then return -1 endi if $data04 != 10 then return -1 endi if $data05 != 100000 then return -1 endi print =================>us database interval query, TD-5039 sql create database test precision 'us'; sql use test; sql create table t1(ts timestamp, k int); sql insert into t1 values('2020-01-01 01:01:01.000', 1) ('2020-01-01 01:02:00.000', 2); sql select avg(k) from (select avg(k) k from t1 interval(1s)) interval(1m); if $rows != 2 then return -1 endi if $data00 != @20-01-01 01:01:00.000000@ then return -1 endi if $data01 != 1.000000000 then return -1 endi if $data10 != @20-01-01 01:02:00.000000@ then return -1 endi if $data11 != 2.000000000 then return -1 endi sql create database test2; sql use test2; sql create table meters (ts TIMESTAMP,a INT,b INT) TAGS (area INT); sql CREATE TABLE t0 USING meters TAGS (0); sql CREATE TABLE t1 USING meters TAGS (1); sql CREATE TABLE t2 USING meters TAGS (1); sql CREATE TABLE t3 USING meters TAGS (0); sql insert into t0 values ('2021-09-30 15:00:00.00',0,0); sql insert into t0 values ('2021-09-30 15:00:01.00',1,1); sql insert into t0 values ('2021-09-30 15:00:03.00',3,3); sql insert into t0 values ('2021-09-30 15:00:05.00',5,5); sql insert into t0 values ('2021-09-30 15:00:07.00',7,7); sql insert into t0 values ('2021-09-30 15:00:09.00',9,9); sql insert into t1 values ('2021-09-30 15:00:00.00',0,0); sql insert into t1 values ('2021-09-30 15:00:02.00',2,2); sql insert into t1 values ('2021-09-30 15:00:04.00',4,4); sql insert into t1 values ('2021-09-30 15:00:06.00',6,6); sql insert into t1 values ('2021-09-30 15:00:08.00',8,8); sql insert into t1 values ('2021-09-30 15:00:10.00',10,10); sql insert into t2 values ('2021-09-30 15:00:00.00',0,0); sql insert into t2 values ('2021-09-30 15:00:01.00',11,11); sql insert into t2 values ('2021-09-30 15:00:02.00',22,22); sql insert into t2 values ('2021-09-30 15:00:03.00',33,33); sql insert into t2 values ('2021-09-30 15:00:04.00',44,44); sql insert into t2 values ('2021-09-30 15:00:05.00',55,55); sql insert into t3 values ('2021-09-30 15:00:00.00',0,0); sql insert into t3 values ('2021-09-30 15:00:01.00',11,11); sql insert into t3 values ('2021-09-30 15:00:02.00',22,22); sql insert into t3 values ('2021-09-30 15:00:03.00',33,33); sql insert into t3 values ('2021-09-30 15:00:04.00',44,44); sql insert into t3 values ('2021-09-30 15:00:05.00',55,55); sql select count(*) from meters interval(1s) group by tbname; if $rows != 24 then return -1 endi sql select count(*) from (select count(*) from meters interval(1s) group by tbname) interval(1s); if $rows != 11 then return -1 endi if $data00 != @21-09-30 15:00:00.000@ then return -1 endi if $data01 != 4 then return -1 endi if $data10 != @21-09-30 15:00:01.000@ then return -1 endi if $data11 != 3 then return -1 endi if $data20 != @21-09-30 15:00:02.000@ then return -1 endi if $data21 != 3 then return -1 endi if $data30 != @21-09-30 15:00:03.000@ then return -1 endi if $data31 != 3 then return -1 endi if $data40 != @21-09-30 15:00:04.000@ then return -1 endi if $data41 != 3 then return -1 endi if $data50 != @21-09-30 15:00:05.000@ then return -1 endi if $data51 != 3 then return -1 endi if $data60 != @21-09-30 15:00:06.000@ then return -1 endi if $data61 != 1 then return -1 endi if $data70 != @21-09-30 15:00:07.000@ then return -1 endi if $data71 != 1 then return -1 endi if $data80 != @21-09-30 15:00:08.000@ then return -1 endi if $data81 != 1 then return -1 endi if $data90 != @21-09-30 15:00:09.000@ then return -1 endi if $data91 != 1 then return -1 endi sql select count(*) from (select count(*) from meters interval(1s) group by area) interval(1s); if $rows != 11 then return -1 endi if $data00 != @21-09-30 15:00:00.000@ then return -1 endi if $data01 != 2 then return -1 endi if $data10 != @21-09-30 15:00:01.000@ then return -1 endi if $data11 != 2 then return -1 endi if $data20 != @21-09-30 15:00:02.000@ then return -1 endi if $data21 != 2 then return -1 endi if $data30 != @21-09-30 15:00:03.000@ then return -1 endi if $data31 != 2 then return -1 endi if $data40 != @21-09-30 15:00:04.000@ then return -1 endi if $data41 != 2 then return -1 endi if $data50 != @21-09-30 15:00:05.000@ then return -1 endi if $data51 != 2 then return -1 endi if $data60 != @21-09-30 15:00:06.000@ then return -1 endi if $data61 != 1 then return -1 endi if $data70 != @21-09-30 15:00:07.000@ then return -1 endi if $data71 != 1 then return -1 endi if $data80 != @21-09-30 15:00:08.000@ then return -1 endi if $data81 != 1 then return -1 endi if $data90 != @21-09-30 15:00:09.000@ then return -1 endi if $data91 != 1 then return -1 endi sql select sum(sa) from (select sum(a) as sa from meters interval(1s) group by tbname) interval(1s); if $rows != 11 then return -1 endi if $data00 != @21-09-30 15:00:00.000@ then return -1 endi if $data01 != 0 then return -1 endi if $data10 != @21-09-30 15:00:01.000@ then return -1 endi if $data11 != 23 then return -1 endi if $data20 != @21-09-30 15:00:02.000@ then return -1 endi if $data21 != 46 then return -1 endi if $data30 != @21-09-30 15:00:03.000@ then return -1 endi if $data31 != 69 then return -1 endi if $data40 != @21-09-30 15:00:04.000@ then return -1 endi if $data41 != 92 then return -1 endi if $data50 != @21-09-30 15:00:05.000@ then return -1 endi if $data51 != 115 then return -1 endi if $data60 != @21-09-30 15:00:06.000@ then return -1 endi if $data61 != 6 then return -1 endi if $data70 != @21-09-30 15:00:07.000@ then return -1 endi if $data71 != 7 then return -1 endi if $data80 != @21-09-30 15:00:08.000@ then return -1 endi if $data81 != 8 then return -1 endi if $data90 != @21-09-30 15:00:09.000@ then return -1 endi if $data91 != 9 then return -1 endi sql select sum(sa) from (select sum(a) as sa from meters interval(1s) group by area) interval(1s); if $rows != 11 then return -1 endi if $data00 != @21-09-30 15:00:00.000@ then return -1 endi if $data01 != 0 then return -1 endi if $data10 != @21-09-30 15:00:01.000@ then return -1 endi if $data11 != 23 then return -1 endi if $data20 != @21-09-30 15:00:02.000@ then return -1 endi if $data21 != 46 then return -1 endi if $data30 != @21-09-30 15:00:03.000@ then return -1 endi if $data31 != 69 then return -1 endi if $data40 != @21-09-30 15:00:04.000@ then return -1 endi if $data41 != 92 then return -1 endi if $data50 != @21-09-30 15:00:05.000@ then return -1 endi if $data51 != 115 then return -1 endi if $data60 != @21-09-30 15:00:06.000@ then return -1 endi if $data61 != 6 then return -1 endi if $data70 != @21-09-30 15:00:07.000@ then return -1 endi if $data71 != 7 then return -1 endi if $data80 != @21-09-30 15:00:08.000@ then return -1 endi if $data81 != 8 then return -1 endi if $data90 != @21-09-30 15:00:09.000@ then return -1 endi if $data91 != 9 then return -1 endi sql select count(*) from (select count(*) from meters interval(1s)) interval(1s); if $rows != 11 then return -1 endi if $data00 != @21-09-30 15:00:00.000@ then return -1 endi if $data01 != 1 then return -1 endi if $data10 != @21-09-30 15:00:01.000@ then return -1 endi if $data11 != 1 then return -1 endi if $data20 != @21-09-30 15:00:02.000@ then return -1 endi if $data21 != 1 then return -1 endi if $data30 != @21-09-30 15:00:03.000@ then return -1 endi if $data31 != 1 then return -1 endi if $data40 != @21-09-30 15:00:04.000@ then return -1 endi if $data41 != 1 then return -1 endi if $data50 != @21-09-30 15:00:05.000@ then return -1 endi if $data51 != 1 then return -1 endi if $data60 != @21-09-30 15:00:06.000@ then return -1 endi if $data61 != 1 then return -1 endi if $data70 != @21-09-30 15:00:07.000@ then return -1 endi if $data71 != 1 then return -1 endi if $data80 != @21-09-30 15:00:08.000@ then return -1 endi if $data81 != 1 then return -1 endi if $data90 != @21-09-30 15:00:09.000@ then return -1 endi if $data91 != 1 then return -1 endi sql select count(*) from (select count(*) from meters interval(1s) group by tbname); if $rows != 1 then return -1 endi if $data00 != 24 then return -1 endi sql select sum(a)/sum(b) from meters where ts >= '2021-09-30 15:00:00.000' and ts <= '2021-09-30 15:00:05.000' interval(1s) fill(null) group by area order by area; if $rows != 12 then return -1 endi if $data00 != @21-09-30 15:00:00.000@ then return -1 endi if $data01 != NULL then return -1 endi if $data02 != 0 then return -1 endi print ==============> TD-11969 sql create database test11969; sql use test11969; sql create stable st (ts timestamp , id int ) tags (ind int ); sql insert into sub1 using st tags(1) values(now ,1); sql insert into sub1 using st tags(1) values(now ,2); sql insert into sub2 using st tags(2) values(now ,3); sql insert into sub2 using st tags(2) values(now ,4); sql_error select max(ts_inter) ,tbname from (select elapsed(ts) ts_inter ,tbname from st interval (1s) group by tbname) order by ts sql drop database test11969 print ==========================================> TD-11097 sql create database td11097 sql use td11097 sql create table meters2 (ts timestamp, voltage bigint,num int) tags (location binary(30), groupid int); sql create table D001 using meters2 tags ("Beijing.Chaoyang", 1); sql create table D002 using meters2 tags ("Beijing.haidian", 2); sql create table D003 using meters2 tags ('"Beijing.Tongzhou"', 3); $ts = 1639556426000 sql insert into d001 values ( $ts ,1,2); sql insert into d001 values ( $ts +1m,2,3); sql insert into d001 values ( $ts +2m,4,3); sql insert into d001 values ( $ts +4m,8,3); sql insert into d002 values ( $ts ,4,3); sql insert into d002 values ( $ts +3m,40,3); sql insert into d002 values ( $ts +1m,46,3); sql insert into d001 values ( $ts +20m,1,2); sql insert into d002 values ( $ts +21m,4,3); sql select diff(voltage) value from meters2 group by tbname; sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) ; sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) order by ts; sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) order by ts desc; $emptyString = @@ print execute sql select diff(voltage) value from meters2 group by tbname; sql select diff(voltage) value from meters2 group by tbname; if $data00 != @21-12-15 16:21:26.000@ then return -1 endi if $data01 != @1@ then return -1 endi if $data02 != @d001@ then return -1 endi if $data10 != @21-12-15 16:22:26.000@ then return -1 endi if $data11 != @2@ then return -1 endi if $data12 != @d001@ then return -1 endi if $data20 != @21-12-15 16:24:26.000@ then return -1 endi if $data21 != @4@ then return -1 endi if $data22 != @d001@ then return -1 endi if $data30 != @21-12-15 16:40:26.000@ then return -1 endi if $data31 != @-7@ then return -1 endi if $data32 != @d001@ then return -1 endi if $data40 != @21-12-15 16:21:26.000@ then return -1 endi if $data41 != @42@ then return -1 endi if $data42 != @d002@ then return -1 endi if $data50 != @21-12-15 16:23:26.000@ then return -1 endi if $data51 != @-6@ then return -1 endi if $data52 != @d002@ then return -1 endi if $data60 != @21-12-15 16:41:26.000@ then return -1 endi if $data61 != @-36@ then return -1 endi if $data62 != @d002@ then return -1 endi print execute sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) ; sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) ; if $data00 != @21-12-15 16:21:00.000@ then return -1 endi if $data01 != @43@ then return -1 endi if $data10 != @21-12-15 16:22:00.000@ then return -1 endi if $data11 != @2@ then return -1 endi if $data20 != @21-12-15 16:23:00.000@ then return -1 endi if $data21 != @-6@ then return -1 endi if $data30 != @21-12-15 16:24:00.000@ then return -1 endi if $data31 != @4@ then return -1 endi if $data40 != @21-12-15 16:40:00.000@ then return -1 endi if $data41 != @-7@ then return -1 endi if $data50 != @21-12-15 16:41:00.000@ then return -1 endi if $data51 != @-36@ then return -1 endi print execute sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) order by ts; sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) order by ts; if $data00 != @21-12-15 16:21:00.000@ then return -1 endi if $data01 != @43@ then return -1 endi if $data10 != @21-12-15 16:22:00.000@ then return -1 endi if $data11 != @2@ then return -1 endi if $data20 != @21-12-15 16:23:00.000@ then return -1 endi if $data21 != @-6@ then return -1 endi if $data30 != @21-12-15 16:24:00.000@ then return -1 endi if $data31 != @4@ then return -1 endi if $data40 != @21-12-15 16:40:00.000@ then return -1 endi if $data41 != @-7@ then return -1 endi if $data50 != @21-12-15 16:41:00.000@ then return -1 endi if $data51 != @-36@ then return -1 endi print execute sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) order by ts desc; sql select sum(value) from (select diff(voltage) value from meters2 group by tbname) interval(1m) order by ts desc; if $data00 != @21-12-15 16:41:00.000@ then return -1 endi if $data01 != @-36@ then return -1 endi if $data10 != @21-12-15 16:40:00.000@ then return -1 endi if $data11 != @-7@ then return -1 endi if $data20 != @21-12-15 16:24:00.000@ then return -1 endi if $data21 != @4@ then return -1 endi if $data30 != @21-12-15 16:23:00.000@ then return -1 endi if $data31 != @-6@ then return -1 endi if $data40 != @21-12-15 16:22:00.000@ then return -1 endi if $data41 != @2@ then return -1 endi if $data50 != @21-12-15 16:21:00.000@ then return -1 endi if $data51 != @43@ then return -1 endi sql drop database td11097 system sh/exec.sh -n dnode1 -s stop -x SIGINT