add test case
This commit is contained in:
parent
a9edf4bdd5
commit
2f1c18b6c1
|
@ -0,0 +1,71 @@
|
|||
system sh/stop_dnodes.sh
|
||||
system sh/deploy.sh -n dnode1 -i 1
|
||||
system sh/cfg.sh -n dnode1 -c walLevel -v 0
|
||||
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 4
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
|
||||
sleep 100
|
||||
sql connect
|
||||
print ======================== dnode1 start
|
||||
|
||||
$db = testdb
|
||||
|
||||
sql create database $db cachelast 2
|
||||
sql use $db
|
||||
|
||||
sql create stable st2 (ts timestamp, f1 int, f2 double, f3 binary(10), f4 timestamp) tags (id int)
|
||||
|
||||
sql create table tb1 using st2 tags (1);
|
||||
sql create table tb2 using st2 tags (2);
|
||||
sql create table tb3 using st2 tags (3);
|
||||
sql create table tb4 using st2 tags (4);
|
||||
sql create table tb5 using st2 tags (1);
|
||||
sql create table tb6 using st2 tags (2);
|
||||
sql create table tb7 using st2 tags (3);
|
||||
sql create table tb8 using st2 tags (4);
|
||||
sql create table tb9 using st2 tags (5);
|
||||
sql create table tba using st2 tags (5);
|
||||
sql create table tbb using st2 tags (5);
|
||||
sql create table tbc using st2 tags (5);
|
||||
sql create table tbd using st2 tags (5);
|
||||
sql create table tbe using st2 tags (5);
|
||||
|
||||
sql insert into tb1 values ("2021-05-09 10:10:10", 1, 2.0, '3', -1000)
|
||||
sql insert into tb1 values ("2021-05-10 10:10:11", 4, 5.0, NULL, -2000)
|
||||
sql insert into tb1 values ("2021-05-12 10:10:12", 6,NULL, NULL, -3000)
|
||||
|
||||
sql insert into tb2 values ("2021-05-09 10:11:13",-1,-2.0,'-3', -1001)
|
||||
sql insert into tb2 values ("2021-05-10 10:11:14",-4,-5.0, NULL, -2001)
|
||||
sql insert into tb2 values ("2021-05-11 10:11:15",-6, -7, '-8', -3001)
|
||||
|
||||
sql insert into tb3 values ("2021-05-09 10:12:17", 7, 8.0, '9' , -1002)
|
||||
sql insert into tb3 values ("2021-05-09 10:12:17",10,11.0, NULL, -2002)
|
||||
sql insert into tb3 values ("2021-05-09 10:12:18",12,NULL, NULL, -3002)
|
||||
|
||||
sql insert into tb4 values ("2021-05-09 10:12:19",13,14.0,'15' , -1003)
|
||||
sql insert into tb4 values ("2021-05-10 10:12:20",16,17.0, NULL, -2003)
|
||||
sql insert into tb4 values ("2021-05-11 10:12:21",18,NULL, NULL, -3003)
|
||||
|
||||
sql insert into tb5 values ("2021-05-09 10:12:22",19, 20, '21', -1004)
|
||||
sql insert into tb6 values ("2021-05-11 10:12:23",22, 23, NULL, -2004)
|
||||
sql insert into tb7 values ("2021-05-10 10:12:24",24,NULL, '25', -3004)
|
||||
sql insert into tb8 values ("2021-05-11 10:12:25",26,NULL, '27', -4004)
|
||||
|
||||
sql insert into tb9 values ("2021-05-09 10:12:26",28, 29, '30', -1005)
|
||||
sql insert into tba values ("2021-05-10 10:12:27",31, 32, NULL, -2005)
|
||||
sql insert into tbb values ("2021-05-10 10:12:28",33,NULL, '35', -3005)
|
||||
sql insert into tbc values ("2021-05-11 10:12:29",36, 37, NULL, -4005)
|
||||
sql insert into tbd values ("2021-05-11 10:12:29",NULL,NULL,NULL,NULL )
|
||||
|
||||
run general/parser/last_cache_query.sim
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
|
||||
run general/parser/last_cache_query.sim
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,416 @@
|
|||
|
||||
sleep 100
|
||||
sql connect
|
||||
|
||||
$db = testdb
|
||||
|
||||
sql use $db
|
||||
|
||||
print "test tb1"
|
||||
|
||||
sql select last(ts) from tb1
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != @21-05-12 10:10:12.000@ then
|
||||
print $data00
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
||||
sql select last(f1) from tb1
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != 6 then
|
||||
print $data00
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select last(*) from tb1
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != @21-05-12 10:10:12.000@ then
|
||||
print $data00
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 6 then
|
||||
return -1
|
||||
endi
|
||||
if $data02 != 5.000000000 then
|
||||
print $data02
|
||||
return -1
|
||||
endi
|
||||
if $data03 != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data04 != @70-01-01 07:59:57.000@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
||||
sql select last(tb1.*,ts,f4) from tb1
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != @21-05-12 10:10:12.000@ then
|
||||
print $data00
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 6 then
|
||||
return -1
|
||||
endi
|
||||
if $data02 != 5.000000000 then
|
||||
print $data02
|
||||
return -1
|
||||
endi
|
||||
if $data03 != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data04 != @70-01-01 07:59:57.000@ then
|
||||
return -1
|
||||
endi
|
||||
if $data05 != @21-05-12 10:10:12.000@ then
|
||||
print $data00
|
||||
return -1
|
||||
endi
|
||||
if $data06 != @70-01-01 07:59:57.000@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
||||
|
||||
|
||||
print "test tb2"
|
||||
|
||||
sql select last(ts) from tb2
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != @21-05-11 10:11:15.000@ then
|
||||
print $data00
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
||||
sql select last(f1) from tb2
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != -6 then
|
||||
print $data00
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select last(*) from tb2
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != @21-05-11 10:11:15.000@ then
|
||||
print $data00
|
||||
return -1
|
||||
endi
|
||||
if $data01 != -6 then
|
||||
return -1
|
||||
endi
|
||||
if $data02 != -7.000000000 then
|
||||
print $data02
|
||||
return -1
|
||||
endi
|
||||
if $data03 != -8 then
|
||||
return -1
|
||||
endi
|
||||
if $data04 != @70-01-01 07:59:56.999@ then
|
||||
if $data04 != @70-01-01 07:59:57.-01@ then
|
||||
return -1
|
||||
endi
|
||||
endi
|
||||
|
||||
|
||||
sql select last(tb2.*,ts,f4) from tb2
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != @21-05-11 10:11:15.000@ then
|
||||
print $data00
|
||||
return -1
|
||||
endi
|
||||
if $data01 != -6 then
|
||||
return -1
|
||||
endi
|
||||
if $data02 != -7.000000000 then
|
||||
print $data02
|
||||
return -1
|
||||
endi
|
||||
if $data03 != -8 then
|
||||
return -1
|
||||
endi
|
||||
if $data04 != @70-01-01 07:59:56.999@ then
|
||||
if $data04 != @70-01-01 07:59:57.-01@ then
|
||||
return -1
|
||||
endi
|
||||
endi
|
||||
if $data05 != @21-05-11 10:11:15.000@ then
|
||||
print $data00
|
||||
return -1
|
||||
endi
|
||||
if $data06 != @70-01-01 07:59:56.999@ then
|
||||
if $data04 != @70-01-01 07:59:57.-01@ then
|
||||
return -1
|
||||
endi
|
||||
endi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
print "test tbd"
|
||||
sql select last(*) from tbd
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != @21-05-11 10:12:29.000@ then
|
||||
print $data00
|
||||
return -1
|
||||
endi
|
||||
if $data01 != NULL then
|
||||
return -1
|
||||
endi
|
||||
if $data02 != NULL then
|
||||
print $data02
|
||||
return -1
|
||||
endi
|
||||
if $data03 != NULL then
|
||||
return -1
|
||||
endi
|
||||
if $data04 != NULL then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
||||
|
||||
print "test tbe"
|
||||
sql select last(*) from tbe
|
||||
if $rows != 0 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
print "test stable"
|
||||
sql select last(ts) from st2
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != @21-05-12 10:10:12.000@ then
|
||||
print $data00
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
||||
sql select last(f1) from st2
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != 6 then
|
||||
print $data00
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select last(*) from st2
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != @21-05-12 10:10:12.000@ then
|
||||
print $data00
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 6 then
|
||||
return -1
|
||||
endi
|
||||
if $data02 != 37.000000000 then
|
||||
print $data02
|
||||
return -1
|
||||
endi
|
||||
if $data03 != 27 then
|
||||
return -1
|
||||
endi
|
||||
if $data04 != @70-01-01 07:59:57.000@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
||||
sql select last(st2.*,ts,f4) from st2
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != @21-05-12 10:10:12.000@ then
|
||||
print $data00
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 6 then
|
||||
return -1
|
||||
endi
|
||||
if $data02 != 37.000000000 then
|
||||
print $data02
|
||||
return -1
|
||||
endi
|
||||
if $data03 != 27 then
|
||||
return -1
|
||||
endi
|
||||
if $data04 != @70-01-01 07:59:57.000@ then
|
||||
return -1
|
||||
endi
|
||||
if $data05 != @21-05-12 10:10:12.000@ then
|
||||
print $data00
|
||||
return -1
|
||||
endi
|
||||
if $data06 != @70-01-01 07:59:57.000@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
||||
sql select last(*) from st2 group by id
|
||||
if $rows != 5 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != @21-05-12 10:10:12.000@ then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 6 then
|
||||
return -1
|
||||
endi
|
||||
if $data02 != 5.000000000 then
|
||||
print $data02
|
||||
return -1
|
||||
endi
|
||||
if $data03 != 21 then
|
||||
return -1
|
||||
endi
|
||||
if $data04 != @70-01-01 07:59:57.000@ then
|
||||
return -1
|
||||
endi
|
||||
if $data05 != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data10 != @21-05-11 10:12:23.000@ then
|
||||
return -1
|
||||
endi
|
||||
if $data11 != 22 then
|
||||
return -1
|
||||
endi
|
||||
if $data12 != 23.000000000 then
|
||||
print $data02
|
||||
return -1
|
||||
endi
|
||||
if $data13 != -8 then
|
||||
return -1
|
||||
endi
|
||||
if $data14 != @70-01-01 07:59:57.996@ then
|
||||
if $data14 != @70-01-01 07:59:58.-04@ then
|
||||
print $data14
|
||||
return -1
|
||||
endi
|
||||
endi
|
||||
if $data15 != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $data20 != @21-05-10 10:12:24.000@ then
|
||||
return -1
|
||||
endi
|
||||
if $data21 != 24 then
|
||||
return -1
|
||||
endi
|
||||
if $data22 != 8.000000000 then
|
||||
print $data02
|
||||
return -1
|
||||
endi
|
||||
if $data23 != 25 then
|
||||
return -1
|
||||
endi
|
||||
if $data24 != @70-01-01 07:59:56.996@ then
|
||||
if $data24 != @70-01-01 07:59:57.-04@ then
|
||||
return -1
|
||||
endi
|
||||
endi
|
||||
if $data25 != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data30 != @21-05-11 10:12:25.000@ then
|
||||
return -1
|
||||
endi
|
||||
if $data31 != 26 then
|
||||
return -1
|
||||
endi
|
||||
if $data32 != 17.000000000 then
|
||||
print $data02
|
||||
return -1
|
||||
endi
|
||||
if $data33 != 27 then
|
||||
return -1
|
||||
endi
|
||||
if $data34 != @70-01-01 07:59:55.996@ then
|
||||
if $data34 != @70-01-01 07:59:56.-04@ then
|
||||
return -1
|
||||
endi
|
||||
endi
|
||||
if $data35 != 4 then
|
||||
return -1
|
||||
endi
|
||||
if $data40 != @21-05-11 10:12:29.000@ then
|
||||
return -1
|
||||
endi
|
||||
if $data41 != 36 then
|
||||
return -1
|
||||
endi
|
||||
if $data42 != 37.000000000 then
|
||||
print $data02
|
||||
return -1
|
||||
endi
|
||||
if $data43 != 35 then
|
||||
return -1
|
||||
endi
|
||||
if $data44 != @70-01-01 07:59:55.995@ then
|
||||
if $data44 != @70-01-01 07:59:56.-05@ then
|
||||
return -1
|
||||
endi
|
||||
endi
|
||||
if $data45 != 5 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
||||
print "test tbn"
|
||||
sql create table tbn (ts timestamp, f1 int, f2 double, f3 binary(10), f4 timestamp)
|
||||
sql insert into tbn values ("2021-05-09 10:10:10", 1, 2.0, '3', -1000)
|
||||
sql insert into tbn values ("2021-05-10 10:10:11", 4, 5.0, NULL, -2000)
|
||||
sql insert into tbn values ("2021-05-12 10:10:12", 6,NULL, NULL, -3000)
|
||||
sql insert into tbn values ("2021-05-13 10:10:12", NULL,NULL, NULL,NULL)
|
||||
|
||||
sql select last(*) from tbn;
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != @21-05-13 10:10:12.000@ then
|
||||
print $data00
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 6 then
|
||||
return -1
|
||||
endi
|
||||
if $data02 != 5.000000000 then
|
||||
print $data02
|
||||
return -1
|
||||
endi
|
||||
if $data03 != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data04 != @70-01-01 07:59:57.000@ then
|
||||
return -1
|
||||
endi
|
||||
|
|
@ -59,4 +59,6 @@ run general/parser/having.sim
|
|||
run general/parser/having_child.sim
|
||||
run general/parser/slimit_alter_tags.sim
|
||||
run general/parser/binary_escapeCharacter.sim
|
||||
run general/parser/between_and.sim
|
||||
run general/parser/last_cache.sim
|
||||
|
||||
|
|
Loading…
Reference in New Issue