[add cases]

This commit is contained in:
plum-lihui 2022-04-01 17:46:02 +08:00
parent a35f5e16dd
commit 52e393a42d
2 changed files with 71 additions and 51 deletions

View File

@ -23,7 +23,7 @@
./test.sh -f tsim/insert/null.sim
# ---- parser
#./test.sh -f tsim/parser/groupby-basic.sim
./test.sh -f tsim/parser/groupby-basic.sim
#./test.sh -f tsim/parser/fourArithmetic-basic.sim
# ---- query

View File

@ -45,7 +45,7 @@ $tstart = 1640966400000 # 2022-01-01 00:00:00.000
print ==== create db, stable, ctables, insert data
sql drop database if exists $db -x step1
step1:
sql create database if not exists $db keep 3650
sql create database if not exists $db
sql use $db
sql create table $mt (ts timestamp, c1 int, c2 float, c3 bigint, c4 smallint, c5 tinyint, c6 double, c7 bool, c8 binary(10), c9 nchar(9)) TAGS(t1 int, t2 binary(12))
@ -131,6 +131,7 @@ if $data91 != 9 then
return -1
endi
print ==== select first(ts),c1 from group_tb0 group by c1;
sql select first(ts),c1 from group_tb0 group by c1;
print rows: $rows
print $data00 $data01 $data02 $data03
@ -155,55 +156,74 @@ if $data91 != 9 then
return -1
endi
print ============> filter not supported yet.
#sql select sum(c1), c1, avg(c1), min(c1), max(c2) from group_tb0 where c1 < 20 group by c1;
#if $row != 20 then
# return -1
#endi
#
#if $data00 != 0 then
# return -1
#endi
#
#if $data01 != 0 then
# return -1
#endi
#
#print $data02
#if $data02 != 0.000000000 then
# return -1
#endi
#
#if $data03 != 0 then
# return -1
#endi
#
#print $data04
#if $data04 != 0.00000 then
# return -1
#endi
#
#if $data10 != 100 then
# return -1
#endi
#
#if $data11 != 1 then
# return -1
#endi
#
#print $data12
#if $data12 != 1.000000000 then
# return -1
#endi
#
#if $data13 != 1 then
# return -1
#endi
#
#if $data14 != 1.00000 then
# print expect 1.00000, actual:$data14
# return -1
#endi
print ==== select first(ts),c1 from interval(5m) group_tb0 group by c1;
sql select first(ts),c1 from group_tb0 group by c1;
print rows: $rows
print $data00 $data01 $data02 $data03
print $data10 $data11 $data12 $data13
print $data20 $data21 $data22 $data23
print $data80 $data81 $data82 $data83
print $data90 $data91 $data92 $data93
return
sql select sum(c1), c1, avg(c1), min(c1), max(c2) from group_tb0 where c1 < 20 group by c1;
if $row != 20 then
return -1
endi
if $data00 != 0 then
return -1
endi
if $data01 != 0 then
return -1
endi
print $data02
if $data02 != 0.000000000 then
return -1
endi
if $data03 != 0 then
return -1
endi
print $data04
if $data04 != 0.00000 then
return -1
endi
if $data10 != 100 then
return -1
endi
if $data11 != 1 then
return -1
endi
print $data12
if $data12 != 1.000000000 then
return -1
endi
if $data13 != 1 then
return -1
endi
if $data14 != 1.00000 then
print expect 1.00000, actual:$data14
return -1
endi
sql_error select sum(c1), ts, c1 from group_tb0 where c1<20 group by c1;
sql_error select first(ts), ts, c2 from group_tb0 where c1 < 20 group by c1;