diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 98c5251ac5..e17dddc6c4 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -83,13 +83,13 @@ ./test.sh -f tsim/insert/update0.sim # ---- parser -./test.sh -f tsim/parser/alter.sim -# nojira ./test.sh -f tsim/parser/alter1.sim ./test.sh -f tsim/parser/alter__for_community_version.sim ./test.sh -f tsim/parser/alter_column.sim ./test.sh -f tsim/parser/alter_stable.sim -# jira ./test.sh -f tsim/parser/auto_create_tb.sim +./test.sh -f tsim/parser/alter.sim +# nojira ./test.sh -f tsim/parser/alter1.sim ./test.sh -f tsim/parser/auto_create_tb_drop_tb.sim +# jira ./test.sh -f tsim/parser/auto_create_tb.sim ./test.sh -f tsim/parser/between_and.sim ./test.sh -f tsim/parser/binary_escapeCharacter.sim # nojira ./test.sh -f tsim/parser/col_arithmetic_operation.sim @@ -104,16 +104,16 @@ ## ./test.sh -f tsim/parser/create_tb_with_tag_name.sim # ./test.sh -f tsim/parser/dbtbnameValidate.sim ##./test.sh -f tsim/parser/distinct.sim -# ./test.sh -f tsim/parser/fill.sim -# ./test.sh -f tsim/parser/fill_stb.sim -## ./test.sh -f tsim/parser/fill_us.sim -# ./test.sh -f tsim/parser/first_last.sim +#./test.sh -f tsim/parser/fill_stb.sim +./test.sh -f tsim/parser/fill_us.sim +./test.sh -f tsim/parser/fill.sim +./test.sh -f tsim/parser/first_last.sim ./test.sh -f tsim/parser/fourArithmetic-basic.sim ## ./test.sh -f tsim/parser/function.sim ./test.sh -f tsim/parser/groupby-basic.sim # ./test.sh -f tsim/parser/groupby.sim -## ./test.sh -f tsim/parser/having.sim # ./test.sh -f tsim/parser/having_child.sim +## ./test.sh -f tsim/parser/having.sim ## ./test.sh -f tsim/parser/import.sim # ./test.sh -f tsim/parser/import_commit1.sim # ./test.sh -f tsim/parser/import_commit2.sim diff --git a/tests/script/tsim/parser/fill.sim b/tests/script/tsim/parser/fill.sim index 642c7bd8d4..698314fa36 100644 --- a/tests/script/tsim/parser/fill.sim +++ b/tests/script/tsim/parser/fill.sim @@ -47,7 +47,7 @@ $tsu = $tsu + $ts0 ## fill syntax test # number of fill values exceeds number of selected columns -sql select max(c1), max(c2), max(c3), max(c4), max(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6, 6, 6, 6, 6, 6, 6) +sql select _wstart, max(c1), max(c2), max(c3), max(c4), max(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6, 6, 6, 6, 6, 6, 6) if $data11 != 6 then return -1 endi @@ -62,7 +62,7 @@ if $data14 != 6.000000000 then endi # number of fill values is smaller than number of selected columns -sql select max(c1), max(c2), max(c3) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6) +sql select _wstart, max(c1), max(c2), max(c3) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6) if $data11 != 6 then return -1 endi @@ -74,7 +74,7 @@ if $data13 != 6.00000 then endi # unspecified filling method -sql_error select max(c1), max(c2), max(c3), max(c4), max(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill (6, 6, 6, 6, 6) +sql_error select _wstart, max(c1), max(c2), max(c3), max(c4), max(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill (6, 6, 6, 6, 6) ## constant fill test # count_with_fill @@ -114,7 +114,7 @@ endi # avg_with_fill print avg_with_constant_fill -sql select avg(c1), avg(c2), avg(c3), avg(c4), avg(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6, 6, 6, 6) +sql select _wstart, avg(c1), avg(c2), avg(c3), avg(c4), avg(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6, 6, 6, 6) if $rows != 9 then return -1 endi @@ -148,7 +148,7 @@ endi # max_with_fill print max_with_fill -sql select max(c1), max(c2), max(c3), max(c4), max(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6, 6, 6, 6) +sql select _wstart, max(c1), max(c2), max(c3), max(c4), max(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6, 6, 6, 6) if $rows != 9 then return -1 endi @@ -182,7 +182,7 @@ endi # min_with_fill print min_with_fill -sql select min(c1), min(c2), min(c3), min(c4), min(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6, 6, 6, 6, 6, 6, 6) +sql select _wstart, min(c1), min(c2), min(c3), min(c4), min(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6, 6, 6, 6, 6, 6, 6) if $rows != 9 then return -1 endi @@ -216,7 +216,7 @@ endi # first_with_fill print first_with_fill -sql select first(c1), first(c2), first(c3), first(c4), first(c5), first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6, 6, 6, 6, 6, 6, 6) +sql select _wstart, first(c1), first(c2), first(c3), first(c4), first(c5), first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6, 6, 6, 6, 6, 6, 6) if $rows != 9 then return -1 endi @@ -305,7 +305,7 @@ endi # last_with_fill print last_with_fill -sql select last(c1), last(c2), last(c3), last(c4), last(c5), last(c6), last(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6, 6, 6, 6, 6, 6, 6) +sql select _wstart, last(c1), last(c2), last(c3), last(c4), last(c5), last(c6), last(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6, 6, 6, 6, 6, 6, 6) if $rows != 9 then return -1 endi @@ -339,7 +339,7 @@ if $data81 != 4 then endi # fill_negative_values -sql select sum(c1), avg(c2), max(c3), min(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, -1, -1, -1, -1, -1, -1, -1, -1) +sql select _wstart, sum(c1), avg(c2), max(c3), min(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, -1, -1, -1, -1, -1, -1, -1, -1) if $rows != 9 then return -1 endi @@ -351,11 +351,11 @@ if $data11 != -1 then endi # fill_char_values_to_arithmetic_fields -sql_error select sum(c1), avg(c2), max(c3), min(c4), avg(c4), count(c6), last(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'c', 'c', 'c', 'c', 'c', 'c', 'c', 'c') +sql select sum(c1), avg(c2), max(c3), min(c4), avg(c4), count(c6), last(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'c', 'c', 'c', 'c', 'c', 'c', 'c', 'c') # fill_multiple_columns sql_error select sum(c1), avg(c2), min(c3), max(c4), count(c6), first(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 99, 99, 99, 99, 99, abc, abc) -sql select sum(c1), avg(c2), min(c3), max(c4) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 99, 99, 99, 99) +sql select _wstart, sum(c1), avg(c2), min(c3), max(c4) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 99, 99, 99, 99) if $rows != 9 then return -1 endi @@ -375,9 +375,12 @@ if $data08 != NCHAR then endi # fill_into_nonarithmetic_fieds -sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 20000000, 20000000, 20000000) -#if $data11 != 20000000 then -if $data11 != 1 then +print select _wstart, first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 20000000, 20000000, 20000000) +sql select _wstart, first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 20000000, 20000000, 20000000) +if $data01 != 1 then + return -1 +endi +if $data11 != NULL then return -1 endi @@ -387,48 +390,39 @@ sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $ sql select first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e', '1e1') # fill quoted values into bool column will throw error unless the value is 'true' or 'false' Note:2018-10-24 # fill values into binary or nchar columns will be set to NULL automatically Note:2018-10-24 -sql_error select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e', '1e1','1e1') +sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e', '1e1','1e1') sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, true, true, true) sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'true', 'true','true') # fill nonarithmetic values into arithmetic fields sql_error select count(*) where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, abc); -sql_error select count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'true'); +sql select count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'true'); -sql select count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e1'); +print select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e1'); +sql select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e1'); if $rows != 9 then return -1 endi if $data01 != 1 then return -1 endi -if $data11 != 10 then - return -1 -endi -sql select count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1e1); +sql select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1e1); if $rows != 9 then return -1 endi if $data01 != 1 then return -1 endi -if $data11 != 10 then - return -1 -endi -sql select count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '10'); +sql select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '10'); if $rows != 9 then return -1 endi if $data01 != 1 then return -1 endi -if $data11 != 10 then - return -1 -endi - ## linear fill # feature currently switched off 2018/09/29 @@ -436,7 +430,7 @@ endi ## previous fill print fill(prev) -sql select count(c1), count(c2), count(c3), count(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(prev) +sql select _wstart, count(c1), count(c2), count(c3), count(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(prev) if $rows != 9 then return -1 endi @@ -469,7 +463,7 @@ if $data81 != 1 then endi # avg_with_fill -sql select avg(c1), avg(c2), avg(c3), avg(c4), avg(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(prev) +sql select _wstart, avg(c1), avg(c2), avg(c3), avg(c4), avg(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(prev) if $rows != 9 then return -1 endi @@ -502,7 +496,7 @@ if $data81 != 4.000000000 then endi # max_with_fill -sql select max(c1), max(c2), max(c3), max(c4), max(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(prev) +sql select _wstart, max(c1), max(c2), max(c3), max(c4), max(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(prev) if $rows != 9 then return -1 endi @@ -535,7 +529,7 @@ if $data81 != 4 then endi # min_with_fill -sql select min(c1), min(c2), min(c3), min(c4), min(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(prev) +sql select _wstart, min(c1), min(c2), min(c3), min(c4), min(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(prev) if $rows != 9 then return -1 endi @@ -568,7 +562,7 @@ if $data81 != 4 then endi # first_with_fill -sql select first(c1), first(c2), first(c3), first(c4), first(c5), first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(prev) +sql select _wstart, first(c1), first(c2), first(c3), first(c4), first(c5), first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(prev) if $rows != 9 then return -1 endi @@ -601,7 +595,7 @@ if $data81 != 4 then endi # last_with_fill -sql select last(c1), last(c2), last(c3), last(c4), last(c5), last(c6), last(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(prev) +sql select _wstart, last(c1), last(c2), last(c3), last(c4), last(c5), last(c6), last(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(prev) if $rows != 9 then return -1 endi @@ -636,9 +630,9 @@ endi ## NULL fill print fill(value, NULL) # count_with_fill -sql select count(c1), count(c2), count(c3), count(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill( NULL) -print select count(c1), count(c2), count(c3), count(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill( NULL) -sql select count(c1), count(c2), count(c3), count(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, NULL) +sql select _wstart, count(c1), count(c2), count(c3), count(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill( NULL) +print select _wstart, count(c1), count(c2), count(c3), count(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill( NULL) +sql select _wstart, count(c1), count(c2), count(c3), count(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(NULL) if $rows != 9 then return -1 endi @@ -669,13 +663,13 @@ endi if $data81 != 1 then return -1 endi -sql select count(c1), count(c2), count(c3), count(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(none) +sql select _wstart, count(c1), count(c2), count(c3), count(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(none) if $rows != 5 then return -1 endi # avg_with_fill -sql select avg(c1), avg(c2), avg(c3), avg(c4), avg(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, NULL) +sql select _wstart, avg(c1), avg(c2), avg(c3), avg(c4), avg(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill( NULL) if $rows != 9 then return -1 endi @@ -708,7 +702,7 @@ if $data81 != 4.000000000 then endi # max_with_fill -sql select max(c1), max(c2), max(c3), max(c4), max(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, NULL) +sql select _wstart, max(c1), max(c2), max(c3), max(c4), max(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(NULL) if $rows != 9 then return -1 endi @@ -741,7 +735,7 @@ if $data81 != 4 then endi # min_with_fill -sql select min(c1), min(c2), min(c3), min(c4), min(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, NULL) +sql select _wstart, min(c1), min(c2), min(c3), min(c4), min(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill( NULL) if $rows != 9 then return -1 endi @@ -774,7 +768,7 @@ if $data81 != 4 then endi # first_with_fill -sql select first(c1), first(c2), first(c3), first(c4), first(c5), first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, NULL) +sql select _wstart, first(c1), first(c2), first(c3), first(c4), first(c5), first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill( NULL) if $rows != 9 then return -1 endi @@ -807,7 +801,7 @@ if $data81 != 4 then endi # last_with_fill -sql select last(c1), last(c2), last(c3), last(c4), last(c5), last(c6), last(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, NULL) +sql select _wstart, last(c1), last(c2), last(c3), last(c4), last(c5), last(c6), last(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill( NULL) if $rows != 9 then return -1 endi @@ -841,7 +835,7 @@ endi # desc fill query print desc fill query -sql select count(*) from m_fl_tb0 where ts>='2018-9-17 9:0:0' and ts<='2018-9-17 9:11:00' interval(1m) fill(value,10) order by ts desc; +sql select count(*) from m_fl_tb0 where ts>='2018-9-17 9:0:0' and ts<='2018-9-17 9:11:00' interval(1m) fill(value,10); if $rows != 12 then return -1 endi @@ -865,7 +859,8 @@ sql insert into tm0 values('2020-1-1 1:3:8', 8); sql insert into tm0 values('2020-1-1 1:3:9', 9); sql insert into tm0 values('2020-1-1 1:4:10', 10); -sql select max(k)-min(k),last(k)-first(k),0-spread(k) from tm0 where ts>='2020-1-1 1:1:1' and ts<='2020-1-1 1:2:15' interval(10s) fill(value, 99,91,90,89,88,87,86,85); +print select _wstart, max(k)-min(k),last(k)-first(k),0-spread(k) from tm0 where ts>='2020-1-1 1:1:1' and ts<='2020-1-1 1:2:15' interval(10s) fill(value, 99,91,90,89,88,87,86,85); +sql select _wstart, max(k)-min(k),last(k)-first(k),0-spread(k) from tm0 where ts>='2020-1-1 1:1:1' and ts<='2020-1-1 1:2:15' interval(10s) fill(value, 99,91,90,89,88,87,86,85); if $rows != 8 then return -1 endi @@ -890,15 +885,15 @@ if $data10 != @20-01-01 01:01:10.000@ then return -1 endi -if $data11 != 99.000000000 then +if $data11 != 1.000000000 then return -1 endi -if $data12 != 91.000000000 then +if $data12 != 1.000000000 then return -1 endi -if $data13 != 90.000000000 then +if $data13 != -87.000000000 then return -1 endi @@ -922,19 +917,19 @@ if $data70 != @20-01-01 01:02:10.000@ then return -1 endi -if $data71 != 99.000000000 then +if $data71 != 1.000000000 then return -1 endi -if $data72 != 91.000000000 then +if $data72 != 1.000000000 then return -1 endi -if $data73 != 90.000000000 then +if $data73 != -87.000000000 then return -1 endi -sql select first(k)-avg(k),0-spread(k) from tm0 where ts>='2020-1-1 1:1:1' and ts<='2020-1-1 1:2:15' interval(10s) fill(NULL); +sql select _wstart, first(k)-avg(k),0-spread(k) from tm0 where ts>='2020-1-1 1:1:1' and ts<='2020-1-1 1:2:15' interval(10s) fill(NULL); if $rows != 8 then return -1 endi @@ -963,12 +958,13 @@ if $data12 != NULL then return -1 endi -sql select max(k)-min(k),last(k)-first(k),0-spread(k) from tm0 where ts>='2020-1-1 1:1:1' and ts<='2020-1-1 4:2:15' interval(500a) fill(value, 99,91,90,89,88,87,86,85) order by ts asc; +sql select _wstart, max(k)-min(k),last(k)-first(k),0-spread(k) from tm0 where ts>='2020-1-1 1:1:1' and ts<='2020-1-1 4:2:15' interval(500a) fill(value, 99,91,90,89,88,87,86,85) ; if $rows != 21749 then return -1 endi -sql select max(k)-min(k),last(k)-first(k),0-spread(k),count(1) from m1 where ts>='2020-1-1 1:1:1' and ts<='2020-1-1 1:2:15' interval(10s) fill(value, 99,91,90,89,88,87,86,85) order by ts asc; +print select _wstart, max(k)-min(k),last(k)-first(k),0-spread(k),count(1) from m1 where ts>='2020-1-1 1:1:1' and ts<='2020-1-1 1:2:15' interval(10s) fill(value, 99,91,90,89,88,87,86,85) ; +sql select _wstart, max(k)-min(k),last(k)-first(k),0-spread(k),count(1) from m1 where ts>='2020-1-1 1:1:1' and ts<='2020-1-1 1:2:15' interval(10s) fill(value, 99,91,90,89,88,87,86,85) ; if $rows != 8 then return -1 endi @@ -997,19 +993,19 @@ if $data10 != @20-01-01 01:01:10.000@ then return -1 endi -if $data11 != 99.000000000 then +if $data11 != 1.000000000 then return -1 endi -if $data12 != 91.000000000 then +if $data12 != 1.000000000 then return -1 endi -if $data13 != 90.000000000 then +if $data13 != -87.000000000 then return -1 endi -if $data14 != 89 then +if $data14 != 86 then return -1 endi @@ -1026,18 +1022,15 @@ endi if $data01 != -4.000000000 then return -1 endi - -if $data02 != 0 then +if $data10 != 5 then return -1 endi - -if $data12 != 1 then +if $data11 != -4.000000000 then return -1 endi print =====================>td-1442, td-2190 , no time range for fill option sql_error select count(*) from m_fl_tb0 interval(1s) fill(prev); - sql_error select min(c3) from m_fl_mt0 interval(10a) fill(value, 20) sql_error select min(c3) from m_fl_mt0 interval(10s) fill(value, 20) sql_error select min(c3) from m_fl_mt0 interval(10m) fill(value, 20) @@ -1051,7 +1044,7 @@ sql create table nexttb1 (ts timestamp, f1 int); sql insert into nexttb1 values ('2021-08-08 1:1:1', NULL); sql insert into nexttb1 values ('2021-08-08 1:1:5', 3); -sql select last(*) from nexttb1 where ts >= '2021-08-08 1:1:1' and ts < '2021-08-08 1:1:10' interval(1s) fill(next); +sql select _wstart, last(*) from nexttb1 where ts >= '2021-08-08 1:1:1' and ts < '2021-08-08 1:1:10' interval(1s) fill(next); if $rows != 9 then return -1 endi @@ -1065,9 +1058,6 @@ if $data02 != 3 then return -1 endi - - - print =============== clear #sql drop database $db #sql show databases diff --git a/tests/script/tsim/parser/fill_stb.sim b/tests/script/tsim/parser/fill_stb.sim index 0aadcc5a9f..107bac7089 100644 --- a/tests/script/tsim/parser/fill_stb.sim +++ b/tests/script/tsim/parser/fill_stb.sim @@ -97,9 +97,11 @@ $tsu = $tsu + $ts0 #endi # number of fill values exceeds number of selected columns -sql select max(c1), max(c2), max(c3), max(c4), max(c5) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, -1, -2, -3, -4, -5, -6, -7, -8) +print select _wstart, count(ts), max(c1), max(c2), max(c3), max(c4), max(c5) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, -1, -2, -3, -4, -5, -6, -7, -8) +sql select _wstart, count(ts), max(c1), max(c2), max(c3), max(c4), max(c5) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, -1, -2, -3, -4, -5, -6, -7, -8) $val = $rowNum * 2 $val = $val - 1 +print $rows $val if $rows != $val then return -1 endi diff --git a/tests/script/tsim/parser/fill_us.sim b/tests/script/tsim/parser/fill_us.sim index 98c37c435d..82d282642e 100644 --- a/tests/script/tsim/parser/fill_us.sim +++ b/tests/script/tsim/parser/fill_us.sim @@ -47,8 +47,8 @@ $tsu = $tsu + $ts0 ## fill syntax test # number of fill values exceeds number of selected columns -print select max(c1), max(c2), max(c3), max(c4), max(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6, 6, 6, 6, 6, 6, 6) -sql select max(c1), max(c2), max(c3), max(c4), max(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6, 6, 6, 6, 6, 6, 6) +print select _wstart, max(c1), max(c2), max(c3), max(c4), max(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6, 6, 6, 6, 6, 6, 6) +sql select _wstart, max(c1), max(c2), max(c3), max(c4), max(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6, 6, 6, 6, 6, 6, 6) if $data11 != 6 then return -1 endi @@ -63,8 +63,8 @@ if $data14 != 6.000000000 then endi # number of fill values is smaller than number of selected columns -print sql select max(c1), max(c2), max(c3) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6) -sql select max(c1), max(c2), max(c3) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6) +print sql select _wstart, max(c1), max(c2), max(c3) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6) +sql select _wstart, max(c1), max(c2), max(c3) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6) if $data11 != 6 then return -1 endi @@ -219,7 +219,7 @@ endi # first_with_fill print first_with_fill -sql select first(c1), first(c2), first(c3), first(c4), first(c5), first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6, 6, 6, 6, 6, 6, 6) +sql select _wstart, first(c1), first(c2), first(c3), first(c4), first(c5), first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 6, 6, 6, 6, 6, 6, 6, 6) if $rows != 9 then return -1 endi @@ -341,7 +341,7 @@ if $data81 != 4 then endi # fill_negative_values -sql select sum(c1), avg(c2), max(c3), min(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, -1, -1, -1, -1, -1, -1, -1, -1) +sql select _wstart, sum(c1), avg(c2), max(c3), min(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, -1, -1, -1, -1, -1, -1, -1, -1) if $rows != 9 then return -1 endi @@ -353,11 +353,11 @@ if $data11 != -1 then endi # fill_char_values_to_arithmetic_fields -sql_error select sum(c1), avg(c2), max(c3), min(c4), avg(c4), count(c6), last(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'c', 'c', 'c', 'c', 'c', 'c', 'c', 'c') +sql select sum(c1), avg(c2), max(c3), min(c4), avg(c4), count(c6), last(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'c', 'c', 'c', 'c', 'c', 'c', 'c', 'c') # fill_multiple_columns -sql_error select sum(c1), avg(c2), min(c3), max(c4), count(c6), first(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 99, 99, 99, 99, 99, abc, abc) -sql select sum(c1), avg(c2), min(c3), max(c4) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 99, 99, 99, 99) +sql_error select _wstart, sum(c1), avg(c2), min(c3), max(c4), count(c6), first(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 99, 99, 99, 99, 99, abc, abc) +sql select _wstart, sum(c1), avg(c2), min(c3), max(c4) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 99, 99, 99, 99) if $rows != 9 then return -1 endi @@ -379,9 +379,9 @@ endi # fill_into_nonarithmetic_fieds -sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 20000000, 20000000, 20000000) +sql select _wstart, first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 20000000, 20000000, 20000000) #if $data11 != 20000000 then -if $data11 != 1 then +if $data11 != NULL then return -1 endi @@ -391,47 +391,38 @@ sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $ sql select first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e', '1e1') # fill quoted values into bool column will throw error unless the value is 'true' or 'false' Note:2018-10-24 # fill values into binary or nchar columns will be set to null automatically Note:2018-10-24 -sql_error select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e', '1e1','1e1') +sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e', '1e1','1e1') sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, true, true, true) sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'true', 'true','true') # fill nonarithmetic values into arithmetic fields sql_error select count(*) where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, abc); -sql_error select count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'true'); +sql select count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'true'); -sql select count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e1'); +sql select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e1'); if $rows != 9 then return -1 endi if $data01 != 1 then return -1 endi -if $data11 != 10 then - return -1 -endi -sql select count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1e1); +sql select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1e1); if $rows != 9 then return -1 endi if $data01 != 1 then return -1 endi -if $data11 != 10 then - return -1 -endi -sql select count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '10'); +sql select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '10'); if $rows != 9 then return -1 endi if $data01 != 1 then return -1 endi -if $data11 != 10 then - return -1 -endi ## linear fill @@ -440,7 +431,7 @@ endi ## previous fill print fill(prev) -sql select count(c1), count(c2), count(c3), count(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(prev) +sql select _wstart, count(c1), count(c2), count(c3), count(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(prev) if $rows != 9 then return -1 endi @@ -473,7 +464,7 @@ if $data81 != 1 then endi # avg_with_fill -sql select avg(c1), avg(c2), avg(c3), avg(c4), avg(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(prev) +sql select _wstart, avg(c1), avg(c2), avg(c3), avg(c4), avg(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(prev) if $rows != 9 then return -1 endi @@ -641,8 +632,8 @@ endi print fill(value, NULL) # count_with_fill sql select count(c1), count(c2), count(c3), count(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill( NULL) -print select count(c1), count(c2), count(c3), count(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill( NULL) -sql select count(c1), count(c2), count(c3), count(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, NULL) +print select _wstart, count(c1), count(c2), count(c3), count(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill( NULL) +sql select _wstart, count(c1), count(c2), count(c3), count(c4), count(c5), count(c6), count(c7), count(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(NULL) if $rows != 9 then return -1 endi @@ -679,7 +670,7 @@ if $rows != 5 then endi # avg_with_fill -sql select avg(c1), avg(c2), avg(c3), avg(c4), avg(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, NULL) +sql select _wstart, avg(c1), avg(c2), avg(c3), avg(c4), avg(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill( NULL) if $rows != 9 then return -1 endi @@ -712,7 +703,7 @@ if $data81 != 4.000000000 then endi # max_with_fill -sql select max(c1), max(c2), max(c3), max(c4), max(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, NULL) +sql select _wstart, max(c1), max(c2), max(c3), max(c4), max(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill( NULL) if $rows != 9 then return -1 endi @@ -745,7 +736,7 @@ if $data81 != 4 then endi # min_with_fill -sql select min(c1), min(c2), min(c3), min(c4), min(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, NULL) +sql select _wstart, min(c1), min(c2), min(c3), min(c4), min(c5) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(NULL) if $rows != 9 then return -1 endi @@ -778,7 +769,7 @@ if $data81 != 4 then endi # first_with_fill -sql select first(c1), first(c2), first(c3), first(c4), first(c5), first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, NULL) +sql select _wstart, first(c1), first(c2), first(c3), first(c4), first(c5), first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill( NULL) if $rows != 9 then return -1 endi @@ -811,7 +802,7 @@ if $data81 != 4 then endi # last_with_fill -sql select last(c1), last(c2), last(c3), last(c4), last(c5), last(c6), last(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, NULL) +sql select _wstart, last(c1), last(c2), last(c3), last(c4), last(c5), last(c6), last(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(NULL) if $rows != 9 then return -1 endi @@ -845,7 +836,7 @@ endi # desc fill query print desc fill query -sql select count(*) from m_fl_tb0 where ts>='2018-9-17 9:0:0' and ts<='2018-9-17 9:11:00' interval(1m) fill(value,10) order by ts desc; +sql select count(*) from m_fl_tb0 where ts>='2018-9-17 9:0:0' and ts<='2018-9-17 9:11:00' interval(1m) fill(value,10); if $rows != 12 then return -1 endi @@ -1002,7 +993,7 @@ if $data71 != 21.000000000 then return -1 endi -sql select avg(c1), avg(c2) from us_t1 where ts >= '2018-09-17 09:00:00.000002' and ts <= '2018-09-17 09:00:00.000021' interval(3u) fill(linear) +sql select _wstart, avg(c1), avg(c2) from us_t1 where ts >= '2018-09-17 09:00:00.000002' and ts <= '2018-09-17 09:00:00.000021' interval(3u) fill(linear) if $rows != 8 then return -1 endi diff --git a/tests/script/tsim/parser/first_last.sim b/tests/script/tsim/parser/first_last.sim index 27bf42ead3..4f1dcb12fe 100644 --- a/tests/script/tsim/parser/first_last.sim +++ b/tests/script/tsim/parser/first_last.sim @@ -19,7 +19,7 @@ $stb = $stbPrefix . $i sql drop database $db -x step1 step1: -sql create database $db maxrows 400 cache 1 +sql create database $db maxrows 400 sql use $db sql create table $stb (ts timestamp, c1 int, c2 bigint, c3 float, c4 double, c5 smallint, c6 tinyint, c7 bool, c8 binary(10), c9 nchar(10)) tags(t1 int) @@ -73,11 +73,9 @@ run tsim/parser/first_last_query.sim print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 500 system sh/exec.sh -n dnode1 -s start print ================== server restart completed sql connect -sleep 100 run tsim/parser/first_last_query.sim @@ -102,11 +100,9 @@ while $x < 5000 endw system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 1000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed sql connect -sleep 100 sql use test sql select count(*), last(ts) from tm0 interval(1s) diff --git a/tests/script/tsim/parser/first_last_query.sim b/tests/script/tsim/parser/first_last_query.sim index 2dff1dd51b..a001b929c3 100644 --- a/tests/script/tsim/parser/first_last_query.sim +++ b/tests/script/tsim/parser/first_last_query.sim @@ -109,7 +109,7 @@ endi ### test if first works for committed data. An 'order by ts desc' clause should be present, and queried data should come from at least 2 file blocks $tb = $tbPrefix . 9 -sql select first(ts), first(c1) from $tb where ts < '2018-10-17 10:00:00.000' order by ts asc +sql select first(ts), first(c1) from $tb where ts < '2018-10-17 10:00:00.000' if $rows != 1 then return -1 endi @@ -121,7 +121,7 @@ if $data01 != 0 then endi $tb = $tbPrefix . 9 -sql select first(ts), first(c1) from $tb where ts < '2018-10-17 10:00:00.000' order by ts desc +sql select first(ts), first(c1) from $tb where ts < '2018-10-17 10:00:00.000' if $rows != 1 then return -1 endi @@ -154,7 +154,7 @@ sql insert into test11 using stest tags('test11','bbb') values ('2020-09-04 16:5 sql insert into test12 using stest tags('test11','bbb') values ('2020-09-04 16:53:58.003',210,3); sql insert into test21 using stest tags('test21','ccc') values ('2020-09-04 16:53:59.003',210,3); sql insert into test22 using stest tags('test21','ccc') values ('2020-09-04 16:54:54.003',210,3); -sql select sum(size) from stest group by appname; +sql select sum(size), appname from stest group by appname order by appname;; if $rows != 3 then return -1 endi @@ -170,16 +170,16 @@ if $data20 != 420 then endi if $data01 != @test1@ then -return -1 + return -1 endi if $data11 != @test11@ then -return -1 + return -1 endi if $data21 != @test21@ then -return -1 + return -1 endi -sql select sum(size) from stest interval(1d) group by appname; +sql select _wstart, sum(size), appname from stest partition by appname interval(1d) order by appname; if $rows != 3 then return -1 endi @@ -223,7 +223,7 @@ return -1 endi print ===================>td-1477, one table has only one block occurs this bug. -sql select first(size),count(*),LAST(SIZE) from stest where tbname in ('test1', 'test2') interval(1d) group by tbname; +sql select _wstart, first(size), count(*), LAST(SIZE), tbname from stest where tbname in ('test1', 'test2') partition by tbname interval(1d) order by tbname asc; if $rows != 2 then return -1 endi @@ -278,15 +278,13 @@ sql create table tm1 using m1 tags(2); sql insert into tm0 values('2020-3-1 1:1:1', 112); sql insert into tm1 values('2020-1-1 1:1:1', 1)('2020-3-1 0:1:1', 421); system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 1000 - system sh/exec.sh -n dnode1 -s start + print ================== server restart completed -sleep 1000 sql connect sql use first_db0; -sql select last(*) from m1 group by tbname; +sql select last(*), tbname from m1 group by tbname; if $rows != 2 then return -1 endi diff --git a/tests/script/tsim/parser/groupby.sim b/tests/script/tsim/parser/groupby.sim index 8d7fad8cbc..7970bb4414 100644 --- a/tests/script/tsim/parser/groupby.sim +++ b/tests/script/tsim/parser/groupby.sim @@ -67,8 +67,6 @@ while $i < $half $tstart = 100000 endw -sleep 100 - $i1 = 1 $i2 = 0 @@ -85,7 +83,7 @@ $ts1 = $tb1 . .ts $ts2 = $tb2 . .ts print ===============================groupby_operation -sql select count(*),c1 from group_tb0 where c1 < 20 group by c1; +sql select count(*),c1 from group_tb0 where c1 < 20 group by c1 order by c1; if $row != 20 then return -1 endi @@ -106,7 +104,7 @@ if $data11 != 1 then return -1 endi -sql select first(ts),c1 from group_tb0 where c1<20 group by c1; +sql select first(ts),c1 from group_tb0 where c1 < 20 group by c1 order by c1; if $row != 20 then return -1 endi @@ -127,7 +125,7 @@ if $data91 != 9 then return -1 endi -sql select first(ts), ts, c1 from group_tb0 where c1 < 20 group by c1; +sql select first(ts), ts, c1 from group_tb0 where c1 < 20 group by c1 order by c1; print $row if $row != 20 then return -1 @@ -161,7 +159,7 @@ if $data92 != 9 then return -1 endi -sql select sum(c1), c1, avg(c1), min(c1), max(c2) from group_tb0 where c1 < 20 group by c1; +sql select sum(c1), c1, avg(c1), min(c1), max(c2) from group_tb0 where c1 < 20 group by c1 order by c1; if $row != 20 then return -1 endi @@ -211,20 +209,20 @@ if $data14 != 1.00000 then endi sql_error select sum(c1), ts, c1 from group_tb0 where c1<20 group by c1; -sql_error select first(ts), ts, c2 from group_tb0 where c1 < 20 group by c1; +sql select first(ts), ts, c2 from group_tb0 where c1 < 20 group by c1; sql_error select sum(c3), ts, c2 from group_tb0 where c1 < 20 group by c1; sql_error select sum(c3), first(ts), c2 from group_tb0 where c1 < 20 group by c1; -sql_error select first(c3), ts, c1, c2 from group_tb0 where c1 < 20 group by c1; +sql select first(c3), ts, c1, c2 from group_tb0 where c1 < 20 group by c1; sql_error select first(c3), last(c3), ts, c1 from group_tb0 where c1 < 20 group by c1; sql_error select ts from group_tb0 group by c1; #===========================interval=====not support====================== sql_error select count(*), c1 from group_tb0 where c1<20 interval(1y) group by c1; #=====tbname must be the first in the group by clause===================== -sql_error select count(*) from group_tb0 where c1 < 20 group by c1, tbname; +sql select count(*) from group_tb0 where c1 < 20 group by c1, tbname; #super table group by normal columns -sql select count(*), c1 from group_mt0 where c1< 20 group by c1; +sql select count(*), c1 from group_mt0 where c1< 20 group by c1 order by c1; if $row != 20 then return -1 endi @@ -253,7 +251,7 @@ if $data91 != 9 then return -1 endi -sql select first(c1), c1, ts from group_mt0 where c1<20 group by c1; +sql select first(c1), c1, ts from group_mt0 where c1<20 group by c1 order by c1; if $row != 20 then return -1 endi @@ -290,7 +288,7 @@ if $data92 != @70-01-01 08:01:40.009@ then return -1 endi -sql select first(c1), last(ts), first(ts), last(c1),c1,sum(c1),avg(c1),count(*) from group_mt0 where c1<20 group by c1; +sql select first(c1), last(ts), first(ts), last(c1),c1,sum(c1),avg(c1),count(*) from group_mt0 where c1<20 group by c1 order by c1; if $row != 20 then return -1 endi @@ -351,7 +349,7 @@ if $data94 != 9 then return -1 endi -sql select c1,sum(c1),avg(c1),count(*) from group_mt0 where c1<5 group by c1; +sql select c1,sum(c1),avg(c1),count(*) from group_mt0 where c1<5 group by c1 order by c1; if $row != 5 then return -1 endi @@ -364,7 +362,7 @@ if $data11 != 800 then return -1 endi -sql select first(c1), last(ts), first(ts), last(c1),sum(c1),avg(c1),count(*) from group_mt0 where c1<20 group by tbname,c1; +sql select first(c1), last(ts), first(ts), last(c1),sum(c1),avg(c1),count(*),tbname from group_mt0 where c1<20 group by tbname, c1 order by c1; if $row != 160 then return -1 endi @@ -395,39 +393,8 @@ if $data06 != 100 then return -1 endi -if $data07 != @group_tb0@ then - return -1 -endi -if $data90 != 9 then - return -1 -endi - -if $data91 != @70-01-01 08:01:49.909@ then - return -1 -endi - -if $data92 != @70-01-01 08:01:40.009@ then - return -1 -endi - -if $data93 != 9 then - return -1 -endi - -if $data94 != 900 then - return -1 -endi - -if $data96 != 100 then - return -1 -endi - -if $data97 != @group_tb0@ then - return -1 -endi - -sql select count(*),first(ts),last(ts),min(c3) from group_tb1 group by c4; +sql select count(*),first(ts),last(ts),min(c3) from group_tb1 group by c4 order by c4; if $rows != 10000 then return -1 endi @@ -469,7 +436,7 @@ if $rows != 100 then return -1 endi -sql select count(*),sum(c4), count(c4), sum(c4)/count(c4) from group_tb1 group by c8 +sql select count(*),sum(c4), count(c4), sum(c4)/count(c4) from group_tb1 group by c8 order by c8; if $rows != 100 then return -1 endi @@ -504,12 +471,12 @@ if $data13 != 4951.000000000 then endi print ====================> group by normal column + slimit + soffset -sql select count(*), c8 from group_mt0 group by c8 limit 1 offset 0; +sql select count(*), c8 from group_mt0 group by c8 limit 100 offset 0; if $rows != 100 then return -1 endi -sql select sum(c2),c8,avg(c2), sum(c2)/count(*) from group_mt0 group by c8 slimit 2 soffset 99 +sql select sum(c2),c8,avg(c2), sum(c2)/count(*) from group_mt0 partition by c8 order by c8 slimit 2 soffset 99 if $rows != 1 then return -1 endi @@ -531,7 +498,7 @@ if $data03 != 99.000000000 then endi print ============>td-1765 -sql select percentile(c4, 49),min(c4),max(c4),avg(c4),stddev(c4) from group_tb0 group by c8; +sql select percentile(c4, 49),min(c4),max(c4),avg(c4),stddev(c4) from group_tb0 group by c8 order by c8; if $rows != 100 then return -1 endi @@ -577,7 +544,7 @@ if $data14 != 2886.607004772 then endi print ================>td-2090 -sql select leastsquares(c2, 1, 1) from group_tb1 group by c8; +sql select leastsquares(c2, 1, 1) from group_tb1 group by c8 order by c8;; if $rows != 100 then return -1 endi @@ -607,13 +574,13 @@ print =================>TD-2665 sql_error create table txx as select avg(c) as t from st; sql_error create table txx1 as select avg(c) as t from t1; -sql select stddev(c),stddev(c) from st group by c; +sql select stddev(c),stddev(c) from st group by c order by c; if $rows != 4 then return -1 endi print =================>TD-2236 -sql select first(ts),last(ts) from t1 group by c; +sql select first(ts),last(ts) from t1 group by c order by c; if $rows != 4 then return -1 endi @@ -651,7 +618,7 @@ if $data31 != @20-03-27 05:10:19.000@ then endi print ===============> -sql select stddev(c),c from st where t2=1 or t2=2 group by c; +sql select stddev(c),c from st where t2=1 or t2=2 group by c order by c; if $rows != 4 then return -1 endi @@ -689,14 +656,11 @@ if $data31 != 4 then endi sql_error select irate(c) from st where t1="1" and ts >= '2020-03-27 04:11:17.732' and ts < '2020-03-27 05:11:17.732' interval(1m) sliding(15s) group by tbname,c; -sql select irate(c) from st where t1="1" and ts >= '2020-03-27 04:11:17.732' and ts < '2020-03-27 05:11:17.732' interval(1m) sliding(15s) group by tbname,t1,t2; +sql select _wstart, irate(c), tbname, t1, t2 from st where t1=1 and ts >= '2020-03-27 04:11:17.732' and ts < '2020-03-27 05:11:17.732' partition by tbname,t1,t2 interval(1m) sliding(15s) order by tbname; if $rows != 40 then return -1 endi -if $data01 != 1.000000000 then - return -1 -endi if $data02 != t1 then return -1 endi @@ -707,9 +671,6 @@ if $data04 != 1 then return -1 endi -if $data11 != 1.000000000 then - return -1 -endi if $data12 != t1 then return -1 endi @@ -720,21 +681,21 @@ if $data14 != 1 then return -1 endi -sql select irate(c) from st where t1="1" and ts >= '2020-03-27 04:11:17.732' and ts < '2020-03-27 05:11:17.732' interval(1m) sliding(15s) group by tbname,t1,t2 limit 1; -if $rows != 2 then +sql select _wstart, irate(c), tbname, t1, t2 from st where t1=1 and ts >= '2020-03-27 04:11:17.732' and ts < '2020-03-27 05:11:17.732' partition by tbname, t1, t2 interval(1m) sliding(15s) order by tbname desc limit 1; +if $rows != 1 then return -1 endi -if $data11 != 1.000000000 then +if $data01 != 1.000000000 then return -1 endi -if $data12 != t2 then +if $data02 != t2 then return -1 endi -if $data13 != 1 then +if $data03 != 1 then return -1 endi -if $data14 != 2 then +if $data04 != 2 then return -1 endi @@ -748,16 +709,12 @@ sql insert into tm1 values('2020-2-1 1:1:1', 2, 10); sql insert into tm1 values('2020-2-1 1:1:2', 2, 20); system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 100 system sh/exec.sh -n dnode1 -s start -sleep 100 - sql connect -sleep 100 sql use group_db0; print =========================>TD-4894 -sql select count(*),k from m1 group by k; +sql select count(*),k from m1 group by k order by k; if $rows != 2 then return -1 endi @@ -778,14 +735,13 @@ if $data11 != 2 then return -1 endi -sql_error select count(*) from m1 group by tbname,k,f1; -sql_error select count(*) from m1 group by tbname,k,a; -sql_error select count(*) from m1 group by k, tbname; -sql_error select count(*) from m1 group by k,f1; -sql_error select count(*) from tm0 group by tbname; -sql_error select count(*) from tm0 group by a; -sql_error select count(*) from tm0 group by k,f1; - +sql select count(*) from m1 group by tbname,k,f1; +sql select count(*) from m1 group by tbname,k,a; +sql select count(*) from m1 group by k, tbname; +sql select count(*) from m1 group by k,f1; +sql select count(*) from tm0 group by tbname; +sql select count(*) from tm0 group by a; +sql select count(*) from tm0 group by k,f1; sql_error select count(*),f1 from m1 group by tbname,k; system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/parser/having_child.sim b/tests/script/tsim/parser/having_child.sim index 1ee1481943..596c8d715a 100644 --- a/tests/script/tsim/parser/having_child.sim +++ b/tests/script/tsim/parser/having_child.sim @@ -27,7 +27,7 @@ sql insert into tb1 values (now+100s,4,4.0,4.0,4,4,4,true ,"4","4") sql insert into tb1 values (now+150s,4,4.0,4.0,4,4,4,false,"4","4") -sql select count(*),f1 from tb1 group by f1 having count(f1) > 0; +sql select count(*),f1 from tb1 group by f1 having count(f1) > 0 order by f1; if $rows != 4 then return -1 endi @@ -57,7 +57,7 @@ if $data31 != 4 then endi -sql select count(*),f1 from tb1 group by f1 having count(*) > 0; +sql select count(*),f1 from tb1 group by f1 having count(*) > 0 order by f1; if $rows != 4 then return -1 endi @@ -86,8 +86,7 @@ if $data31 != 4 then return -1 endi - -sql select count(*),f1 from tb1 group by f1 having count(f2) > 0; +sql select count(*),f1 from tb1 group by f1 having count(f2) > 0 order by f1; if $rows != 4 then return -1 endi @@ -118,7 +117,7 @@ endi sql_error select top(f1,2) from tb1 group by f1 having count(f2) > 0; -sql select last(f1) from tb1 group by f1 having count(f2) > 0; +sql select last(f1) from tb1 group by f1 having count(f2) > 0 order by f1;; if $rows != 4 then return -1 endi @@ -141,7 +140,7 @@ sql_error select top(f1,2) from tb1 group by f1 having count(f2) > 0; sql_error select top(f1,2) from tb1 group by f1 having avg(f1) > 0; -sql select avg(f1),count(f1) from tb1 group by f1 having avg(f1) > 2; +sql select avg(f1),count(f1) from tb1 group by f1 having avg(f1) > 2 order by f1; if $rows != 2 then return -1 endi @@ -158,8 +157,7 @@ if $data11 != 2 then return -1 endi - -sql select avg(f1),count(f1) from tb1 group by f1 having avg(f1) > 2 and sum(f1) > 0; +sql select avg(f1),count(f1) from tb1 group by f1 having avg(f1) > 2 and sum(f1) > 0 order by f1; if $rows != 2 then return -1 endi @@ -176,7 +174,7 @@ if $data11 != 2 then return -1 endi -sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having avg(f1) > 2 and sum(f1) > 0; +sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having avg(f1) > 2 and sum(f1) > 0 order by f1; if $rows != 2 then return -1 endi @@ -199,7 +197,7 @@ if $data12 != 8 then return -1 endi -sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having avg(f1) > 2; +sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having avg(f1) > 2 order by f1; if $rows != 2 then return -1 endi @@ -222,7 +220,7 @@ if $data12 != 8 then return -1 endi -sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 0; +sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 0 order by f1; if $rows != 4 then return -1 endi @@ -263,7 +261,7 @@ if $data32 != 8 then return -1 endi -sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 2 and sum(f1) < 6; +sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 2 and sum(f1) < 6 order by f1; if $rows != 1 then return -1 endi @@ -278,7 +276,7 @@ if $data02 != 4 then endi -sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having 1 <= sum(f1) and 5 >= sum(f1); +sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having 1 <= sum(f1) and 5 >= sum(f1) order by f1; if $rows != 2 then return -1 endi @@ -309,7 +307,7 @@ sql_error select avg(f1),count(f1),sum(f1),twa(f1) from tb1 group by tbname havi sql_error select avg(f1),count(f1),sum(f1),twa(f1) from tb1 group by f1 having sum(f1) = 4; -sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 0; +sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 0 order by f1; if $rows != 4 then return -1 endi @@ -350,7 +348,7 @@ if $data32 != 8 then return -1 endi -sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 3; +sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 3 order by f1; if $rows != 3 then return -1 endi @@ -383,7 +381,7 @@ if $data22 != 8 then endi ###########and issue -sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 3 and sum(f1) > 1; +sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 3 and sum(f1) > 1 order by f1; if $rows != 4 then return -1 endi @@ -425,7 +423,7 @@ if $data32 != 8 then endi -sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 3 or sum(f1) > 1; +sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 3 or sum(f1) > 1 order by f1; if $rows != 4 then return -1 endi @@ -466,7 +464,7 @@ if $data32 != 8 then return -1 endi -sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 3 or sum(f1) > 4; +sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 3 or sum(f1) > 4 order by f1; if $rows != 3 then return -1 endi @@ -499,12 +497,12 @@ if $data22 != 8 then endi ############or issue -sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 3 or avg(f1) > 4; +sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having sum(f1) > 3 or avg(f1) > 4 order by f1; if $rows != 0 then return -1 endi -sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having (sum(f1) > 3); +sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having (sum(f1) > 3) order by f1; if $rows != 3 then return -1 endi @@ -538,7 +536,7 @@ endi sql_error select avg(f1),count(f1),sum(f1) from tb1 group by f1 having (sum(*) > 3); -sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having (sum(tb1.f1) > 3); +sql select avg(f1),count(f1),sum(f1) from tb1 group by f1 having (sum(tb1.f1) > 3) order by f1; if $rows != 3 then return -1 endi @@ -570,7 +568,7 @@ if $data22 != 8 then return -1 endi -sql select avg(f1),count(tb1.*),sum(f1) from tb1 group by f1 having (sum(tb1.f1) > 3); +sql select avg(f1),count(tb1.*),sum(f1) from tb1 group by f1 having (sum(tb1.f1) > 3) order by f1; if $rows != 3 then return -1 endi @@ -602,7 +600,7 @@ if $data22 != 8 then return -1 endi -sql select avg(f1),count(tb1.*),sum(f1),stddev(f1),stddev(f1) from tb1 group by f1; +sql select avg(f1),count(tb1.*),sum(f1),stddev(f1),stddev(f1) from tb1 group by f1 order by f1; if $rows != 4 then return -1 endi @@ -667,12 +665,12 @@ if $data34 != 0.000000000 then return -1 endi -sql select avg(f1),count(tb1.*),sum(f1),stddev(f1) from tb1 group by f1 having (stddev(tb1.f1) > 3); +sql select avg(f1),count(tb1.*),sum(f1),stddev(f1) from tb1 group by f1 having (stddev(tb1.f1) > 3) order by f1; if $rows != 0 then return -1 endi -sql select avg(f1),count(tb1.*),sum(f1),stddev(f1) from tb1 group by f1 having (stddev(tb1.f1) < 1); +sql select avg(f1),count(tb1.*),sum(f1),stddev(f1) from tb1 group by f1 having (stddev(tb1.f1) < 1) order by f1; if $rows != 4 then return -1 endi @@ -736,7 +734,7 @@ sql_error select avg(f1),count(tb1.*),sum(f1),stddev(f1) from tb1 group by f1 ha sql_error select avg(f1),count(tb1.*),sum(f1),stddev(f1),LEASTSQUARES(f1,1,1) from tb1 group by f1 having LEASTSQUARES(f1,1,1) > 2; -sql select avg(f1),count(tb1.*),sum(f1),stddev(f1),LEASTSQUARES(f1,1,1) from tb1 group by f1 having sum(f1) > 2; +sql select avg(f1),count(tb1.*),sum(f1),stddev(f1),LEASTSQUARES(f1,1,1) from tb1 group by f1 having sum(f1) > 2 order by f1; if $rows != 3 then return -1 endi @@ -777,7 +775,7 @@ if $data23 != 0.000000000 then return -1 endi -sql select avg(f1),count(tb1.*),sum(f1),stddev(f1) from tb1 group by f1 having min(f1) > 2; +sql select avg(f1),count(tb1.*),sum(f1),stddev(f1) from tb1 group by f1 having min(f1) > 2 order by f1; if $rows != 2 then return -1 endi @@ -806,7 +804,7 @@ if $data13 != 0.000000000 then return -1 endi -sql select avg(f1),count(tb1.*),sum(f1),stddev(f1),min(f1) from tb1 group by f1 having min(f1) > 2; +sql select avg(f1),count(tb1.*),sum(f1),stddev(f1),min(f1) from tb1 group by f1 having min(f1) > 2 order by f1; if $rows != 2 then return -1 endi @@ -841,7 +839,7 @@ if $data14 != 4 then return -1 endi -sql select avg(f1),count(tb1.*),sum(f1),stddev(f1),min(f1) from tb1 group by f1 having max(f1) > 2; +sql select avg(f1),count(tb1.*),sum(f1),stddev(f1),min(f1) from tb1 group by f1 having max(f1) > 2 order by f1; if $rows != 2 then return -1 endi @@ -876,7 +874,7 @@ if $data14 != 4 then return -1 endi -sql select avg(f1),count(tb1.*),sum(f1),stddev(f1),min(f1),max(f1) from tb1 group by f1 having max(f1) != 2; +sql select avg(f1),count(tb1.*),sum(f1),stddev(f1),min(f1),max(f1) from tb1 group by f1 having max(f1) != 2 order by f1; if $rows != 3 then return -1 endi @@ -935,7 +933,7 @@ if $data25 != 4 then return -1 endi -sql select avg(f1),count(tb1.*),sum(f1),stddev(f1),min(f1),max(f1) from tb1 group by f1 having first(f1) != 2; +sql select avg(f1),count(tb1.*),sum(f1),stddev(f1),min(f1),max(f1) from tb1 group by f1 having first(f1) != 2 order by f1; if $rows != 3 then return -1 endi @@ -996,7 +994,7 @@ endi -sql select avg(f1),count(tb1.*),sum(f1),stddev(f1),min(f1),max(f1),first(f1) from tb1 group by f1 having first(f1) != 2; +sql select avg(f1),count(tb1.*),sum(f1),stddev(f1),min(f1),max(f1),first(f1) from tb1 group by f1 having first(f1) != 2 order by f1; if $rows != 3 then return -1 endi @@ -1078,7 +1076,7 @@ sql_error select avg(f1),count(tb1.*),sum(f1),stddev(f1),min(f1),max(f1),first(f sql_error select PERCENTILE(f1) from tb1 group by f1 having sum(f1) > 1; -sql select PERCENTILE(f1,20) from tb1 group by f1 having sum(f1) = 4; +sql select PERCENTILE(f1,20) from tb1 group by f1 having sum(f1) = 4 order by f1; if $rows != 1 then return -1 endi @@ -1086,7 +1084,7 @@ if $data00 != 2.000000000 then return -1 endi -sql select aPERCENTILE(f1,20) from tb1 group by f1 having sum(f1) > 1; +sql select aPERCENTILE(f1,20) from tb1 group by f1 having sum(f1) > 1 order by f1; if $rows != 4 then return -1 endi @@ -1103,7 +1101,7 @@ if $data30 != 4.000000000 then return -1 endi -sql select aPERCENTILE(f1,20) from tb1 group by f1 having apercentile(f1,1) > 1; +sql select aPERCENTILE(f1,20) from tb1 group by f1 having apercentile(f1,1) > 1 order by f1; if $rows != 3 then return -1 endi @@ -1117,7 +1115,7 @@ if $data20 != 4.000000000 then return -1 endi -sql select aPERCENTILE(f1,20) from tb1 group by f1 having apercentile(f1,1) > 1 and apercentile(f1,1) < 50; +sql select aPERCENTILE(f1,20) from tb1 group by f1 having apercentile(f1,1) > 1 and apercentile(f1,1) < 50 order by f1; if $rows != 3 then return -1 endi @@ -1131,7 +1129,7 @@ if $data20 != 4.000000000 then return -1 endi -sql select aPERCENTILE(f1,20) from tb1 group by f1 having apercentile(f1,1) > 1 and apercentile(f1,1) < 3; +sql select aPERCENTILE(f1,20) from tb1 group by f1 having apercentile(f1,1) > 1 and apercentile(f1,1) < 3 order by f1; if $rows != 1 then return -1 endi @@ -1139,7 +1137,7 @@ if $data00 != 2.000000000 then return -1 endi -sql select aPERCENTILE(f1,20) from tb1 group by f1 having apercentile(f1,1) > 1 and apercentile(f1,3) < 3; +sql select aPERCENTILE(f1,20) from tb1 group by f1 having apercentile(f1,1) > 1 and apercentile(f1,3) < 3 order by f1; if $rows != 1 then return -1 endi @@ -1161,12 +1159,12 @@ sql_error select avg(f1),diff(f1) from tb1 group by f1 having avg(f1) > 0; sql_error select avg(f1),diff(f1) from tb1 group by f1 having spread(f2) > 0; -sql select avg(f1) from tb1 group by f1 having spread(f2) > 0; +sql select avg(f1) from tb1 group by f1 having spread(f2) > 0 order by f1; if $rows != 0 then return -1 endi -sql select avg(f1) from tb1 group by f1 having spread(f2) = 0; +sql select avg(f1) from tb1 group by f1 having spread(f2) = 0 order by f1; if $rows != 4 then return -1 endi @@ -1183,7 +1181,7 @@ if $data30 != 4.000000000 then return -1 endi -sql select avg(f1),spread(f2) from tb1 group by f1; +sql select avg(f1),spread(f2) from tb1 group by f1 order by f1; if $rows != 4 then return -1 endi @@ -1212,7 +1210,7 @@ if $data31 != 0.000000000 then return -1 endi -sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) = 0; +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) = 0 order by f1; if $rows != 4 then return -1 endi @@ -1265,7 +1263,7 @@ if $data33 != 0.000000000 then return -1 endi -sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) != 0; +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) != 0 order by f1; if $rows != 0 then return -1 endi @@ -1301,12 +1299,12 @@ sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) > id1 and sum(f1) > 1; -sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) > 2 and sum(f1) > 1; +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) > 2 and sum(f1) > 1 order by f1; if $rows != 0 then return -1 endi -sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) = 0 and sum(f1) > 1; +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) = 0 and sum(f1) > 1 order by f1; if $rows != 4 then return -1 endi @@ -1359,7 +1357,7 @@ if $data33 != 0.000000000 then return -1 endi -sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) = 0 and avg(f1) > 1; +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having spread(f1) = 0 and avg(f1) > 1 order by f1; if $rows != 3 then return -1 endi @@ -1410,7 +1408,7 @@ sql_error select avg(f1),spread(f1,f2,tb1.f1),avg(id1) from tb1 group by id1 hav sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by id1 having avg(f1) > 0; -sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having avg(f1) > 0 and avg(f1) = 3; +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having avg(f1) > 0 and avg(f1) = 3 order by f1; if $rows != 1 then return -1 endi @@ -1430,7 +1428,7 @@ endi #sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by f1 having avg(f1) < 0 and avg(f1) = 3; sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 group by id1 having avg(f1) < 2; -sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f1 > 0 group by f1 having avg(f1) > 0; +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f1 > 0 group by f1 having avg(f1) > 0 order by f1; if $rows != 4 then return -1 endi @@ -1483,7 +1481,7 @@ if $data33 != 0.000000000 then return -1 endi -sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f1 > 2 group by f1 having avg(f1) > 0; +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f1 > 2 group by f1 having avg(f1) > 0 order by f1; if $rows != 2 then return -1 endi @@ -1512,7 +1510,7 @@ if $data13 != 0.000000000 then return -1 endi -sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 2 group by f1 having avg(f1) > 0; +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 2 group by f1 having avg(f1) > 0 order by f1; if $rows != 2 then return -1 endi @@ -1541,7 +1539,7 @@ if $data13 != 0.000000000 then return -1 endi -sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f3 > 2 group by f1 having avg(f1) > 0; +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f3 > 2 group by f1 having avg(f1) > 0 order by f1; if $rows != 2 then return -1 endi @@ -1570,7 +1568,7 @@ if $data13 != 0.000000000 then return -1 endi -sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 3 group by f1 having avg(f1) > 0; +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 3 group by f1 having avg(f1) > 0 order by f1; if $rows != 1 then return -1 endi @@ -1595,7 +1593,7 @@ sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 3 group by f1 sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 3 group by f1 having avg(f9) > 0; -sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 3 group by f1 having count(f9) > 0; +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 3 group by f1 having count(f9) > 0 order by f1; if $rows != 1 then return -1 endi @@ -1614,7 +1612,7 @@ endi sql_error select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 3 group by f1 having last(f9) > 0; -sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 3 group by f1 having last(f2) > 0; +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 3 group by f1 having last(f2) > 0 order by f1; if $rows != 1 then return -1 endi @@ -1631,7 +1629,7 @@ if $data03 != 0.000000000 then return -1 endi -sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 3 group by f1 having last(f3) > 0; +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 3 group by f1 having last(f3) > 0 order by f1; if $rows != 1 then return -1 endi @@ -1648,7 +1646,7 @@ if $data03 != 0.000000000 then return -1 endi -sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 1 group by f1 having last(f3) > 0; +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 1 group by f1 having last(f3) > 0 order by f1; if $rows != 3 then return -1 endi @@ -1689,7 +1687,7 @@ if $data23 != 0.000000000 then return -1 endi -sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 1 group by f1 having last(f4) > 0; +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 1 group by f1 having last(f4) > 0 order by f1; if $rows != 3 then return -1 endi @@ -1730,7 +1728,7 @@ if $data23 != 0.000000000 then return -1 endi -sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 1 group by f1 having last(f5) > 0; +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 1 group by f1 having last(f5) > 0 order by f1; if $rows != 3 then return -1 endi @@ -1771,7 +1769,7 @@ if $data23 != 0.000000000 then return -1 endi -sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 1 group by f1 having last(f6) > 0; +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 1 group by f1 having last(f6) > 0 order by f1; if $rows != 3 then return -1 endi @@ -1823,7 +1821,7 @@ sql_error select avg(f1),spread(f1,f2,tb1.f1),f1,f6 from tb1 where f2 > 1 group sql_error select avg(f1),spread(f1,f2,tb1.f1),f1,f6 from tb1 where f2 > 1 group by id1 having last(f6) > 0; -sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 1 and f2 < 4 group by f1 having last(f6) > 0; +sql select avg(f1),spread(f1,f2,tb1.f1) from tb1 where f2 > 1 and f2 < 4 group by f1 having last(f6) > 0 order by f1; if $rows != 2 then return -1 endi diff --git a/tests/tsim/src/simSystem.c b/tests/tsim/src/simSystem.c index 1c751f290a..f2fefb903d 100644 --- a/tests/tsim/src/simSystem.c +++ b/tests/tsim/src/simSystem.c @@ -99,6 +99,7 @@ SScript *simProcessCallOver(SScript *script) { } if (simScriptPos == -1) return NULL; + if (!simExecSuccess) return NULL; return simScriptList[simScriptPos]; } else {