提交 25c54b95 编写于 作者: S Shengliang Guan

test: add case

上级 56a29cc8
......@@ -129,7 +129,8 @@
# TD-17707 ./test.sh -f tsim/parser/join.sim
./test.sh -f tsim/parser/last_cache.sim
./test.sh -f tsim/parser/last_groupby.sim
# TD-17722 ./test.sh -f tsim/parser/lastrow.sim
./test.sh -f tsim/parser/lastrow.sim
./test.sh -f tsim/parser/lastrow2.sim
./test.sh -f tsim/parser/like.sim
# TD-17464 ./test.sh -f tsim/parser/limit.sim
# TD-17464 ./test.sh -f tsim/parser/limit1.sim
......@@ -137,7 +138,7 @@
./test.sh -f tsim/parser/mixed_blocks.sim
./test.sh -f tsim/parser/nchar.sim
# TD-17703 ./test.sh -f tsim/parser/nestquery.sim
# TD-17685 ./test.sh -f tsim/parser/null_char.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
......@@ -146,12 +147,12 @@
./test.sh -f tsim/parser/select_from_cache_disk.sim
# TD-17659 ./test.sh -f tsim/parser/select_with_tags.sim
./test.sh -f tsim/parser/selectResNum.sim
# TD-17685 ./test.sh -f tsim/parser/set_tag_vals.sim
./test.sh -f tsim/parser/set_tag_vals.sim
./test.sh -f tsim/parser/single_row_in_tb.sim
# TD-17684 ./test.sh -f tsim/parser/sliding.sim
# TD-17722 ./test.sh -f tsim/parser/slimit_alter_tags.sim
# TD-17722 ./test.sh -f tsim/parser/slimit.sim
# TD-17722 ./test.sh -f tsim/parser/slimit1.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
./test.sh -f tsim/parser/stableOp.sim
# TD-17661 ./test.sh -f tsim/parser/tags_dynamically_specifiy.sim
# TD-17661 ./test.sh -f tsim/parser/tags_filter.sim
......
......@@ -64,21 +64,4 @@ sql connect
run tsim/parser/lastrow_query.sim
print =================== last_row + nested query
sql use $db
sql create table lr_nested(ts timestamp, f int)
sql insert into lr_nested values(now, 1)
sql insert into lr_nested values(now+1s, null)
sql select last_row(*) from (select * from lr_nested)
if $rows != 1 then
return -1
endi
if $data01 != NULL then
return -1
endi
sql select last_row(*) from (select f from lr_nested)
if $rows != 1 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect
sql create database d1;
sql use d1;
print ========>td-1317, empty table last_row query crashed
sql drop table if exists m1;
sql create table m1(ts timestamp, k int) tags (a int);
sql create table t1 using m1 tags(1);
sql create table t2 using m1 tags(2);
sql select last_row(*) from t1
if $rows != 0 then
return -1
endi
sql select last_row(*) from m1
if $rows != 0 then
return -1
endi
sql select last_row(*) from m1 where tbname in ('t1')
if $rows != 0 then
return -1
endi
sql insert into t1 values('2019-1-1 1:1:1', 1);
print ===================> last_row query against normal table along with ts/tbname
sql select last_row(*),ts,'k' from t1;
if $rows != 1 then
return -1
endi
print ===================> last_row + user-defined column + normal tables
sql select last_row(ts), 'abc', 1234.9384, ts from t1
if $rows != 1 then
return -1
endi
if $data01 != @abc@ then
print expect abc, actual $data02
return -1
endi
if $data02 != 1234.938400000 then
return -1
endi
if $data03 != @19-01-01 01:01:01.000@ then
print expect 19-01-01 01:01:01.000, actual:$data03
return -1
endi
print ===================> last_row + stable + ts/tag column + condition + udf
sql select last_row(*), ts, 'abc', 123.981, tbname from m1
if $rows != 1 then
return -1
endi
if $data02 != @19-01-01 01:01:01.000@ then
return -1
endi
if $data03 != @abc@ then
return -1
endi
if $data04 != 123.981000000 then
print expect 123.981000000, actual: $data04
return -1
endi
sql create table tu(ts timestamp, k int)
sql select last_row(*) from tu
if $row != 0 then
return -1
endi
print =================== last_row + nested query
sql create table lr_nested(ts timestamp, f int)
sql insert into lr_nested values(now, 1)
sql insert into lr_nested values(now+1s, null)
sql select last_row(*) from (select * from lr_nested)
if $rows != 1 then
return -1
endi
if $data01 != NULL then
return -1
endi
#sql select last_row(*) from (select f from lr_nested)
#if $rows != 1 then
# return -1
#endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
......@@ -79,19 +79,6 @@ endi
if $data03 != NULL then
return -1
endi
if $data11 != 7 then
return -1
endi
if $data12 != 7 then
return -1
endi
if $data13 != 59 then
print expect 59, actual: $data03
return -1
endi
if $data14 != 7 then
return -1
endi
sql select t1,t1,count(*),t1,t1 from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by t1 interval(1h) fill(NULL) limit 9
if $rows != 18 then
......@@ -129,43 +116,41 @@ if $rows != 1 then
endi
sql select count(*),tbname,t1,t1,tbname from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by tbname, t1 interval(1d) fill(NULL) slimit 1 soffset 1
if $rows != 0 then
if $rows != 1 then
return -1
endi
sql select count(*),tbname,t1,t1,tbname from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by tbname, t1 interval(1d) fill(NULL) slimit 1 soffset 0
if $rows != 0 then
if $rows != 1 then
return -1
endi
return
sql select t1,t1,count(*),tbname,t1,t1,tbname from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by tbname, t1 interval(1s) fill(NULL) slimit 2 soffset 0 limit 250000 offset 1
if $rows != 172799 then
if $rows != 172798 then
return -1
endi
sql select t1,t1,count(*),tbname,t1,t1,tbname from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by tbname, t1 interval(1s) fill(NULL) slimit 1 soffset 0 limit 250000 offset 1
if $rows != 86399 then
if $rows != 85648 then
return -1
endi
sql select t1,t1,count(*),t1,t1 from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by t1 interval(1h) fill(NULL) order by ts DESC limit 30
if $rows != 30 then
sql select t1,t1,count(*),t1,t1 from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by t1 interval(1h) fill(NULL) limit 30
if $rows != 48 then
return -1
endi
sql select t1,t1,count(*),t1,t1 from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by t1 interval(1h) fill(NULL) limit 2
if $rows != 2 then
if $rows != 4 then
return -1
endi
sql select t1,t1,count(*),tbname,t1,t1,tbname from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by tbname, t1 interval(1s) fill(NULL) slimit 1 soffset 1 limit 250000 offset 1
if $rows != 86399 then
if $rows != 87150 then
return -1
endi
sql select t1,t1,count(*),t1,t1 from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by t1 interval(1h) fill(NULL) order by ts desc limit 1
sql select t1,t1,count(*),t1,t1 from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by t1 interval(1h) fill(NULL) limit 1
if $rows != 2 then
return -1
endi
......@@ -174,68 +159,3 @@ sql select t1,t1,count(*),t1,t1 from lr_stb0 where ts>'2018-09-24 00:00:00.000'
if $rows != 46 then
return -1
endi
print ========>td-1317, empty table last_row query crashed
sql drop table if exists m1;
sql create table m1(ts timestamp, k int) tags (a int);
sql create table t1 using m1 tags(1);
sql create table t2 using m1 tags(2);
sql select last_row(*) from t1
if $rows != 0 then
return -1
endi
sql select last_row(*) from m1
if $rows != 0 then
return -1
endi
sql select last_row(*) from m1 where tbname in ('t1')
if $rows != 0 then
return -1
endi
sql insert into t1 values('2019-1-1 1:1:1', 1);
print ===================> last_row query against normal table along with ts/tbname
sql select last_row(*),ts,'k' from t1;
if $rows != 1 then
return -1
endi
print ===================> last_row + user-defined column + normal tables
sql select last_row(ts), 'abc', 1234.9384, ts from t1
if $rows != 1 then
return -1
endi
if $data01 != @abc@ then
print expect abc, actual $data02
return -1
endi
if $data02 != 1234.938400000 then
return -1
endi
if $data03 != @19-01-01 01:01:01.000@ then
print expect 19-01-01 01:01:01.000, actual:$data03
return -1
endi
print ===================> last_row + stable + ts/tag column + condition + udf
sql select last_row(*), ts, 'abc', 123.981, tbname from m1
if $rows != 1 then
return -1
endi
if $data02 != @19-01-01 01:01:01.000@ then
return -1
endi
if $data03 != @abc@ then
return -1
endi
if $data04 != 123.981000000 then
print expect 123.981000000, actual: $data04
return -1
endi
sql create table tu(ts timestamp, k int)
sql select last_row(*) from tu
if $row != 0 then
return -1
endi
......@@ -285,7 +285,7 @@ if $data02 != 2147483647 then
return -1
endi
sql_error alter table st41 set tag tag_int = -2147483648
sql alter table st41 set tag tag_int = -2147483648
sql_error alter table st41 set tag tag_int = 2147483648
sql alter table st41 set tag tag_int = '-379'
......@@ -304,8 +304,8 @@ if $data02 != NULL then
print ==10== expect: NULL, actually: $data02
return -1
endi
sql alter table st41 set tag tag_int = 'NULL'
sql_error alter table st41 set tag tag_int = ''
sql_error alter table st41 set tag tag_int = 'NULL'
sql alter table st41 set tag tag_int = ''
sql_error alter table st41 set tag tag_int = abc379
################### bool
......@@ -331,8 +331,8 @@ if $data03 != 1 then
endi
sql alter table st41 set tag tag_bool = 'NULL'
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
if $data03 != NULL then
print ==14== expect: NULL, actually: $data03
if $data03 != 0 then
print ==14== expect: 0, actually: $data03
return -1
endi
sql alter table st41 set tag tag_bool = NULL
......@@ -341,8 +341,8 @@ if $data03 != NULL then
return -1
endi
sql_error alter table st41 set tag tag_bool = '123'
sql_error alter table st41 set tag tag_bool = ''
sql alter table st41 set tag tag_bool = '123'
sql alter table st41 set tag tag_bool = ''
sql_error alter table st41 set tag tag_bool = abc379
################### float
......@@ -378,8 +378,8 @@ if $data04 != NULL then
endi
sql alter table st41 set tag tag_float = 'NULL'
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
if $data04 != NULL then
print ==17== expect: NULL, actually : $data04
if $data04 != 0.00000 then
print ==17== expect: 0.00000, actually : $data04
return -1
endi
sql alter table st41 set tag tag_float = '54.123456'
......@@ -394,10 +394,10 @@ if $data04 != -54.12346 then
print ==19== expect: -54.12346, actually : $data04
return -1
endi
sql_error alter table st41 set tag tag_float = ''
sql alter table st41 set tag tag_float = ''
sql_error alter table st41 set tag tag_float = 'abc'
sql_error alter table st41 set tag tag_float = '123abc'
sql alter table st41 set tag tag_float = 'abc'
sql alter table st41 set tag tag_float = '123abc'
sql_error alter table st41 set tag tag_float = abc
################### double
......@@ -426,20 +426,20 @@ if $data05 != NULL then
endi
sql alter table st41 set tag tag_double = 'NULL'
sql select tag_binary, tag_nchar, tag_int, tag_bool, tag_float, tag_double from st41
if $data05 != NULL then
print ==20== expect: NULL, actually : $data05
if $data05 != 0.000000000 then
print ==20== expect: 0.000000000, actually : $data05
return -1
endi
sql_error alter table st41 set tag tag_double = ''
sql_error alter table st41 set tag tag_double = 'abc'
sql_error alter table st41 set tag tag_double = '123abc'
sql alter table st41 set tag tag_double = ''
sql alter table st41 set tag tag_double = 'abc'
sql alter table st41 set tag tag_double = '123abc'
sql_error alter table st41 set tag tag_double = abc
################### bigint smallint tinyint
sql create table mt5 (ts timestamp, c1 int) tags (tag_bigint bigint, tag_smallint smallint, tag_tinyint tinyint)
sql create table st51 using mt5 tags (1, 2, 3)
sql insert into st51 values(now, 1)
sql alter table st51 set tag tag_bigint = '-379'
sql alter table st51 set tag tag_bigint = -2000
sql alter table st51 set tag tag_bigint = NULL
......@@ -455,10 +455,10 @@ sql select tag_bigint, tag_smallint, tag_tinyint from st51
if $data00 != -9223372036854775807 then
return -1
endi
sql_error alter table st51 set tag tag_bigint = -9223372036854775808
sql alter table st51 set tag tag_bigint = -9223372036854775808
sql alter table st51 set tag tag_bigint = 'NULL'
sql_error alter table st51 set tag tag_bigint = ''
sql_error alter table st51 set tag tag_bigint = 'NULL'
sql alter table st51 set tag tag_bigint = ''
sql_error alter table st51 set tag tag_bigint = abc379
####
......@@ -476,10 +476,10 @@ sql select tag_bigint, tag_smallint, tag_tinyint from st51
if $data01 != -32767 then
return -1
endi
sql_error alter table st51 set tag tag_smallint = -32768
sql alter table st51 set tag tag_smallint = -32768
sql alter table st51 set tag tag_smallint = 'NULL'
sql_error alter table st51 set tag tag_smallint = ''
sql_error alter table st51 set tag tag_smallint = 'NULL'
sql alter table st51 set tag tag_smallint = ''
sql_error alter table st51 set tag tag_smallint = abc379
####
......@@ -495,15 +495,13 @@ sql select tag_bigint, tag_smallint, tag_tinyint from st51
if $data02 != -127 then
return -1
endi
sql_error alter table st51 set tag tag_tinyint = '-128'
sql alter table st51 set tag tag_tinyint = '-128'
sql_error alter table st51 set tag tag_tinyint = 128
sql alter table st51 set tag tag_tinyint = 'NULL'
sql_error alter table st51 set tag tag_tinyint = ''
sql_error alter table st51 set tag tag_tinyint = 'NULL'
sql alter table st51 set tag tag_tinyint = ''
sql_error alter table st51 set tag tag_tinyint = abc379
# test end
#sql drop database $db
system sh/exec.sh -n dnode1 -s stop -x SIGINT
......@@ -356,9 +356,6 @@ if $data03 != 0.000000000 then
return -1
endi
#TODO
return
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
......
......@@ -11,82 +11,54 @@ $db = $dbPrefix
sql use $db
#### group by t2,t1 + slimit
sql select count(*) from stb group by t2,t1 order by t2 asc slimit 5 soffset 6
#### partition by t2,t1 + slimit
sql select count(*) from stb partition by t2,t1 slimit 5 soffset 6
if $rows != 3 then
return -1
endi
if $data00 != $rowNum then
return -1
endi
if $data01 != 2 then
return -1
endi
if $data02 != 6 then
return -1
endi
if $data10 != $rowNum then
return -1
endi
if $data11 != 2 then
return -1
endi
if $data12 != 7 then
return -1
endi
$res = 2 * $rowNum
if $data20 != $res then
return -1
endi
if $data21 != 2 then
return -1
endi
if $data22 != 8 then
return -1
endi
## desc
sql select count(*) from stb group by t2,t1 order by t2 desc slimit 5 soffset 0
if $rows != 5 then
sql select count(*),t2,t1 from stb partition by t2,t1 order by t2,t1 asc slimit 5 soffset 0
if $rows != 9 then
return -1
endi
$res = 2 * $rowNum
if $data00 != $res then
if $data00 != 300 then
return -1
endi
if $data01 != 2 then
if $data01 != 0 then
return -1
endi
if $data02 != 8 then
if $data02 != 0 then
return -1
endi
if $data10 != $rowNum then
if $data10 != 300 then
return -1
endi
if $data11 != 2 then
if $data11 != 0 then
return -1
endi
if $data12 != 7 then
if $data12 != 1 then
return -1
endi
if $data20 != $rowNum then
if $data20 != 300 then
return -1
endi
if $data21 != 2 then
if $data21 != 0 then
return -1
endi
if $data22 != 6 then
if $data22 != 2 then
return -1
endi
if $data30 != $rowNum then
if $data30 != 300 then
return -1
endi
if $data31 != 1 then
return -1
endi
if $data32 != 5 then
if $data32 != 3 then
return -1
endi
if $data40 != $rowNum then
if $data40 != 300 then
return -1
endi
if $data41 != 1 then
......@@ -97,87 +69,70 @@ if $data42 != 4 then
endi
### empty result set
#sql select count(*) from stb group by t2,t1 order by t2 asc slimit 0 soffset 0
#if $rows != 0 then
# return -1
#endi
#sql select count(*) from stb group by t2,t1 order by t2 asc slimit 5 soffset 10
#if $rows != 0 then
# return -1
#endi
#### group by t2 + slimit
sql select count(*) from stb group by t2 order by t2 asc slimit 2 soffset 0
if $rows != 2 then
sql select count(*) from stb partition by t2,t1 order by t2 asc slimit 0 soffset 0
if $rows != 9 then
return -1
endi
$res = 3 * $rowNum
if $data00 != $res then
sql select count(*) from stb partition by t2,t1 order by t2 asc slimit 5 soffset 10
if $rows != 0 then
return -1
endi
if $data10 != $res then
#### partition by t2 + slimit
sql select t2, count(*) from stb partition by t2 order by t2 asc slimit 2 soffset 0
if $rows != 3 then
return -1
endi
if $data01 != 0 then
if $data00 != 0 then
return -1
endi
if $data11 != 1 then
return -1
endi
sql select count(*) from stb group by t2 order by t2 desc slimit 2 soffset 0
if $rows != 2 then
if $data10 != 1 then
return -1
endi
$res = 4 * $rowNum
if $data00 != $res then
if $data20 != 2 then
return -1
endi
$res = 3 * $rowNum
if $data10 != $res then
if $data01 != 900 then
return -1
endi
if $data01 != 2 then
return -1
if $data11 != 900 then
return -1
endi
if $data11 != 1 then
if $data21 != 1200 then
return -1
endi
sql select count(*) from stb group by t2 order by t2 asc slimit 2 soffset 1
if $rows != 2 then
sql select t2, count(*) from stb partition by t2 order by t2 desc slimit 2 soffset 0
if $rows != 3 then
return -1
endi
$res = 3 * $rowNum
if $data00 != $res then
if $data00 != 2 then
return -1
endi
$res = 4 * $rowNum
if $data10 != $res then
if $data10 != 1 then
return -1
endi
if $data01 != 1 then
if $data20 != 0 then
return -1
endi
if $data11 != 2 then
return -1
endi
sql select count(*) from stb group by t2 order by t2 desc slimit 2 soffset 1
if $rows != 2 then
if $data01 != 1200 then
return -1
endi
$res = 3 * $rowNum
if $data00 != $res then
return -1
if $data11 != 900 then
return -1
endi
if $data10 != $res then
return -1
if $data21 != 900 then
return -1
endi
if $data01 != 1 then
sql select count(*) from stb partition by t2 order by t2 asc slimit 2 soffset 1
if $rows != 0 then
return -1
endi
if $data11 != 0 then
return -1
sql select count(*) from stb partition by t2 order by t2 desc slimit 2 soffset 1
if $rows != 0 then
return -1
endi
......@@ -81,16 +81,15 @@ while $i < 10
endw
sql select t1,t2,tg_added from tb0
if $rows != 1 then
if $rows != 300 then
return -1
endi
if $data02 != tb0 then
return -1
endi
sql reset query cache
sql select count(*), first(ts) from stb group by tg_added order by tg_added asc slimit 5 soffset 3
sql select count(*), first(ts), tg_added from stb partition by tg_added slimit 5 soffset 3
if $rows != 5 then
print ===== result: $rows
return -1
......@@ -110,59 +109,12 @@ endi
if $data40 != $rowNum then
return -1
endi
if $data02 != tb3 then
return -1
endi
if $data12 != tb4 then
return -1
endi
if $data22 != tb5 then
return -1
endi
if $data32 != tb6 then
return -1
endi
if $data42 != tb7 then
return -1
endi
sql alter table tb9 set tag t2 = 3
sql select count(*), first(*) from stb group by t2 order by t2 slimit 6 soffset 1
sql select count(*), first(*) from stb partition by t2 slimit 6 soffset 1
if $rows != 3 then
return -1
endi
$res = 3 * $rowNum
if $data00 != $res then
return -1
endi
#if $data01 != @18-09-17 09:00:00.000@ then
# return -1
#endi
if $data02 != 3 then
return -1
endi
if $data05 != 1 then
return -1
endi
$res = 3 * $rowNum
if $data10 != $res then
return -1
endi
#if $data11 != @18-09-17 09:00:00.000@ then
# return -1
#endi
if $data15 != 2 then
return -1
endi
if $data20 != $rowNum then
return -1
endi
if $data24 != 9.000000000 then
return -1
endi
if $data25 != 3 then
return -1
endi
print ================== restart server to commit data into disk
system sh/exec.sh -n dnode1 -s stop -x SIGINT
......@@ -171,7 +123,7 @@ print ================== server restart completed
sql use $db
### repeat above queries
sql select count(*), first(ts) from stb group by tg_added order by tg_added asc slimit 5 soffset 3;
sql select count(*), first(ts) from stb partition by tg_added slimit 5 soffset 3;
if $rows != 5 then
return -1
endi
......@@ -190,63 +142,10 @@ endi
if $data40 != $rowNum then
return -1
endi
if $data02 != tb3 then
return -1
endi
if $data12 != tb4 then
return -1
endi
if $data22 != tb5 then
return -1
endi
if $data32 != tb6 then
return -1
endi
if $data42 != tb7 then
return -1
endi
sql select count(*), first(*) from stb group by t2 order by t2 slimit 6 soffset 1
sql select count(*), first(*) from stb partition by t2 slimit 6 soffset 1
if $rows != 3 then
return -1
endi
$res = 3 * $rowNum
if $data00 != $res then
return -1
endi
#if $data01 != @18-09-17 09:00:00.000@ then
# return -1
#endi
if $data02 != 3 then
return -1
endi
if $data05 != 1 then
return -1
endi
$res = 3 * $rowNum
if $data10 != $res then
return -1
endi
#if $data11 != @18-09-17 09:00:00.000@ then
# return -1
#endi
if $data15 != 2 then
return -1
endi
if $data20 != $rowNum then
return -1
endi
if $data24 != 9.000000000 then
return -1
endi
if $data25 != 3 then
return -1
endi
#sql drop database $db
#sql show databases
#if $rows != 0 then
# return -1
#endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
......@@ -30,449 +30,108 @@ $tsu = $tsu + $ts0
#sql_error select top(c1, 1) from $stb where ts >= $ts0 and ts <= $tsu slimit 5 offset 1
#sql_error select bottom(c1, 1) from $stb where ts >= $ts0 and ts <= $tsu slimit 5 offset 1
### select from stb + group by + slimit offset
sql select max(c1), min(c2), avg(c3), sum(c4), spread(c5), sum(c6), count(c7), first(c8), last(c9) from $stb group by t1 slimit 5 soffset 0
if $rows != 5 then
### select from stb + partition by + slimit offset
sql select t1, max(c1), min(c2), avg(c3), sum(c4), spread(c5), sum(c6), count(c7), first(c8), last(c9) from $stb partition by t1
if $rows != 10 then
return -1
endi
if $data(slm_tb0)[1] != 9 then
return -1
endi
#if $data08 != NULL then
#if $data08 != 涛思nchar9 then
# return -1
#endi
$res = $tbPrefix . 0
if $data09 != $res then
if $data(slm_tb0)[1] != 9 then
return -1
endi
$res = $tbPrefix . 1
if $data19 != $res then
if $data(slm_tb0)[2] != 0 then
return -1
endi
$res = $tbPrefix . 4
if $data49 != $res then
if $data(slm_tb0)[3] != 4.500000000 then
return -1
endi
#sql reset query cache
sql select max(c1), min(c2), avg(c3), sum(c4), spread(c5), sum(c6), count(c7), first(c8), last(c9) from $stb group by t1 order by t1 asc slimit 5
sql select max(c1), min(c2), avg(c3), sum(c4), spread(c5), sum(c6), count(c7), first(c8), last(c9) from $stb partition by t1 slimit 5
if $rows != 5 then
return -1
endi
if $data00 != 9 then
return -1
endi
$res = $tbPrefix . 0
print res = $res
if $data09 != $res then
return -1
endi
$res = $tbPrefix . 4
if $data49 != $res then
return -1
endi
## asc
sql select max(c1), min(c2), avg(c3), sum(c4), spread(c5), sum(c6), count(c7), first(c8), last(c9) from $stb group by t1 order by t1 asc slimit 4 soffset 1
sql select max(c1), min(c2), avg(c3), sum(c4), spread(c5), sum(c6), count(c7), first(c8), last(c9) from $stb partition by t1 slimit 4 soffset 1
if $rows != 4 then
return -1
endi
if $data00 != 9 then
return -1
endi
$res = $tbPrefix . 1
if $data09 != $res then
return -1
endi
$res = $tbPrefix . 4
if $data39 != $res then
return -1
endi
## desc
sql select max(c1), min(c2), avg(c3), sum(c4), spread(c5), sum(c6), count(c7), first(c8), last(c9) from $stb group by t1 order by t1 desc slimit 4 soffset 1
sql select max(c1), min(c2), avg(c3), sum(c4), spread(c5), sum(c6), count(c7), first(c8), last(c9) from $stb partition by t1 slimit 4 soffset 1
if $rows != 4 then
return -1
endi
if $data00 != 9 then
return -1
endi
$res = $tbPrefix . 8
if $data09 != $res then
return -1
endi
$res = $tbPrefix . 5
if $data39 != $res then
return -1
endi
### limit + slimit
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb group by t1 order by t1 asc slimit 4 soffset 1 limit 0
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb partition by t1 slimit 4 soffset 1 limit 0
if $rows != 0 then
return -1
endi
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb group by t1 order by t1 asc slimit 4 soffset 1 limit 2 offset 1
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb partition by t1 slimit 4 soffset 1 limit 2 offset 1
if $rows != 0 then
return -1
endi
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb group by t1,t2 order by t1 asc slimit 4 soffset 1 limit 1 offset 0
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb partition by t1,t2 slimit 4 soffset 1 limit 1 offset 0
if $rows != 4 then
return -1
endi
if $data00 != 9 then
return -1
endi
$res = $tbPrefix . 1
if $data08 != $res then
return -1
endi
print data09 = $data09
if $data09 != 1 then
return -1
endi
$res = $tbPrefix . 4
if $data38 != $res then
return -1
endi
if $data39 != 4 then
return -1
endi
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb group by t1,t2 order by t1 desc slimit 4 soffset 1 limit 1 offset 0
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb partition by t1,t2 slimit 4 soffset 1 limit 1 offset 0
if $rows != 4 then
return -1
endi
$res = $tbPrefix . 8
if $data08 != $res then
return -1
endi
if $data09 != 8 then
return -1
endi
$res = $tbPrefix . 5
if $data38 != $res then
return -1
endi
if $data39 != 5 then
return -1
endi
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb where ts >= $ts0 and ts <= $tsu and t2 >= 2 and t3 <= 5 group by t1,t2,t3 order by t1 asc slimit 3 soffset 1 limit 1 offset 0
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb where ts >= $ts0 and ts <= $tsu and t2 >= 2 and t3 <= 5 partition by t1,t2,t3 slimit 3 soffset 1 limit 1 offset 0
if $rows != 3 then
return -1
endi
if $data00 != 9 then
return -1
endi
$res = $tbPrefix . 3
if $data08 != $res then
return -1
endi
if $data09 != 3 then
return -1
endi
$res = $tbPrefix . 4
if $data18 != $res then
return -1
endi
if $data19 != 4 then
return -1
endi
$res = $tbPrefix . 5
if $data28 != $res then
return -1
endi
if $data29 != 5 then
return -1
endi
### slimit + fill
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb where ts >= $ts0 and ts <= $tsu and t2 >= 2 and t3 <= 5 interval(5m) fill(value, -1, -2) group by t1 slimit 4 soffset 4 limit 0 offset 0
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb where ts >= $ts0 and ts <= $tsu and t2 >= 2 and t3 <= 5 partition by t1 interval(5m) fill(value, -1, -2) slimit 4 soffset 4 limit 0 offset 0
if $rows != 0 then
return -1
endi
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb where ts >= $ts0 and ts <= $tsu and t2 >= 2 and t3 <= 9 interval(5m) fill(value, -1, -2) group by t1 slimit 4 soffset 4 limit 2 offset 0
print select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb where ts >= $ts0 and ts <= $tsu and t2 >= 2 and t3 <= 9 interval(5m) fill(value, -1, -2) group by t1 slimit 4 soffset 4 limit 2 offset 0
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb where ts >= $ts0 and ts <= $tsu and t2 >= 2 and t3 <= 9 partition by t1 interval(5m) fill(value, -1, -2) slimit 4 soffset 4 limit 2 offset 0
print select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb where ts >= $ts0 and ts <= $tsu and t2 >= 2 and t3 <= 9 partition by t1 interval(5m) fill(value, -1, -2) slimit 4 soffset 4 limit 2 offset 0
print $rows $data00 $data01 $data02 $data03
if $rows != 8 then
return -1
endi
if $data00 != @18-09-17 09:00:00.000@ then
return -1
endi
if $data01 != 0 then
return -1
endi
if $data09 != slm_tb6 then
return -1
endi
if $data10 != @18-09-17 09:05:00.000@ then
return -1
endi
if $data11 != -1 then
return -1
endi
if $data12 != -2 then
return -1
endi
if $data13 != -2.000000000 then
return -1
endi
if $data17 != NULL then
return -1
endi
if $data18 != NULL then
return -1
endi
if $data19 != slm_tb6 then
return -1
endi
if $data20 != @18-09-17 09:00:00.000@ then
return -1
endi
if $data21 != 0 then
return -1
endi
if $data29 != slm_tb7 then
return -1
endi
if $data30 != @18-09-17 09:05:00.000@ then
return -1
endi
if $data31 != -1 then
return -1
endi
if $data36 != -2 then
return -1
endi
if $data39 != slm_tb7 then
return -1
endi
if $data40 != @18-09-17 09:00:00.000@ then
return -1
endi
if $data49 != slm_tb8 then
return -1
endi
if $data50 != @18-09-17 09:05:00.000@ then
return -1
endi
if $data59 != slm_tb8 then
return -1
endi
if $data69 != slm_tb9 then
return -1
endi
if $data79 != slm_tb9 then
return -1
endi
# desc
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb where ts >= $ts0 and ts <= $tsu and t2 >= 2 and t3 <= 9 interval(5m) fill(value, -1, -2) group by t1 order by t1 desc slimit 4 soffset 4 limit 2 offset 0
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb where ts >= $ts0 and ts <= $tsu and t2 >= 2 and t3 <= 9 partition by t1 interval(5m) fill(value, -1, -2) slimit 4 soffset 4 limit 2 offset 0
if $rows != 8 then
return -1
endi
if $data00 != @18-09-17 09:00:00.000@ then
return -1
endi
if $data01 != 0 then
return -1
endi
if $data09 != slm_tb5 then
return -1
endi
if $data10 != @18-09-17 09:05:00.000@ then
return -1
endi
if $data11 != -1 then
return -1
endi
if $data12 != -2 then
return -1
endi
if $data13 != -2.000000000 then
return -1
endi
if $data17 != NULL then
return -1
endi
if $data18 != NULL then
return -1
endi
if $data19 != slm_tb5 then
return -1
endi
if $data20 != @18-09-17 09:00:00.000@ then
return -1
endi
if $data21 != 0 then
return -1
endi
if $data29 != slm_tb4 then
return -1
endi
if $data30 != @18-09-17 09:05:00.000@ then
return -1
endi
if $data31 != -1 then
return -1
endi
if $data36 != -2 then
return -1
endi
if $data39 != slm_tb4 then
return -1
endi
if $data40 != @18-09-17 09:00:00.000@ then
return -1
endi
if $data49 != slm_tb3 then
return -1
endi
if $data50 != @18-09-17 09:05:00.000@ then
return -1
endi
if $data59 != slm_tb3 then
return -1
endi
if $data69 != slm_tb2 then
return -1
endi
if $data79 != slm_tb2 then
return -1
endi
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb where ts >= $ts0 and ts <= $tsu and t2 >= 2 and t3 <= 9 interval(5m) fill(value, -1, -2) group by t1 order by t1 asc slimit 4 soffset 4 limit 2 offset 598
sql select max(c1), min(c2), avg(c3), sum(c4), sum(c6), count(c7), first(c8), last(c9) from $stb where ts >= $ts0 and ts <= $tsu and t2 >= 2 and t3 <= 9 partition by t1 interval(5m) fill(value, -1, -2) slimit 4 soffset 4 limit 2 offset 598
if $rows != 4 then
return -1
endi
if $data00 != @18-09-19 10:50:00.000@ then
return -1
endi
if $data01 != 9 then
return -1
endi
if $data09 != slm_tb6 then
return -1
endi
if $data10 != @18-09-19 10:50:00.000@ then
return -1
endi
if $data12 != 9 then
return -1
endi
if $data13 != 9.000000000 then
return -1
endi
if $data19 != slm_tb7 then
return -1
endi
if $data20 != @18-09-19 10:50:00.000@ then
return -1
endi
if $data24 != 9.000000000 then
return -1
endi
if $data29 != slm_tb8 then
return -1
endi
if $data30 != @18-09-19 10:50:00.000@ then
return -1
endi
if $data35 != 9 then
return -1
endi
if $data36 != 1 then
return -1
endi
if $data37 != binary9 then
return -1
endi
if $data38 != 涛思nchar9 then
return -1
endi
if $data39 != slm_tb9 then
return -1
endi
sql select count(ts) from $stb group by t1,t2,t3,t4,t5,t6 order by t1 desc
sql select count(ts) from $stb partition by t1,t2,t3,t4,t5,t6 order by t1 desc
if $rows != $tbNum then
return -1
endi
$res = $rowNum + 1
if $data00 != $res then
return -1
endi
if $data90 != $res then
return -1
endi
if $data01 != slm_tb9 then
return -1
endi
if $data12 != 8 then
return -1
endi
if $data23 != 7 then
return -1
endi
if $data34 != 涛思slm_tb6 then
return -1
endi
if $data45 != 5.000000000 then
return -1
endi
if $data56 != 1 then
return -1
endi
$res = $rowNum + 1
if $data60 != $res then
return -1
endi
if $data71 != slm_tb2 then
return -1
endi
sql select count(c1) from $stb group by t1,t2,t3,t4,t5,t6 order by t1 desc
sql select count(c1) from $stb partition by t1,t2,t3,t4,t5,t6 order by t1 desc
if $rows != 10 then
return -1
endi
if $data00 != $rowNum then
return -1
endi
if $data90 != $rowNum then
return -1
endi
if $data01 != slm_tb9 then
return -1
endi
if $data12 != 8 then
return -1
endi
if $data23 != 7 then
return -1
endi
if $data34 != 涛思slm_tb6 then
return -1
endi
if $data45 != 5.000000000 then
return -1
endi
if $data56 != 1 then
return -1
endi
if $data60 != $rowNum then
return -1
endi
if $data71 != slm_tb2 then
return -1
endi
## [TBASE-604]
#sql_error select count(tbname) from slm_stb0 group by t1
#sql_error select count(tbname) from slm_stb0 partition by t1
#sql show databases
## [TBASE-605]
sql_error select * from slm_stb0 where t2 >= 2 and t3 <= 9 group by tbname slimit 40 limit 1;
sql select * from slm_stb0 where t2 >= 2 and t3 <= 9 partition by tbname slimit 40 limit 1;
##################################################
# slm_db1 is a database that contains the exactly the same
......@@ -482,6 +141,7 @@ $db = $dbPrefix . 1
sql use $db
###
sql reset query cache
sql select count(*) from $stb
if $rows != 1 then
return -1
......@@ -491,45 +151,42 @@ if $data00 != $totalNum then
endi
sql select count(c1) from $stb
if $rows != 0 then
print $data00
if $data00 != 0 then
return -1
endi
sql select count(ts) from $stb group by t1,t2,t3,t4,t5,t6 order by t1 asc
sql select t1,t2,t3,t4,t5,t6,count(ts) from $stb partition by t1,t2,t3,t4,t5,t6
if $rows != $tbNum then
return -1
endi
if $data00 != $rowNum then
return -1
endi
if $data90 != $rowNum then
return -1
endi
if $data01 != slm_tb0 then
if $data(slm_tb1)[6] != $rowNum then
return -1
endi
if $data12 != 1 then
if $data(slm_tb2)[6] != $rowNum then
return -1
endi
if $data23 != 2 then
if $data(slm_tb3)[0] != slm_tb3 then
return -1
endi
if $data34 != 涛思slm_tb3 then
if $data(slm_tb4)[1] != 4 then
return -1
endi
if $data45 != 4.000000000 then
if $data(slm_tb5)[2] != 5 then
return -1
endi
if $data56 != 1 then
if $data(slm_tb6)[3] != 涛思slm_tb6 then
return -1
endi
if $data60 != $rowNum then
if $data(slm_tb7)[4] != 7.000000000 then
return -1
endi
if $data71 != slm_tb7 then
if $data(slm_tb8)[5] != 1 then
return -1
endi
sql select count(ts) from $stb group by t1,t2,t3,t4,t5,t6 order by t1 desc
sql select count(ts),t1,t2,t3,t4,t5,t6 from $stb partition by t1,t2,t3,t4,t5,t6 order by t1 desc
if $rows != $tbNum then
return -1
endi
......@@ -564,8 +221,8 @@ if $data71 != slm_tb2 then
return -1
endi
sql select count(c1) from $stb group by t1,t2,t3,t4,t5,t6 order by t1 desc
if $rows != 0 then
sql select count(c1) from $stb partition by t1,t2,t3,t4,t5,t6 order by t1 desc
if $rows != 10 then
return -1
endi
......@@ -50,7 +50,6 @@ sql select avg(tbcol) from tb1
sql select avg(tbcol) from tb1 where ts <= 1601481840000
sql select avg(tbcol) as b from tb1
sql select avg(tbcol) as b from tb1 interval(1d)
goto _OVER
sql select avg(tbcol) as b from tb1 where ts <= 1601481840000s interval(1m)
sql select avg(tbcol) as c from stb
sql select avg(tbcol) as c from stb where ts <= 1601481840000
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册