提交 03eb1790 编写于 作者: S shenglian zhou

add sample test cases

上级 2d82d156
...@@ -120,6 +120,7 @@ if $data31 != 4 then ...@@ -120,6 +120,7 @@ if $data31 != 4 then
endi endi
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 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; sql select last(f1) from tb1 group by f1 having count(f2) > 0;
if $rows != 4 then if $rows != 4 then
...@@ -144,6 +145,12 @@ sql_error select top(f1,2) from tb1 group by f1 having count(f2) > 0; ...@@ -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 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; sql select avg(f1),count(f1) from tb1 group by f1 having avg(f1) > 2;
if $rows != 2 then if $rows != 2 then
return -1 return -1
...@@ -1067,7 +1074,13 @@ if $data26 != 4 then ...@@ -1067,7 +1074,13 @@ if $data26 != 4 then
return -1 return -1
endi 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); 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 ...@@ -1863,4 +1876,6 @@ endi
sql_error select top(f1,2) from tb1 group by f1 having count(f1) > 0; 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 system sh/exec.sh -n dnode1 -s stop -x SIGINT
...@@ -181,6 +181,12 @@ if $data03 != @abc15@ then ...@@ -181,6 +181,12 @@ if $data03 != @abc15@ then
return -1 return -1
endi 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(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(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(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 ...@@ -418,6 +424,11 @@ if $data11 != @70-01-01 08:01:40.001@ then
return -1 return -1
endi 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; 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 if $row != 200 then
return -1 return -1
...@@ -455,6 +466,11 @@ if $data04 != @abc0@ then ...@@ -455,6 +466,11 @@ if $data04 != @abc0@ then
return -1 return -1
endi 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; 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 if $row != 4 then
return -1 return -1
...@@ -542,6 +558,11 @@ endi ...@@ -542,6 +558,11 @@ endi
# slimit /limit # 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; 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 if $row != 2 then
return -1 return -1
...@@ -715,6 +736,11 @@ if $data25 != @select_tags_tb2@ then ...@@ -715,6 +736,11 @@ if $data25 != @select_tags_tb2@ then
return -1 return -1
endi 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; sql select top(c1, 5), t2 from select_tags_mt0 where c1<=2 interval(1d) group by tbname;
if $row != 15 then if $row != 15 then
return -1 return -1
...@@ -753,6 +779,11 @@ if $data93 != @select_tags_tb1@ then ...@@ -753,6 +779,11 @@ if $data93 != @select_tags_tb1@ then
endi endi
#if data #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; sql select top(c1, 50), t2, t1, tbname from select_tags_mt0 where c1<=2 interval(1d) group by tbname;
if $row != 48 then if $row != 48 then
return -1 return -1
...@@ -838,6 +869,8 @@ endi ...@@ -838,6 +869,8 @@ endi
print TODO ======= selectivity + tags+ group by + tags + filter + interval + join=========== print TODO ======= selectivity + tags+ group by + tags + filter + interval + join===========
print ==========================mix tag columns and group by columns====================== 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 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 if $rows != 100 then
return -1 return -1
......
...@@ -489,6 +489,7 @@ sql_error select ts,sum_double(f1),f1 from tb1; ...@@ -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 add_one(f1),count(f1) from tb1;
sql_error select sum_double(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),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); sql_error select add_one(f1) from tb1 interval(10a);
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册