未验证 提交 500a1ffa 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #15261 from taosdata/fix/tsim

test: restore 2.0 case
......@@ -110,9 +110,9 @@
./test.sh -f tsim/parser/fourArithmetic-basic.sim
# jira ./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_child.sim
## ./test.sh -f tsim/parser/having.sim
# jira ./test.sh -f tsim/parser/groupby.sim
# jira ./test.sh -f tsim/parser/having_child.sim
# jira ./test.sh -f tsim/parser/having.sim
./test.sh -f tsim/parser/import_commit1.sim
./test.sh -f tsim/parser/import_commit2.sim
./test.sh -f tsim/parser/import_commit3.sim
......@@ -137,37 +137,36 @@
## ./test.sh -f tsim/parser/limit_stb.sim
## ./test.sh -f tsim/parser/limit_tb.sim
## ./test.sh -f tsim/parser/line_insert.sim
# ./test.sh -f tsim/parser/mixed_blocks.sim
# ./test.sh -f tsim/parser/nchar.sim
./test.sh -f tsim/parser/mixed_blocks.sim
./test.sh -f tsim/parser/nchar.sim
# ./test.sh -f tsim/parser/nestquery.sim
# ./test.sh -f tsim/parser/null_char.sim
## ./test.sh -f tsim/parser/precision_ns.sim
# ./test.sh -f tsim/parser/projection_limit_offset.sim
## ./test.sh -f tsim/parser/regex.sim
# ./test.sh -f tsim/parser/repeatAlter.sim
# ./test.sh -f tsim/parser/selectResNum.sim
# ./test.sh -f tsim/parser/select_across_vnodes.sim
# ./test.sh -f tsim/parser/select_distinct_tag.sim
# ./test.sh -f tsim/parser/select_from_cache_disk.sim
# ./test.sh -f tsim/parser/select_with_tags.sim
# ./test.sh -f tsim/parser/set_tag_vals.sim
# ./test.sh -f tsim/parser/single_row_in_tb.sim
# ./test.sh -f tsim/parser/sliding.sim
# ./test.sh -f tsim/parser/slimit_alter_tags.sim
# ./test.sh -f tsim/parser/slimit.sim
# ./test.sh -f tsim/parser/slimit1.sim
# jira ./test.sh -f tsim/parser/null_char.sim
./test.sh -f tsim/parser/precision_ns.sim
./test.sh -f tsim/parser/projection_limit_offset.sim
./test.sh -f tsim/parser/regex.sim
./test.sh -f tsim/parser/select_across_vnodes.sim
./test.sh -f tsim/parser/select_distinct_tag.sim
./test.sh -f tsim/parser/select_from_cache_disk.sim
# jira ./test.sh -f tsim/parser/select_with_tags.sim
./test.sh -f tsim/parser/selectResNum.sim
# jira ./test.sh -f tsim/parser/set_tag_vals.sim
./test.sh -f tsim/parser/single_row_in_tb.sim
# jira ./test.sh -f tsim/parser/sliding.sim
# jira ./test.sh -f tsim/parser/slimit_alter_tags.sim
# jira ./test.sh -f tsim/parser/slimit.sim
# jira ./test.sh -f tsim/parser/slimit1.sim
./test.sh -f tsim/parser/stableOp.sim
# ./test.sh -f tsim/parser/tags_dynamically_specifiy.sim
# ./test.sh -f tsim/parser/tags_filter.sim
# jira ./test.sh -f tsim/parser/tags_dynamically_specifiy.sim
# jira ./test.sh -f tsim/parser/tags_filter.sim
./test.sh -f tsim/parser/tbnameIn.sim
./test.sh -f tsim/parser/timestamp.sim
./test.sh -f tsim/parser/top_groupby.sim
./test.sh -f tsim/parser/topbot.sim
# ./test.sh -f tsim/parser/udf_dll_stable.sim
# ./test.sh -f tsim/parser/udf_dll.sim
# ./test.sh -f tsim/parser/udf.sim
# jira ./test.sh -f tsim/parser/udf_dll_stable.sim
# jira ./test.sh -f tsim/parser/udf_dll.sim
# jira ./test.sh -f tsim/parser/udf.sim
# ./test.sh -f tsim/parser/union.sim
# ./test.sh -f tsim/parser/where.sim
# jira ./test.sh -f tsim/parser/where.sim
# ---- query
./test.sh -f tsim/query/interval.sim
......@@ -426,18 +425,18 @@
./test.sh -f tsim/tag/bool_binary.sim
./test.sh -f tsim/tag/bool_int.sim
./test.sh -f tsim/tag/bool.sim
# ./test.sh -f tsim/tag/change.sim
# ./test.sh -f tsim/tag/column.sim
# ./test.sh -f tsim/tag/commit.sim
# ./test.sh -f tsim/tag/create.sim
# ./test.sh -f tsim/tag/delete.sim
# jira ./test.sh -f tsim/tag/change.sim
# jira ./test.sh -f tsim/tag/column.sim
# jira ./test.sh -f tsim/tag/commit.sim
# jira ./test.sh -f tsim/tag/create.sim
# jira /test.sh -f tsim/tag/delete.sim
# jira ./test.sh -f tsim/tag/double.sim
# ./test.sh -f tsim/tag/filter.sim
# jira ./test.sh -f tsim/tag/filter.sim
# jira ./test.sh -f tsim/tag/float.sim
./test.sh -f tsim/tag/int_binary.sim
./test.sh -f tsim/tag/int_float.sim
./test.sh -f tsim/tag/int.sim
# ./test.sh -f tsim/tag/set.sim
# jira ./test.sh -f tsim/tag/set.sim
./test.sh -f tsim/tag/smallint.sim
./test.sh -f tsim/tag/tinyint.sim
......
......@@ -54,7 +54,6 @@ sql show databases
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
......@@ -76,7 +75,7 @@ while $x < $rowNum
endw
#### query a STable and using where clause to filter out all the data from tb2 and make the query only return first/last of tb1
sql select first(ts,c1), last(ts,c1), spread(c1) from $stb where c1 > 0 group by t1
sql select first(ts,c1), last(ts,c1), spread(c1), t1 from $stb where c1 > 0 group by t1
if $rows != 1 then
return -1
endi
......@@ -99,7 +98,7 @@ if $data05 != 1 then
return -1
endi
sql select max(c1), min(c1), sum(c1), avg(c1), count(c1) from $stb where c1 > 0 group by t1
sql select max(c1), min(c1), sum(c1), avg(c1), count(c1), t1 from $stb where c1 > 0 group by t1
if $rows != 1 then
return -1
endi
......@@ -149,7 +148,6 @@ sql insert into t2 values('2020-1-1 1:5:1', 99);
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 select ts from m1 where ts='2020-1-1 1:5:1'
......
......@@ -228,7 +228,8 @@ sql_error select avg(tbcol) from $mt where tbcol1 = 1 group by tgcol
sql_error select sum(tbcol) from $mt where tbcol1 = 1 group by tgcol
sql_error select min(tbcol) from $mt where tbcol1 = 1 group by tgcol
sql_error select max(tbcol) from $mt where tbcol1 = 1 group by tgcol
sql select first(tbcol) from $mt where tbcol1 = 1 group by tgcol
sql select first(tbcol), tgcol from $mt where tbcol1 = 1 group by tgcol order by tgcol
if $rows != 2 then
return -1
endi
......@@ -244,7 +245,8 @@ endi
if $data11 != 1 then
return -1
endi
sql select last(tbcol) from $mt where tbcol1 = 1 group by tgcol
sql select last(tbcol), tgcol from $mt where tbcol1 = 1 group by tgcol order by tgcol
if $rows != 2 then
return -1
endi
......@@ -265,6 +267,7 @@ sql create table stbb (ts timestamp, c1 nchar(5)) tags (t1 int)
sql create table tbb1 using stbb tags(1)
sql insert into tbb1 values ('2018-09-17 09:00:00', '涛思')
sql insert into tbb1 values ('2018-09-17 09:00:01', 'insrt')
sql select * from tbb1 order by ts asc
if $rows != 2 then
return -1
......
......@@ -78,6 +78,8 @@ endi
#### case 1: tag NULL, or 'NULL'
sql create table mt2 (ts timestamp, col1 int, col3 float, col5 binary(8), col6 bool, col9 nchar(8)) tags (tag1 binary(8), tag2 nchar(8), tag3 int, tag5 bool)
sql create table st2 using mt2 tags (NULL, 'NULL', 102, 'true')
sql insert into st2 (ts, col1) values(now, 1)
sql select tag1, tag2, tag3, tag5 from st2
if $rows != 1 then
return -1
......@@ -115,6 +117,7 @@ if $rows != 0 then
endi
sql create table st3 using mt2 tags (NULL, 'ABC', 103, 'FALSE')
sql insert into st3 (ts, col1) values(now, 1)
sql select tag1, tag2, tag3, tag5 from st3
if $rows != 1 then
return -1
......@@ -134,9 +137,10 @@ if $data03 != 0 then
endi
### bool:
sql_error create table stx using mt2 tags ('NULL', '123aBc', 104, '123')
sql_error create table sty using mt2 tags ('NULL', '123aBc', 104, 'xtz')
sql create table stx using mt2 tags ('NULL', '123aBc', 104, '123')
sql create table sty using mt2 tags ('NULL', '123aBc', 104, 'xtz')
sql create table st4 using mt2 tags ('NULL', '123aBc', 104, 'NULL')
sql insert into st4 (ts, col1) values(now, 1)
sql select tag1,tag2,tag3,tag5 from st4
if $rows != 1 then
return -1
......@@ -150,12 +154,13 @@ endi
if $data02 != 104 then
return -1
endi
if $data03 != NULL then
if $data03 != 0 then
print ==6== expect: NULL, actually: $data03
return -1
endi
sql create table st5 using mt2 tags ('NULL', '123aBc', 105, NULL)
sql insert into st5 (ts, col1) values(now, 1)
sql select tag1,tag2,tag3,tag5 from st5
if $rows != 1 then
return -1
......@@ -173,8 +178,6 @@ if $data03 != NULL then
return -1
endi
#### case 2: dynamic create table using super table when insert into
sql create table mt3 (ts timestamp, col1 int, col3 float, col5 binary(8), col6 bool, col9 nchar(8)) tags (tag1 binary(8), tag2 nchar(8), tag3 int, tag5 bool)
sql_error insert into st31 using mt3 tags (NULL, 'NULL', 102, 'true') values (now+1s, 31, 31, 'bin_31', '123', 'nchar_31')
......@@ -182,10 +185,10 @@ sql_error insert into st32 using mt3 tags (NULL, 'ABC', 103, 'FALSE') values
sql_error insert into st33 using mt3 tags ('NULL', '123aBc', 104, 'NULL') values (now+3s, 33, 33, 'bin_33', 'false123', 'nchar_33')
sql_error insert into st34 using mt3 tags ('NULL', '123aBc', 105, NULL) values (now+4s, 34, 34.12345, 'bin_34', 'true123', 'nchar_34')
#### case 3: set tag value
sql create table mt4 (ts timestamp, c1 int) tags (tag_binary binary(16), tag_nchar nchar(16), tag_int int, tag_bool bool, tag_float float, tag_double double)
sql create table st41 using mt4 tags ("beijing", 'nchar_tag', 100, false, 9.12345, 7.123456789)
sql insert into st41 (ts, c1) values(now, 1)
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
if $rows != 1 then
return -1
......@@ -245,7 +248,7 @@ endi
################### nchar
sql alter table st41 set tag tag_nchar = "��˼����"
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
#sleep 100
#if $data01 != ��˼���� then
# print ==== expect ��˼����, actually $data01
# return -1
......
......@@ -48,8 +48,6 @@ while $x < $rowNum
$x = $x + 1
endw
sleep 100
print =============== step2: select count(*) from tables
$i = 0
$tb = $tbPrefix . $i
......@@ -103,7 +101,7 @@ sql select count(*) from $mt interval(100000000b) sliding(100000000b)
print =============== clear
sql drop database $db
sql show databases
if $rows != 0 then
if $rows != 2 then
return -1
endi
......
......@@ -271,14 +271,14 @@ endi
#[tbase-695]
sql select ts,tbname from group_mt0 where ts>='1970-01-01 8:1:40' and ts<'1970-1-1 8:1:45' and c1<99999999 limit 100000 offset 5000
print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09
print ===> $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19
print ===> $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29
print ===> $data30 $data31 $data32 $data33 $data34 $data35 $data36 $data37 $data38 $data39
if $row != 35000 then
return -1
endi
if $data00 != @70-01-01 08:01:40.000@ then
return -1
endi
#=================================parse error sql==========================================
sql_error select ts,tbname from group_mt0 order by ts desc limit 100 offset -1;
sql_error select ts,tbname from group_mt0 order by c1 asc limit 100 offset -1;
......@@ -287,13 +287,13 @@ sql_error select ts,tbname from group_mt0 order by ts desc slimit -1, 100;
sql_error select ts,tbname from group_mt0 order by ts desc slimit 1 soffset 1;
#================================functions applys to sql===================================
sql_error select first(t1) from group_mt0;
sql_error select last(t1) from group_mt0;
sql_error select min(t1) from group_mt0;
sql_error select max(t1) from group_mt0;
sql_error select top(t1, 20) from group_mt0;
sql_error select bottom(t1, 20) from group_mt0;
sql_error select avg(t1) from group_mt0;
sql select first(t1) from group_mt0;
sql select last(t1) from group_mt0;
sql select min(t1) from group_mt0;
sql select max(t1) from group_mt0;
sql select top(t1, 20) from group_mt0;
sql select bottom(t1, 20) from group_mt0;
sql select avg(t1) from group_mt0;
sql_error select percentile(t1, 50) from group_mt0;
sql_error select percentile(t1, 50) from group_mt0;
sql_error select percentile(t1, 50) from group_mt0;
......@@ -309,7 +309,7 @@ endi
#====================================tbase-716==============================================
print tbase-716
sql_error select count(*) from group_tb0 where ts in ('2016-1-1 12:12:12');
sql select count(*) from group_tb0 where ts in ('2016-1-1 12:12:12');
sql_error select count(*) from group_tb0 where ts < '12:12:12';
#===============================sql for twa==========================================
......@@ -345,7 +345,7 @@ if $rows != 0 then
return -1
endi
sql select count(*),first(k),last(k) from m1 where tbname in ('tm0') interval(1s) order by ts desc;
sql select _wstart, count(*),first(k),last(k) from m1 where tbname in ('tm0') interval(1s) order by _wstart desc;
if $row != 5 then
return -1
endi
......@@ -374,6 +374,7 @@ if $data13 != NULL then
return -1
endi
print =============tbase-1324
sql select a, k-k from m1
if $row != 8 then
......@@ -384,8 +385,7 @@ sql select diff(k) from tm0
if $row != 3 then
return -1
endi
if $data21 != -1 then
if $data20 != -1 then
return -1
endi
......@@ -395,20 +395,19 @@ sql_error select * from 1;
sql_error select k+k;
sql_error select k+1;
sql_error select abc();
sql_error select 1 where 1=2;
sql_error select 1 limit 1;
sql_error select 1 slimit 1;
sql_error select 1 interval(1h);
sql select 1 where 1=2;
sql select 1 limit 1;
sql select 1 slimit 1;
sql select 1 interval(1h);
sql_error select count(*);
sql_error select sum(k);
sql_error select 'abc';
sql select 'abc';
sql_error select k+1,sum(k) from tm0;
sql_error select k, sum(k) from tm0;
sql_error select k, sum(k)+1 from tm0;
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
......
......@@ -18,12 +18,15 @@ sql create table $ct1_name using $st_name tags('taosdata1')
sql create table $ct2_name using $st_name tags('taosdata2')
sql create table not_match using $st_name tags('NOTMATCH')
sql insert into $ct1_name values(now, 'this is engine')
sql insert into $ct2_name values(now, 'this is app egnine')
sql insert into not_match values (now + 1s, '1234')
sql select tbname from $st_name where tbname match '.*'
if $rows != 3 then
return -1
endi
sql select tbname from $st_name where tbname match '^ct[[:digit:]]'
if $rows != 2 then
return -1
......@@ -54,9 +57,6 @@ if $rows != 1 then
return -1
endi
sql insert into $ct1_name values(now, 'this is engine')
sql insert into $ct2_name values(now, 'this is app egnine')
sql select c1b from $st_name where c1b match 'engine'
if $data00 != @this is engine@ then
return -1
......@@ -66,12 +66,11 @@ if $rows != 1 then
return -1
endi
sql select c1b from $st_name where c1b nmatch 'engine'
sql select c1b from $st_name where c1b nmatch 'engine' order by ts
if $data00 != @this is app egnine@ then
return -1
endi
if $rows != 1 then
if $rows != 2 then
return -1
endi
......@@ -96,8 +95,8 @@ sql_error select * from wrong_type where c5 match '.*'
sql_error select * from wrong_type where c5 nmatch '.*'
sql_error select * from wrong_type where c6 match '.*'
sql_error select * from wrong_type where c6 nmatch '.*'
sql_error select * from wrong_type where c7 match '.*'
sql_error select * from wrong_type where c7 nmatch '.*'
sql select * from wrong_type where c7 match '.*'
sql select * from wrong_type where c7 nmatch '.*'
sql_error select * from wrong_type where t1 match '.*'
sql_error select * from wrong_type where t1 nmatch '.*'
sql_error select * from wrong_type where t2 match '.*'
......@@ -110,9 +109,7 @@ sql_error select * from wrong_type where t5 match '.*'
sql_error select * from wrong_type where t5 nmatch '.*'
sql_error select * from wrong_type where t6 match '.*'
sql_error select * from wrong_type where t6 nmatch '.*'
sql_error select * from wrong_type where t7 match '.*'
sql_error select * from wrong_type where t7 nmatch '.*'
sql select * from wrong_type where t7 match '.*'
sql select * from wrong_type where t7 nmatch '.*'
system sh/exec.sh -n dnode1 -s stop -x SIGINT
......@@ -20,7 +20,7 @@ $stb = $stbPrefix . $i
sql drop database $db -x step1
step1:
sql create database $db cache 16
sql create database $db
print ====== create tables
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)
......@@ -114,12 +114,8 @@ endw
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
sleep 100
sql connect
sleep 100
sql use $db
##### repeat test after server restart
......
......@@ -17,7 +17,7 @@ $db = $dbPrefix
$stb = $stbPrefix
sql drop database if exists $db
sql create database $db
sql create database $db vgroups 10
sql use $db
print ====== create tables
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)
......@@ -72,7 +72,7 @@ endi
sql drop database $db
sql show databases
if $rows != 0 then
if $rows != 2 then
return -1
endi
......
......@@ -27,6 +27,7 @@ $ts = $ts0
while $i < $tbNum
$tb = $tbPrefix . $i
sql create table $tb using $stb tags( $i , 0 )
sql insert into $tb (ts, c1) values (now, 1);
$i = $i + 1
endw
......@@ -50,7 +51,7 @@ sql_error select distinct t1, t2 from &stb
sql drop database $db
sql show databases
if $rows != 0 then
if $rows != 2 then
return -1
endi
......
......@@ -31,17 +31,13 @@ sql insert into $tb values ('2018-09-17 09:00:00.030', 3)
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
sql use $db
# generate some data in cache
sql insert into $tb values ('2018-09-17 09:00:04.000', 4)
sql insert into $tb values ('2018-09-17 09:00:04.010', 5)
sql select count(*) from $stb interval(1s) group by t1
sql select _wstart, count(*), t1 from $stb partition by t1 interval(1s) order by _wstart
if $rows != 2 then
return -1
endi
......
......@@ -62,9 +62,6 @@ while $i < $tbNum
endw
sleep 100
#======================= only check first table tag, TD-4827
sql select count(*) from $mt where t1 in (0)
if $rows != 1 then
......@@ -178,15 +175,15 @@ if $data03 != @abc15@ then
endi
sql select top(c6, 3) from select_tags_mt0 interval(10a)
sql select top(c3,10) from select_tags_mt0 interval(10a) group by tbname,t1,t2
sql select top(c6, 3) from select_tags_mt0 interval(10a) group by tbname;
sql select top(c3,10) from select_tags_mt0 partition by tbname,t1,t2 interval(10a)
sql select top(c6, 3) from select_tags_mt0 partition by tbname interval(10a)
sql select top(c6, 10) from select_tags_mt0 interval(10a);
if $rows != 12800 then
return -1
endi
sql select top(c1, 80), tbname, t1, t2 from select_tags_mt0;
sql select _rowts, top(c1, 80), tbname, t1, t2 from select_tags_mt0;
if $rows != 80 then
return -1
endi
......
......@@ -55,10 +55,8 @@ while $i < $tbNum
$i = $i + 1
endw
print ====== tables created
sleep 500
print ====== tables created
sql show tables
if $rows != $tbNum then
return -1
......@@ -74,12 +72,16 @@ while $i < $tbNum
sql insert into $tb (ts, c1) values (now-100a, $i )
sql alter table $tb set tag t3 = $i
sql insert into $tb (ts, c1) values (now, $i )
sql alter table $tb set tag t4 = $i
$name = ' . $i
$name = $name . '
sql alter table $tb set tag t4 = $name
$i = $i + 1
endw
print ================== all tags have been changed!
sql_error select tbname from $stb where t3 = 'NULL'
sql reset query cache
sql select tbname from $stb where t3 = 'NULL'
print ================== set tag to NULL
sql create table stb1_tg (ts timestamp, c1 int) tags(t1 int,t2 bigint,t3 double,t4 float,t5 smallint,t6 tinyint)
......@@ -142,7 +144,9 @@ sql alter table tb1_tg2 set tag t1 = false
sql alter table tb1_tg2 set tag t2 = 'binary2'
sql alter table tb1_tg2 set tag t3 = '涛思'
sql reset query cache
sql select * from stb1_tg
print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09
if $rows != 1 then
return -1
endi
......@@ -164,7 +168,9 @@ endi
if $data07 != -6 then
return -1
endi
sql select * from stb2_tg
print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09
if $data02 != 0 then
return -1
endi
......@@ -185,7 +191,9 @@ sql alter table tb1_tg2 set tag t1 = NULL
sql alter table tb1_tg2 set tag t2 = NULL
sql alter table tb1_tg2 set tag t3 = NULL
sql reset query cache
sql select * from stb1_tg
print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09
if $rows != 1 then
return -1
endi
......@@ -207,12 +215,12 @@ endi
if $data07 != NULL then
return -1
endi
sql select * from stb2_tg
print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09
if $data02 != NULL then
return -1
endi
print $data03
if $data03 != NULL then
return -1
endi
......
sleep 100
sql connect
$dbPrefix = sr_db
......@@ -113,7 +112,7 @@ if $data02 != 2 then
endi
#### query a STable and using where clause
sql select first(ts,c1), last(ts,c1), spread(c1) from $stb where ts >= $ts0 and ts < '2018-09-20 00:00:00.000' group by t1
sql select first(ts,c1), last(ts,c1), spread(c1), t1 from $stb where ts >= $ts0 and ts < '2018-09-20 00:00:00.000' group by t1
if $rows != 1 then
return -1
endi
......@@ -137,7 +136,7 @@ if $data05 != 1 then
return -1
endi
sql select first(c1), last(c1) from $stb where ts >= $ts0 and ts < '2018-09-20 00:00:00.000' interval(1d) group by t1
sql select _wstart, first(c1), last(c1) from sr_stb where ts >= 1537146000000 and ts < '2018-09-20 00:00:00.000' partition by t1 interval(1d)
if $rows != 1 then
return -1
endi
......@@ -151,7 +150,7 @@ if $data02 != 1 then
return -1
endi
sql select max(c1), min(c1), sum(c1), avg(c1), count(c1) from $stb where c1 > 0 group by t1
sql select max(c1), min(c1), sum(c1), avg(c1), count(c1), t1 from $stb where c1 > 0 group by t1
if $rows != 1 then
return -1
endi
......@@ -174,7 +173,7 @@ if $data05 != 1 then
return -1
endi
sql select first(ts,c1), last(ts,c1) from $tb1 where ts >= $ts0 and ts < '2018-09-20 00:00:00.000' interval(1d)
sql select _wstart, first(ts,c1), last(ts,c1) from $tb1 where ts >= $ts0 and ts < '2018-09-20 00:00:00.000' interval(1d)
if $rows != 1 then
return -1
endi
......
......@@ -58,8 +58,6 @@ while $i < $tbNum
$tstart = 946656000000
endw
sleep 100
$i1 = 1
$i2 = 0
......@@ -76,425 +74,355 @@ $ts1 = $tb1 . .ts
$ts2 = $tb2 . .ts
print ===============================interval_sliding query
sql select count(*) from sliding_tb0 interval(30s) sliding(30s);
sql select _wstart, count(*) from sliding_tb0 interval(30s) sliding(30s);
if $row != 10 then
return -1
endi
if $data00 != @00-01-01 00:00:00.000@ then
return -1
endi
if $data01 != 1000 then
return -1
endi
if $data10 != @00-01-01 00:00:30.000@ then
return -1
endi
if $data11 != 1000 then
return -1
endi
sql select stddev(c1) from sliding_tb0 interval(10a) sliding(10a)
sql select _wstart, stddev(c1) from sliding_tb0 interval(10a) sliding(10a);
if $row != 10000 then
return -1
endi
if $data00 != @00-01-01 00:00:00.000@ then
return -1
endi
if $data01 != 0.000000000 then
return -1
endi
if $data90 != @00-01-01 00:00:00.270@ then
return -1
endi
if $data91 != 0.000000000 then
return -1
endi
sql select stddev(c1),count(c2),first(c3),last(c4) from sliding_tb0 interval(10a) sliding(10a) order by ts desc;
sql select _wstart, stddev(c1),count(c2),first(c3),last(c4) from sliding_tb0 interval(10a) sliding(10a) order by _wstart desc;
if $row != 10000 then
return -1
endi
if $data00 != @00-01-01 00:04:59.970@ then
return -1
endi
if $data01 != 0.000000000 then
return -1
endi
if $data02 != 1 then
return -1
endi
if $data03 != 99 then
return -1
endi
if $data04 != 99 then
return -1
endi
if $data90 != @00-01-01 00:04:59.700@ then
return -1
endi
if $data91 != 0.000000000 then
return -1
endi
if $data92 != 1 then
return -1
endi
if $data93 != 90 then
return -1
endi
if $data94 != 90 then
return -1
endi
sql select count(c2),last(c4) from sliding_tb0 interval(30s) sliding(10s) order by ts asc;
sql select _wstart, count(c2),last(c4) from sliding_tb0 interval(30s) sliding(10s) order by _wstart asc;
if $row != 32 then
return -1
endi
if $data00 != @99-12-31 23:59:40.000@ then
print expect 12-31 23:59:40.000, actual: $data00
return -1
endi
if $data01 != 334 then
return -1
endi
if $data02 != 33 then
return -1
endi
sql select count(c2),stddev(c3),first(c4),last(c4) from sliding_tb0 where ts>'2000-01-01 0:0:0' and ts<'2000-1-1 0:0:31' interval(30s) sliding(30s) order by ts asc;
sql select _wstart, count(c2),stddev(c3),first(c4),last(c4) from sliding_tb0 where ts>'2000-01-01 0:0:0' and ts<'2000-1-1 0:0:31' interval(30s) sliding(30s) order by _wstart asc;
if $row != 2 then
return -1
endi
if $data04 != 99 then
return -1
endi
if $data01 != 999 then
return -1
endi
if $data02 != 28.837977152 then
return -1
endi
#interval offset + limit
sql select count(c2), first(c3),stddev(c4) from sliding_tb0 interval(10a) sliding(10a) order by ts desc limit 10 offset 990;
sql select _wstart, count(c2), first(c3),stddev(c4) from sliding_tb0 interval(10a) sliding(10a) order by _wstart desc limit 10 offset 990;
if $row != 10 then
return -1
endi
if $data00 != @00-01-01 00:04:30.270@ then
return -1
endi
if $data01 != 1 then
return -1
endi
if $data02 != 9 then
return -1
endi
if $data03 != 0.000000000 then
return -1
endi
if $data90 != @00-01-01 00:04:30.000@ then
return -1
endi
if $data91 != 1 then
return -1
endi
if $data92 != 0 then
return -1
endi
if $data93 != 0.000000000 then
return -1
endi
#interval offset test
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(30s) order by ts asc limit 1000 offset 1;
sql select _wstart, count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(30s) order by _wstart asc limit 1000 offset 1;
if $row != 9 then
return -1
endi
if $data00 != @00-01-01 00:00:30.000@ then
return -1
endi
if $data01 != 1000 then
return -1
endi
if $data02 != 99 then
return -1
endi
if $data80 != @00-01-01 00:04:30.000@ then
return -1
endi
if $data81 != 1000 then
return -1
endi
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 where ts>'2000-1-1 0:0:0' and ts<'2000-1-1 0:0:31' interval(30s) sliding(30s) order by ts asc limit 1000 offset 0;
sql select _wstart, count(c2),last(c4),stddev(c3) from sliding_tb0 where ts>'2000-1-1 0:0:0' and ts<'2000-1-1 0:0:31' interval(30s) sliding(30s) order by _wstart asc limit 1000 offset 0;
if $row != 2 then
return -1
endi
if $data00 != @00-01-01 00:00:00.000@ then
return -1
endi
if $data01 != 999 then
return -1
endi
if $data02 != 99 then
return -1
endi
if $data03 != 28.837977152 then
return -1
endi
if $data10 != @00-01-01 00:00:30.000@ then
return -1
endi
if $data11 != 34 then
return -1
endi
if $data12 != 33 then
return -1
endi
if $data13 != 9.810708435 then
return -1
endi
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by ts asc limit 100 offset 1;
sql select _wstart, count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by _wstart asc limit 100 offset 1;
if $row != 15 then
return -1
endi
if $data00 != @00-01-01 00:00:00.000@ then
return -1
endi
if $data01 != 1000 then
return -1
endi
if $data02 != 99 then
return -1
endi
if $data03 != 28.866070048 then
return -1
endi
if $data90 != @00-01-01 00:03:00.000@ then
return -1
endi
if $data91 != 1000 then
return -1
endi
if $data92 != 99 then
return -1
endi
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by ts asc limit 100 offset 5;
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by _wstart asc limit 100 offset 5;
if $row != 11 then
return -1
endi
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by ts asc limit 100 offset 6;
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by _wstart asc limit 100 offset 6;
if $row != 10 then
return -1
endi
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by ts asc limit 100 offset 7;
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by _wstart asc limit 100 offset 7;
if $row != 9 then
return -1
endi
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by ts asc limit 100 offset 8;
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by _wstart asc limit 100 offset 8;
if $row != 8 then
return -1
endi
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by ts asc limit 100 offset 9;
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by _wstart asc limit 100 offset 9;
if $row != 7 then
return -1
endi
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by ts asc limit 100 offset 10;
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by _wstart asc limit 100 offset 10;
if $row != 6 then
return -1
endi
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by ts asc limit 100 offset 11;
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by _wstart asc limit 100 offset 11;
if $row != 5 then
return -1
endi
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by ts asc limit 100 offset 12;
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by _wstart asc limit 100 offset 12;
if $row != 4 then
return -1
endi
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by ts asc limit 100 offset 13;
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by _wstart asc limit 100 offset 13;
if $row != 3 then
return -1
endi
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by ts asc limit 100 offset 14;
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by _wstart asc limit 100 offset 14;
if $row != 2 then
return -1
endi
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by ts asc limit 100 offset 15;
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by _wstart asc limit 100 offset 15;
if $row != 1 then
return -1
endi
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by ts asc limit 100 offset 16;
sql select count(c2),last(c4),stddev(c3) from sliding_tb0 interval(30s) sliding(20s) order by _wstart asc limit 100 offset 16;
if $row != 0 then
return -1
endi
sql select count(c2),last(c4),stddev(c3),spread(c3) from sliding_tb0 where c2 = 0 interval(30s) order by ts desc;
sql select _wstart, count(c2),last(c4),stddev(c3),spread(c3) from sliding_tb0 where c2 = 0 interval(30s) order by _wstart desc;
if $row != 10 then
return -1
endi
#00-01-01 00:04:30.000| 10| 0| 0.000000000| 0.000000000|
if $data00 != @00-01-01 00:04:30.000@ then
return -1
endi
if $data01 != 10 then
return -1
endi
if $data02 != 0 then
return -1
endi
if $data03 != 0.000000000 then
return -1
endi
sql select count(c2),last(c4),stddev(c3),spread(c3) from sliding_tb0 where c2 = 0 interval(30s) sliding(20s) order by ts desc limit 1 offset 15;
sql select count(c2),last(c4),stddev(c3),spread(c3) from sliding_tb0 where c2 = 0 interval(30s) sliding(20s) order by _wstart desc limit 1 offset 15;
if $row != 1 then
return -1
endi
sql select count(c2),last(c4),stddev(c3),spread(c3) from sliding_tb0 where c2 = 0 interval(30s) sliding(20s) order by ts desc limit 1 offset 16;
sql select count(c2),last(c4),stddev(c3),spread(c3) from sliding_tb0 where c2 = 0 interval(30s) sliding(20s) order by _wstart desc limit 1 offset 16;
if $row != 0 then
return -1
endi
sql select count(c2), first(c3),stddev(c4) from sliding_tb0 interval(10a) order by ts desc limit 10 offset 2;
sql select _wstart, count(c2), first(c3),stddev(c4) from sliding_tb0 interval(10a) order by _wstart desc limit 10 offset 2;
if $data00 != @00-01-01 00:04:59.910@ then
return -1
endi
sql select count(*),stddev(c1),count(c1),first(c2),last(c3) from sliding_tb0 where ts>'2000-1-1 00:00:00' and ts<'2000-1-1 00:00:01.002' and c2 >= 0 interval(30s) sliding(10s) order by ts asc limit 1000;
sql select _wstart, count(*),stddev(c1),count(c1),first(c2),last(c3) from sliding_tb0 where ts>'2000-1-1 00:00:00' and ts<'2000-1-1 00:00:01.002' and c2 >= 0 interval(30s) sliding(10s) order by _wstart asc limit 1000;
if $row != 3 then
return -1
endi
if $data00 != @99-12-31 23:59:40.000@ then
return -1
endi
if $data02 != 9.521904571 then
return -1
endi
if $data05 != 33 then
return -1
endi
if $data10 != @99-12-31 23:59:50.000@ then
return -1
endi
if $data12 != 9.521904571 then
return -1
endi
if $data15 != 33 then
return -1
endi
if $data25 != 33 then
return -1
endi
sql select count(*),stddev(c1),count(c1),first(c2),last(c3) from sliding_tb0 where ts>'2000-1-1 00:00:00' and ts<'2000-1-1 00:00:01.002' and c2 >= 0 interval(30s) sliding(10s) order by ts desc limit 1000;
sql select _wstart, count(*),stddev(c1),count(c1),first(c2),last(c3) from sliding_tb0 where ts>'2000-1-1 00:00:00' and ts<'2000-1-1 00:00:01.002' and c2 >= 0 interval(30s) sliding(10s) order by _wstart desc limit 1000;
if $row != 3 then
return -1
endi
if $data00 != @00-01-01 00:00:00.000@ then
print expect 00-01-01 00:00:00.000, actual: $data00
return -1
endi
if $data01 != 33 then
return -1
endi
if $data02 != 9.521904571 then
return -1
endi
if $data03 != 33 then
return -1
endi
if $data10 != @99-12-31 23:59:50.000@ then
return -1
endi
if $data11 != 33 then
return -1
endi
if $data12 != 9.521904571 then
return -1
endi
if $data20 != @99-12-31 23:59:40.000@ then
return -1
endi
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册