diff --git a/tests/script/general/parser/having_child.sim b/tests/script/general/parser/having_child.sim index 04e58f2a8d8459c79c7ab1a4ef644dd2d9f4efe0..341a27824fe766a078d41d92f3e167b0b9111ac8 100644 --- a/tests/script/general/parser/having_child.sim +++ b/tests/script/general/parser/having_child.sim @@ -120,6 +120,7 @@ if $data31 != 4 then endi sql_error select top(f1,2) from tb1 group by f1 having count(f2) > 0; +sql_error select sample(f1,2) from tb1 group by f1 having count(f2) > 0; sql select last(f1) from tb1 group by f1 having count(f2) > 0; if $rows != 4 then @@ -144,6 +145,12 @@ 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_error select sample(f1,2) from tb1 group by f1 having count(f2) > 0; + +sql_error select sample(f1,2) from tb1 group by f1 having count(f2) > 0; + +sql_error select sample(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; if $rows != 2 then return -1 @@ -1067,7 +1074,13 @@ if $data26 != 4 then return -1 endi +sql_error select avg(f1),count(tb1.*),sum(f1),stddev(f1),min(f1),max(f1),first(f1),last(f1) from tb1 group by f1 having sample(f1,1); +sql_error select avg(f1),count(tb1.*),sum(f1),stddev(f1),min(f1),max(f1),first(f1),last(f1) from tb1 group by f1 having sample(f1,1) > 1; + +sql_error select avg(f1),count(tb1.*),sum(f1),stddev(f1),min(f1),max(f1),first(f1),last(f1),sample(f1,1),bottom(f1,1) from tb1 group by f1 having bottom(f1,1) > 1; + +sql_error select avg(f1),count(tb1.*),sum(f1),stddev(f1),min(f1),max(f1),first(f1),last(f1),sample(f1,1),bottom(f1,1) from tb1 group by f1 having sum(f1) > 1; sql_error select avg(f1),count(tb1.*),sum(f1),stddev(f1),min(f1),max(f1),first(f1),last(f1) from tb1 group by f1 having top(f1,1); @@ -1863,4 +1876,6 @@ endi sql_error select top(f1,2) from tb1 group by f1 having count(f1) > 0; +sql_error select sample(f1,2) from tb1 group by f1 having count(f1) > 0; + system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/parser/select_with_tags.sim b/tests/script/general/parser/select_with_tags.sim index eb6cd75d2104f7ff61b5f5e5bccc12fdd239d3d5..195eca928fa4ddbf3795ae3e40f973ea0a5e8def 100644 --- a/tests/script/general/parser/select_with_tags.sim +++ b/tests/script/general/parser/select_with_tags.sim @@ -181,6 +181,12 @@ if $data03 != @abc15@ then return -1 endi +sql_error select sample(c6, 3) from select_tags_mt0 interval(10a) +sql select sample(c3,10) from select_tags_mt0 interval(10a) group by tbname,t1,t2 +sql select sample(c6, 3) from select_tags_mt0 interval(10a) group by tbname; +sql_error select sample(c6, 10) from select_tags_mt0 interval(10a); +sql_error select sample(c1, 80), tbname, t1, t2 from select_tags_mt0; + 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; @@ -418,6 +424,11 @@ if $data11 != @70-01-01 08:01:40.001@ then return -1 endi +sql select sample(c1, 100), tbname, t1, t2 from select_tags_mt0 where tbname in ('select_tags_tb0', 'select_tags_tb1') group by tbname; +if $rows != 200 then + return -1 +endi + sql select top(c1, 100), tbname, t1, t2 from select_tags_mt0 where tbname in ('select_tags_tb0', 'select_tags_tb1') group by tbname; if $row != 200 then return -1 @@ -455,6 +466,11 @@ if $data04 != @abc0@ then return -1 endi +sql select sample(c1, 2), t2 from select_tags_mt0 where tbname in ('select_tags_tb0', 'select_tags_tb1') group by tbname,t2; +if $rows != 4 then + return -1 +endi + sql select top(c1, 2), t2 from select_tags_mt0 where tbname in ('select_tags_tb0', 'select_tags_tb1') group by tbname,t2; if $row != 4 then return -1 @@ -542,6 +558,11 @@ endi # slimit /limit +sql select sample(c1, 2), t2 from select_tags_mt0 where tbname in ('select_tags_tb0', 'select_tags_tb1') group by tbname,t2 limit 2 offset 1; +if $rows != 2 then + return -1 +endi + sql select top(c1, 2), t2 from select_tags_mt0 where tbname in ('select_tags_tb0', 'select_tags_tb1') group by tbname,t2 limit 2 offset 1; if $row != 2 then return -1 @@ -715,6 +736,11 @@ if $data25 != @select_tags_tb2@ then return -1 endi +sql select sample(c1, 5), t2 from select_tags_mt0 where c1<=2 interval(1d) group by tbname; +if $row != 15 then + return -1 +endi + sql select top(c1, 5), t2 from select_tags_mt0 where c1<=2 interval(1d) group by tbname; if $row != 15 then return -1 @@ -753,6 +779,11 @@ if $data93 != @select_tags_tb1@ then endi #if data +sql select sample(c1, 50), t2, t1, tbname from select_tags_mt0 where c1<=2 interval(1d) group by tbname; +if $row != 48 then + return -1 +endi + sql select top(c1, 50), t2, t1, tbname from select_tags_mt0 where c1<=2 interval(1d) group by tbname; if $row != 48 then return -1 @@ -838,6 +869,8 @@ endi print TODO ======= selectivity + tags+ group by + tags + filter + interval + join=========== print ==========================mix tag columns and group by columns====================== +sql_error select sample(c1, 100), tbname from select_tags_mt0 where tbname in ('select_tags_tb0', 'select_tags_tb1') group by t3 + sql select top(c1, 100), tbname from select_tags_mt0 where tbname in ('select_tags_tb0', 'select_tags_tb1') group by t3 if $rows != 100 then return -1 diff --git a/tests/script/general/parser/udf_dll.sim b/tests/script/general/parser/udf_dll.sim index 0f9436762adb645785ddcf9a4abaf4a5be810a34..7168e0a5ddf5502170e6bb22f30b10621795a568 100644 --- a/tests/script/general/parser/udf_dll.sim +++ b/tests/script/general/parser/udf_dll.sim @@ -489,6 +489,7 @@ sql_error select ts,sum_double(f1),f1 from tb1; sql_error select add_one(f1),count(f1) from tb1; sql_error select sum_double(f1),count(f1) from tb1; sql_error select add_one(f1),top(f1,3) from tb1; +sql_error select add_one(f1),sample(f1,3) from tb1; sql_error select add_one(f1) from tb1 interval(10a); system sh/exec.sh -n dnode1 -s stop -x SIGINT