diff --git a/tests/script/general/parser/topbot.sim b/tests/script/general/parser/topbot.sim index 57858ae04e7a614b6bcabc386fea957b8cb58dac..fdda79451d132631aac7a28c0efb33e4a915b04b 100644 --- a/tests/script/general/parser/topbot.sim +++ b/tests/script/general/parser/topbot.sim @@ -66,6 +66,11 @@ if $row != 100 then return -1 endi +sql select bottom(c1, 100) from tb_stb0 +if $row != 100 then + return -1 +endi + sql select last(*) from tb_tb9 if $row != 1 then return -1 @@ -81,4 +86,36 @@ if $row != 0 then return -1 endi +sql create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double, col7 bool, col8 binary(20), col9 nchar(20)) tags(loc nchar(20)); +sql create table test1 using test tags('beijing'); +sql insert into test1 values(1537146000000, 1, 1, 1, 1, 0.100000, 0.100000, 0, 'taosdata1', '涛思数据1'); +sql insert into test1 values(1537146000001, 2, 2, 2, 2, 1.100000, 1.100000, 1, 'taosdata2', '涛思数据2'); +sql insert into test1 values(1537146000002, 3, 3, 3, 3, 2.100000, 2.100000, 0, 'taosdata3', '涛思数据3'); +sql insert into test1 values(1537146000003, 4, 4, 4, 4, 3.100000, 3.100000, 1, 'taosdata4', '涛思数据4'); +sql insert into test1 values(1537146000004, 5, 5, 5, 5, 4.100000, 4.100000, 0, 'taosdata5', '涛思数据5'); +sql insert into test1 values(1537146000005, 6, 6, 6, 6, 5.100000, 5.100000, 1, 'taosdata6', '涛思数据6'); +sql insert into test1 values(1537146000006, 7, 7, 7, 7, 6.100000, 6.100000, 0, 'taosdata7', '涛思数据7'); +sql insert into test1 values(1537146000007, 8, 8, 8, 8, 7.100000, 7.100000, 1, 'taosdata8', '涛思数据8'); +sql insert into test1 values(1537146000008, 9, 9, 9, 9, 8.100000, 8.100000, 0, 'taosdata9', '涛思数据9'); +sql insert into test1 values(1537146000009, 10, 10, 10, 10, 9.100000, 9.100000, 1, 'taosdata10', '涛思数据10'); +sql select bottom(col5, 10) from test +if $rows != 10 then + return -1 +endi + +if $data01 != 0.10000 then + print expect 0.10000 actual: $data01 + return -1 +endi + +if $data11 != 1.10000 then + print expect 1.10000 actual: $data11 + return -1 +endi + +if $data21 != 2.10000 then + print expect 2.10000 actual: $data21 + return -1 +endi + system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file