Merge pull request #15233 from taosdata/fix/tsim

test: restore 2.0 case
This commit is contained in:
Shengliang Guan 2022-07-21 15:59:17 +08:00 committed by GitHub
commit a77b24f2bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 210 additions and 296 deletions

View File

@ -31,7 +31,7 @@
./test.sh -f tsim/db/len.sim ./test.sh -f tsim/db/len.sim
./test.sh -f tsim/db/repeat.sim ./test.sh -f tsim/db/repeat.sim
./test.sh -f tsim/db/show_create_db.sim ./test.sh -f tsim/db/show_create_db.sim
./test.sh -f tsim/db/show_create_table.sim # jira ./test.sh -f tsim/db/show_create_table.sim
./test.sh -f tsim/db/tables.sim ./test.sh -f tsim/db/tables.sim
./test.sh -f tsim/db/taosdlog.sim ./test.sh -f tsim/db/taosdlog.sim
@ -94,40 +94,40 @@
./test.sh -f tsim/parser/binary_escapeCharacter.sim ./test.sh -f tsim/parser/binary_escapeCharacter.sim
# jira ./test.sh -f tsim/parser/col_arithmetic_operation.sim # jira ./test.sh -f tsim/parser/col_arithmetic_operation.sim
# jira ./test.sh -f tsim/parser/columnValue.sim # jira ./test.sh -f tsim/parser/columnValue.sim
## ./test.sh -f tsim/parser/commit.sim ./test.sh -f tsim/parser/commit.sim
## ./test.sh -f tsim/parser/condition.sim # jira ./test.sh -f tsim/parser/condition.sim
## ./test.sh -f tsim/parser/constCol.sim ./test.sh -f tsim/parser/constCol.sim
./test.sh -f tsim/parser/create_db.sim ./test.sh -f tsim/parser/create_db.sim
# ./test.sh -f tsim/parser/create_mt.sim ./test.sh -f tsim/parser/create_mt.sim
# ./test.sh -f tsim/parser/create_tb.sim # jira ./test.sh -f tsim/parser/create_tb_with_tag_name.sim
## ./test.sh -f tsim/parser/create_tb_with_tag_name.sim ./test.sh -f tsim/parser/create_tb.sim
# ./test.sh -f tsim/parser/dbtbnameValidate.sim ./test.sh -f tsim/parser/dbtbnameValidate.sim
##./test.sh -f tsim/parser/distinct.sim ./test.sh -f tsim/parser/distinct.sim
#./test.sh -f tsim/parser/fill_stb.sim # jira ./test.sh -f tsim/parser/fill_stb.sim
./test.sh -f tsim/parser/fill_us.sim ./test.sh -f tsim/parser/fill_us.sim
./test.sh -f tsim/parser/fill.sim ./test.sh -f tsim/parser/fill.sim
./test.sh -f tsim/parser/first_last.sim ./test.sh -f tsim/parser/first_last.sim
./test.sh -f tsim/parser/fourArithmetic-basic.sim ./test.sh -f tsim/parser/fourArithmetic-basic.sim
## ./test.sh -f tsim/parser/function.sim # jira ./test.sh -f tsim/parser/function.sim
./test.sh -f tsim/parser/groupby-basic.sim ./test.sh -f tsim/parser/groupby-basic.sim
# ./test.sh -f tsim/parser/groupby.sim # ./test.sh -f tsim/parser/groupby.sim
# ./test.sh -f tsim/parser/having_child.sim # ./test.sh -f tsim/parser/having_child.sim
## ./test.sh -f tsim/parser/having.sim ## ./test.sh -f tsim/parser/having.sim
## ./test.sh -f tsim/parser/import.sim ./test.sh -f tsim/parser/import_commit1.sim
# ./test.sh -f tsim/parser/import_commit1.sim ./test.sh -f tsim/parser/import_commit2.sim
# ./test.sh -f tsim/parser/import_commit2.sim ./test.sh -f tsim/parser/import_commit3.sim
# ./test.sh -f tsim/parser/import_commit3.sim # jira ./test.sh -f tsim/parser/import_file.sim
## ./test.sh -f tsim/parser/import_file.sim ./test.sh -f tsim/parser/import.sim
## ./test.sh -f tsim/parser/insert_multiTbl.sim ./test.sh -f tsim/parser/insert_multiTbl.sim
# ./test.sh -f tsim/parser/insert_tb.sim ./test.sh -f tsim/parser/insert_tb.sim
## ./test.sh -f tsim/parser/interp.sim # jira ./test.sh -f tsim/parser/interp.sim
# ./test.sh -f tsim/parser/join.sim # ./test.sh -f tsim/parser/join.sim
# ./test.sh -f tsim/parser/join_manyblocks.sim # ./test.sh -f tsim/parser/join_manyblocks.sim
## ./test.sh -f tsim/parser/join_multitables.sim ## ./test.sh -f tsim/parser/join_multitables.sim
# ./test.sh -f tsim/parser/join_multivnode.sim # ./test.sh -f tsim/parser/join_multivnode.sim
# ./test.sh -f tsim/parser/last_cache.sim ./test.sh -f tsim/parser/last_cache.sim
## ./test.sh -f tsim/parser/last_groupby.sim ## ./test.sh -f tsim/parser/last_groupby.sim
# ./test.sh -f tsim/parser/lastrow.sim # jira ./test.sh -f tsim/parser/lastrow.sim
## ./test.sh -f tsim/parser/like.sim ## ./test.sh -f tsim/parser/like.sim
# ./test.sh -f tsim/parser/limit.sim # ./test.sh -f tsim/parser/limit.sim
# ./test.sh -f tsim/parser/limit1.sim # ./test.sh -f tsim/parser/limit1.sim
@ -159,7 +159,7 @@
./test.sh -f tsim/parser/stableOp.sim ./test.sh -f tsim/parser/stableOp.sim
# ./test.sh -f tsim/parser/tags_dynamically_specifiy.sim # ./test.sh -f tsim/parser/tags_dynamically_specifiy.sim
# ./test.sh -f tsim/parser/tags_filter.sim # ./test.sh -f tsim/parser/tags_filter.sim
# jira ./test.sh -f tsim/parser/tbnameIn.sim ./test.sh -f tsim/parser/tbnameIn.sim
./test.sh -f tsim/parser/timestamp.sim ./test.sh -f tsim/parser/timestamp.sim
./test.sh -f tsim/parser/top_groupby.sim ./test.sh -f tsim/parser/top_groupby.sim
./test.sh -f tsim/parser/topbot.sim ./test.sh -f tsim/parser/topbot.sim
@ -196,7 +196,7 @@
./test.sh -f tsim/mnode/basic5.sim ./test.sh -f tsim/mnode/basic5.sim
# ---- show # ---- show
./test.sh -f tsim/show/basic.sim # jira ./test.sh -f tsim/show/basic.sim
# ---- table # ---- table
./test.sh -f tsim/table/autocreate.sim ./test.sh -f tsim/table/autocreate.sim
@ -328,7 +328,7 @@
./test.sh -f tsim/vnode/stable_replica3_vnode3.sim ./test.sh -f tsim/vnode/stable_replica3_vnode3.sim
# --- sync # --- sync
./test.sh -f tsim/sync/3Replica1VgElect.sim # jira ./test.sh -f tsim/sync/3Replica1VgElect.sim
./test.sh -f tsim/sync/3Replica5VgElect.sim ./test.sh -f tsim/sync/3Replica5VgElect.sim
./test.sh -f tsim/sync/oneReplica1VgElect.sim ./test.sh -f tsim/sync/oneReplica1VgElect.sim
./test.sh -f tsim/sync/oneReplica5VgElect.sim ./test.sh -f tsim/sync/oneReplica5VgElect.sim

View File

@ -20,7 +20,7 @@ $stb = $stbPrefix . $i
sql drop database $db -x step1 sql drop database $db -x step1
step1: step1:
sql create database $db maxrows 255 ctime 3600 sql create database $db maxrows 255
print ====== create tables print ====== create tables
sql use $db sql use $db
sql create table $stb (ts timestamp, c1 int, c2 bigint, c3 float, c4 double, c5 smallint, c6 tinyint, c7 bool, c8 binary(10), c9 nchar(10)) tags(t1 int) sql create table $stb (ts timestamp, c1 int, c2 bigint, c3 float, c4 double, c5 smallint, c6 tinyint, c7 bool, c8 binary(10), c9 nchar(10)) tags(t1 int)
@ -78,12 +78,9 @@ endw
print ================== restart server to commit data into disk print ================== restart server to commit data into disk
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT
sleep 500
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 100
print ================== server restart completed print ================== server restart completed
sql connect sql connect
sleep 100
print ====== select from table and check num of rows returned print ====== select from table and check num of rows returned
sql use $db sql use $db

View File

@ -2,11 +2,11 @@ system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sql connect sql connect
sql drop database if exists cdb sql drop database if exists cdb
sql create database if not exists cdb sql create database if not exists cdb
sql use cdb sql use cdb
sql create table stb1 (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(10), t3 double) sql create table stb1 (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(10), t3 double)
sql create table tb1 using stb1 tags(1,'1',1.0) sql create table tb1 using stb1 tags(1,'1',1.0)
sql create table tb2 using stb1 tags(2,'2',2.0) sql create table tb2 using stb1 tags(2,'2',2.0)
sql create table tb3 using stb1 tags(3,'3',3.0) sql create table tb3 using stb1 tags(3,'3',3.0)
@ -45,7 +45,6 @@ sql insert into tb6 values ('2021-05-05 18:19:27',64,64.0,64,64,64,64.0,false,'6
sql insert into tb6 values ('2021-05-05 18:19:28',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL) sql insert into tb6 values ('2021-05-05 18:19:28',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)
sql create table stb2 (ts timestamp, u1 int unsigned, u2 bigint unsigned, u3 smallint unsigned, u4 tinyint unsigned, ts2 timestamp) TAGS(t1 int unsigned, t2 bigint unsigned, t3 timestamp, t4 int) sql create table stb2 (ts timestamp, u1 int unsigned, u2 bigint unsigned, u3 smallint unsigned, u4 tinyint unsigned, ts2 timestamp) TAGS(t1 int unsigned, t2 bigint unsigned, t3 timestamp, t4 int)
sql create table tb2_1 using stb2 tags(1,1,'2021-05-05 18:38:38',1) sql create table tb2_1 using stb2 tags(1,1,'2021-05-05 18:38:38',1)
sql create table tb2_2 using stb2 tags(2,2,'2021-05-05 18:58:58',2) sql create table tb2_2 using stb2 tags(2,2,'2021-05-05 18:58:58',2)
@ -67,7 +66,6 @@ sql insert into tb2_2 values ('2021-05-05 18:19:14',8,2,3,4,'2021-05-05 18:28:15
sql insert into tb2_2 values ('2021-05-05 18:19:15',5,6,7,8,'2021-05-05 18:28:16') sql insert into tb2_2 values ('2021-05-05 18:19:15',5,6,7,8,'2021-05-05 18:28:16')
sql create table stb3 (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(10), t3 double) sql create table stb3 (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(10), t3 double)
sql create table tb3_1 using stb3 tags(1,'1',1.0) sql create table tb3_1 using stb3 tags(1,'1',1.0)
sql create table tb3_2 using stb3 tags(2,'2',2.0) sql create table tb3_2 using stb3 tags(2,'2',2.0)
@ -78,7 +76,6 @@ sql insert into tb3_1 values ('2021-04-05 18:19:03',4,4.0,4,4,4,4.0,false,'4','4
sql insert into tb3_1 values ('2021-05-05 18:19:28',5,NULL,5,NULL,5,NULL,true,NULL,'5') sql insert into tb3_1 values ('2021-05-05 18:19:28',5,NULL,5,NULL,5,NULL,true,NULL,'5')
sql insert into tb3_1 values ('2021-06-05 18:19:28',NULL,6.0,NULL,6,NULL,6.0,NULL,'6',NULL) sql insert into tb3_1 values ('2021-06-05 18:19:28',NULL,6.0,NULL,6,NULL,6.0,NULL,'6',NULL)
sql insert into tb3_1 values ('2021-07-05 18:19:28',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL) sql insert into tb3_1 values ('2021-07-05 18:19:28',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)
sql insert into tb3_2 values ('2021-01-06 18:19:00',11,11.0,11,11,11,11.0,true ,'11','11') sql insert into tb3_2 values ('2021-01-06 18:19:00',11,11.0,11,11,11,11.0,true ,'11','11')
sql insert into tb3_2 values ('2021-02-06 18:19:01',12,12.0,12,12,12,12.0,true ,'12','12') sql insert into tb3_2 values ('2021-02-06 18:19:01',12,12.0,12,12,12,12.0,true ,'12','12')
sql insert into tb3_2 values ('2021-03-06 18:19:02',13,13.0,13,13,13,13.0,false,'13','13') sql insert into tb3_2 values ('2021-03-06 18:19:02',13,13.0,13,13,13,13.0,false,'13','13')
@ -87,9 +84,7 @@ sql insert into tb3_2 values ('2021-05-06 18:19:28',15,NULL,15,NULL,15,NULL,true
sql insert into tb3_2 values ('2021-06-06 18:19:28',NULL,16.0,NULL,16,NULL,16.0,NULL,'16',NULL) sql insert into tb3_2 values ('2021-06-06 18:19:28',NULL,16.0,NULL,16,NULL,16.0,NULL,'16',NULL)
sql insert into tb3_2 values ('2021-07-06 18:19:28',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL) sql insert into tb3_2 values ('2021-07-06 18:19:28',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)
sql create table stb4 (ts timestamp, c1 int, c2 float, c3 bigint, c4 smallint, c5 tinyint, c6 double, c7 bool, c8 binary(10), c9 nchar(9),c10 binary(16300)) TAGS(t1 int, t2 binary(10), t3 double) sql create table stb4 (ts timestamp, c1 int, c2 float, c3 bigint, c4 smallint, c5 tinyint, c6 double, c7 bool, c8 binary(10), c9 nchar(9),c10 binary(16300)) TAGS(t1 int, t2 binary(10), t3 double)
sql create table tb4_0 using stb4 tags(0,'0',0.0) sql create table tb4_0 using stb4 tags(0,'0',0.0)
sql create table tb4_1 using stb4 tags(1,'1',1.0) sql create table tb4_1 using stb4 tags(1,'1',1.0)
sql create table tb4_2 using stb4 tags(2,'2',2.0) sql create table tb4_2 using stb4 tags(2,'2',2.0)
@ -128,19 +123,13 @@ while $i < $blockNum
$ts0 = $ts0 + 259200000 $ts0 = $ts0 + 259200000
endw endw
sleep 100
sql connect
run tsim/parser/condition_query.sim run tsim/parser/condition_query.sim
print ================== restart server to commit data into disk print ================== restart server to commit data into disk
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT
sleep 100
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
print ================== server restart completed print ================== server restart completed
sql connect sql connect
sleep 100
run tsim/parser/condition_query.sim run tsim/parser/condition_query.sim

View File

@ -11,14 +11,14 @@ if $rows != 28 then
return -1 return -1
endi endi
sql_error select * from stb1 where c8 > 0 sql select * from stb1 where c8 > 0
sql_error select * from stb1 where c7 in (0,2,3,1); sql select * from stb1 where c7 in (0,2,3,1);
sql_error select * from stb1 where c8 in (true); sql select * from stb1 where c8 in (true);
sql_error select * from stb1 where c8 in (1,2); sql select * from stb1 where c8 in (1,2);
sql_error select * from stb1 where t2 in (3.0); sql select * from stb1 where t2 in (3.0);
sql_error select ts,c1,c7 from stb1 where c7 > false sql select ts,c1,c7 from stb1 where c7 > false
sql_error select * from stb1 where c1 > NULL; sql select * from stb1 where c1 > NULL;
sql_error select * from stb1 where c1 = NULL; sql select * from stb1 where c1 = NULL;
sql_error select * from stb1 where c1 LIKE '%1'; sql_error select * from stb1 where c1 LIKE '%1';
sql_error select * from stb1 where c2 LIKE '%1'; sql_error select * from stb1 where c2 LIKE '%1';
sql_error select * from stb1 where c3 LIKE '%1'; sql_error select * from stb1 where c3 LIKE '%1';
@ -26,20 +26,20 @@ sql_error select * from stb1 where c4 LIKE '%1';
sql_error select * from stb1 where c5 LIKE '%1'; sql_error select * from stb1 where c5 LIKE '%1';
sql_error select * from stb1 where c6 LIKE '%1'; sql_error select * from stb1 where c6 LIKE '%1';
sql_error select * from stb1 where c7 LIKE '%1'; sql_error select * from stb1 where c7 LIKE '%1';
sql_error select * from stb1 where c1 = 'NULL'; sql select * from stb1 where c1 = 'NULL';
sql_error select * from stb1 where c2 > 'NULL'; sql select * from stb1 where c2 > 'NULL';
sql_error select * from stb1 where c3 <> 'NULL'; sql select * from stb1 where c3 <> 'NULL';
sql_error select * from stb1 where c4 != 'null'; sql select * from stb1 where c4 != 'null';
sql_error select * from stb1 where c5 >= 'null'; sql select * from stb1 where c5 >= 'null';
sql_error select * from stb1 where c6 <= 'null'; sql select * from stb1 where c6 <= 'null';
sql_error select * from stb1 where c7 < 'nuLl'; sql select * from stb1 where c7 < 'nuLl';
sql_error select * from stb1 where c8 < 'nuLl'; sql select * from stb1 where c8 < 'nuLl';
sql_error select * from stb1 where c9 > 'nuLl'; sql select * from stb1 where c9 > 'nuLl';
sql_error select * from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b; sql_error select * from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b;
sql_error select a.ts,a.c1,a.c8 from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b where a.ts=b.ts and a.c1 > 50 or b.c1 < 60; sql_error select a.ts,a.c1,a.c8 from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b where a.ts=b.ts and a.c1 > 50 or b.c1 < 60;
sql_error select a.ts,a.c1,a.c8 from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b where a.ts=b.ts and ((a.c1 > 50 and a.c1 < 60) or (b.c2 > 60)); sql_error select a.ts,a.c1,a.c8 from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b where a.ts=b.ts and ((a.c1 > 50 and a.c1 < 60) or (b.c2 > 60));
sql_error select * from stb1 where 'c2' is null; sql select * from stb1 where 'c2' is null;
sql_error select * from stb1 where 'c2' is not null; sql select * from stb1 where 'c2' is not null;
sql select * from stb1 where c2 > 3.0 or c2 < 60; sql select * from stb1 where c2 > 3.0 or c2 < 60;
if $rows != 28 then if $rows != 28 then
@ -173,7 +173,6 @@ if $data32 != 0 then
return -1 return -1
endi endi
sql select ts,c1,c7 from stb1 where c7 = true sql select ts,c1,c7 from stb1 where c7 = true
if $rows != 14 then if $rows != 14 then
return -1 return -1

View File

@ -8,20 +8,16 @@ sql use db;
sql create table t (ts timestamp, i int); sql create table t (ts timestamp, i int);
sql create table st1 (ts timestamp, f1 int) tags(t1 int); sql create table st1 (ts timestamp, f1 int) tags(t1 int);
sql create table st2 (ts timestamp, f2 int) tags(t2 int); sql create table st2 (ts timestamp, f2 int) tags(t2 int);
sql create table t1 using st1 tags(1); sql create table t1 using st1 tags(1);
sql create table t2 using st2 tags(1); sql create table t2 using st2 tags(1);
sql insert into t1 values(1575880055000, 1); sql insert into t1 values(1575880055000, 1);
sql insert into t1 values(1575880059000, 1); sql insert into t1 values(1575880059000, 1);
sql insert into t1 values(1575880069000, 1); sql insert into t1 values(1575880069000, 1);
sql insert into t2 values(1575880055000, 2); sql insert into t2 values(1575880055000, 2);
sql select st1.ts, st1.f1, st2.f2 from db.st1, db.st2 where st1.t1=st2.t2 and st1.ts=st2.ts sql select st1.ts, st1.f1, st2.f2 from db.st1, db.st2 where st1.t1=st2.t2 and st1.ts=st2.ts
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select st1.ts, st1.f1, st2.f2 from db.st1, db.st2 where st1.t1=st2.t2 and st1.ts=st2.ts' 127.0.0.1:7111/restful/sql
print ==============select with user-defined columns print ==============select with user-defined columns
sql select 'abc' as f, ts,f1 from t1 sql select 'abc' as f, ts,f1 from t1
if $rows != 3 then if $rows != 3 then
@ -301,13 +297,13 @@ if $data04 != 1.982700000 then
endi endi
print ======================udc with interval print ======================udc with interval
sql select count(*), 'uuu' from t1 interval(1s) order by ts desc; sql select count(*), 'uuu' from t1 interval(1s);
if $rows != 3 then if $rows != 3 then
return -1 return -1
endi endi
print ======================udc with tags print ======================udc with tags
sql select t1,'abc',tbname from st1 sql select distinct t1,'abc',tbname from st1
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
@ -343,31 +339,26 @@ if $rows != 0 then
return -1 return -1
endi endi
print ======================udc with normal column group by print ======================udc with normal column group by
sql_error select from t1 sql_error select from t1
sql_error select abc from t1 sql_error select abc from t1
sql_error select abc as tu from t1 sql_error select abc as tu from t1
print ========================> td-1756 print ========================> td-1756
sql_error select * from t1 where ts>now-1y sql select * from t1 where ts>now-1y
sql_error select * from t1 where ts>now-1n sql select * from t1 where ts>now-1n
print ========================> td-1752 print ========================> td-1752
sql select * from db.st2 where t2 < 200 and t2 is not null; sql select * from db.st2 where t2 < 200 and t2 is not null;
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
if $data00 != @19-12-09 16:27:35.000@ then if $data00 != @19-12-09 16:27:35.000@ then
return -1 return -1
endi endi
if $data01 != 2 then if $data01 != 2 then
return -1 return -1
endi endi
if $data02 != 1 then if $data02 != 1 then
return -1 return -1
endi endi
@ -376,7 +367,6 @@ sql select * from db.st2 where t2 > 200 or t2 is null;
if $rows != 0 then if $rows != 0 then
return -1 return -1
endi endi
sql select * from st2 where t2 < 200 and t2 is null; sql select * from st2 where t2 < 200 and t2 is null;
if $rows != 0 then if $rows != 0 then
return -1 return -1

View File

@ -69,7 +69,8 @@ sql_error create table $mt (ts $i_ts , col int) tags (tag1 int)
sql_error create table $mt (ts timestamp, col $i_binary ) tags (tag1 int) sql_error create table $mt (ts timestamp, col $i_binary ) tags (tag1 int)
sql_error create table $mt (ts timestamp, col $i_bigint ) tags (tag1 int) sql_error create table $mt (ts timestamp, col $i_bigint ) tags (tag1 int)
sql_error create table $mt (ts timestamp, col $i_smallint ) tags (tag1 int) sql_error create table $mt (ts timestamp, col $i_smallint ) tags (tag1 int)
sql_error create table $mt (ts timestamp, col $i_binary2 ) tags (tag1 int) sql create table $mt (ts timestamp, col $i_binary2 ) tags (tag1 int)
sql drop table $mt
sql_error create table $mt (ts timestamp, col $i_tinyint ) tags (tag1 int) sql_error create table $mt (ts timestamp, col $i_tinyint ) tags (tag1 int)
sql_error create table $mt (ts timestamp, col $i_nchar ) tags (tag1 int) sql_error create table $mt (ts timestamp, col $i_nchar ) tags (tag1 int)
@ -101,7 +102,8 @@ sql_error create table $mt (ts timestamp, col int) tags (tag1 $i_binary )
sql_error create table $mt (ts timestamp, col int) tags (tag1 $i_bigint ) sql_error create table $mt (ts timestamp, col int) tags (tag1 $i_bigint )
sql_error create table $mt (ts timestamp, col int) tags (tag1 $i_smallint ) sql_error create table $mt (ts timestamp, col int) tags (tag1 $i_smallint )
sql_error create table $mt (ts timestamp, col int) tags (tag1 $i_tinyint ) sql_error create table $mt (ts timestamp, col int) tags (tag1 $i_tinyint )
sql_error create table $mt (ts timestamp, col int) tags (tag1 $i_binary2 ) sql create table $mt (ts timestamp, col int) tags (tag1 $i_binary2 )
sql drop table $mt
sql_error create table $mt (ts timestamp, col int) tags (tag1 $i_bool ) sql_error create table $mt (ts timestamp, col int) tags (tag1 $i_bool )
sql_error create table $mt (ts timestamp, col int) tags (tag1 $nchar ) sql_error create table $mt (ts timestamp, col int) tags (tag1 $nchar )
# correct use of nchar in tags # correct use of nchar in tags
@ -144,7 +146,8 @@ sql_error create table $mt (ts timestamp, col1 int) tags ( $ses int)
sql_error create table $mt (ts timestamp, col1 int) tags ( $int int) sql_error create table $mt (ts timestamp, col1 int) tags ( $int int)
sql_error create table $mt (ts timestamp, col1 int) tags ( $bint int) sql_error create table $mt (ts timestamp, col1 int) tags ( $bint int)
sql_error create table $mt (ts timestamp, col1 int) tags ( $binary int) sql_error create table $mt (ts timestamp, col1 int) tags ( $binary int)
sql_error create table $mt (ts timestamp, col1 int) tags ( $str int) sql create table $mt (ts timestamp, col1 int) tags ( $str int)
sql drop table $mt
sql_error create table $mt (ts timestamp, col1 int) tags ( $tag int) sql_error create table $mt (ts timestamp, col1 int) tags ( $tag int)
sql_error create table $mt (ts timestamp, col1 int) tags ( $tags int) sql_error create table $mt (ts timestamp, col1 int) tags ( $tags int)
sql_error create table $mt (ts timestamp, col1 int) tags ( $sint int) sql_error create table $mt (ts timestamp, col1 int) tags ( $sint int)
@ -162,8 +165,8 @@ sql create table $tb using $mt tags (-1)
# -x ng_tag_v # -x ng_tag_v
# return -1 # return -1
#ng_tag_v: #ng_tag_v:
sql select tg from $tb sql show tags from $tb
if $data00 != -1 then if $data05 != -1 then
return -1 return -1
endi endi
sql drop table $tb sql drop table $tb
@ -172,28 +175,21 @@ sql drop table $tb
print create_mt.sim unmatched_tag_types print create_mt.sim unmatched_tag_types
sql reset query cache sql reset query cache
sql create table $tb using $mt tags ('123') sql create table $tb using $mt tags ('123')
sql select tg from $tb sql show tags from $tb
print data00 = $data00 print data05 = $data05
if $data00 != 123 then if $data05 != 123 then
return -1 return -1
endi endi
sql drop table $tb sql drop table $tb
sql_error create table $tb using $mt tags (abc) sql_error create table $tb using $mt tags (abc)
#the case below might need more consideration #the case below might need more consideration
sql_error create table $tb using $mt tags ('abc') sql_error create table $tb using $mt tags ('abc')
sql drop table if exists $tb sql drop table if exists $tb
sql reset query cache sql reset query cache
sql create table $tb using $mt tags (1e1) sql_error create table $tb using $mt tags (1e1)
sql select tg from $tb
if $data00 != 10 then sql_error create table $tb using $mt tags ('1e1')
return -1
endi
sql drop table $tb
sql create table $tb using $mt tags ('1e1')
sql select tg from $tb
if $data00 != 10 then
return -1
endi
sql_error create table $tb using $mt tags (2147483649) sql_error create table $tb using $mt tags (2147483649)
## case: chinese_char_in_metric ## case: chinese_char_in_metric
@ -245,7 +241,7 @@ print chinese_char_in_metrics test passed
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -66,7 +66,8 @@ sql_error create table $tb (ts timestamp, col $i_binary )
sql_error create table $tb (ts timestamp, col $i_bigint ) sql_error create table $tb (ts timestamp, col $i_bigint )
sql_error create table $tb (ts timestamp, col $i_smallint ) sql_error create table $tb (ts timestamp, col $i_smallint )
sql_error create table $tb (ts timestamp, col $i_tinyint ) sql_error create table $tb (ts timestamp, col $i_tinyint )
sql_error create table $tb (ts timestamp, col $i_binary2 ) sql create table $tb (ts timestamp, col $i_binary2 )
sql drop table $tb
sql_error create table $tb (ts timestamp, col $nchar ) sql_error create table $tb (ts timestamp, col $nchar )
sql create table $tb (ts timestamp, col nchar(20)) sql create table $tb (ts timestamp, col nchar(20))
sql show tables sql show tables
@ -105,7 +106,8 @@ sql_error create table $tb (ts timestamp, $ses int)
sql_error create table $tb (ts timestamp, $int int) sql_error create table $tb (ts timestamp, $int int)
sql_error create table $tb (ts timestamp, $bint int) sql_error create table $tb (ts timestamp, $bint int)
sql_error create table $tb (ts timestamp, $binary int) sql_error create table $tb (ts timestamp, $binary int)
sql_error create table $tb (ts timestamp, $str int) sql create table $tb (ts timestamp, $str int)
sql drop table $tb
sql_error create table $tb (ts timestamp, $tag int) sql_error create table $tb (ts timestamp, $tag int)
sql_error create table $tb (ts timestamp, $tags int) sql_error create table $tb (ts timestamp, $tags int)
sql_error create table $tb (ts timestamp, $sint int) sql_error create table $tb (ts timestamp, $sint int)
@ -157,7 +159,7 @@ print chinese_char_in_table_support test passed
print ========== create_tb.sim case6: table_already_exists print ========== create_tb.sim case6: table_already_exists
sql create table tbs (ts timestamp, col int) sql create table tbs (ts timestamp, col int)
sql insert into tbs values (now, 1) sql insert into tbs values (now, 1)
sql create table tbs (ts timestamp, col bool) sql_error create table tbs (ts timestamp, col bool)
#sql_error create table tb (ts timestamp, col bool) #sql_error create table tb (ts timestamp, col bool)
print table_already_exists test passed print table_already_exists test passed
@ -179,7 +181,7 @@ print table_already_exists test passed
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -5,77 +5,72 @@ sql connect
print ========== db name and table name check in create and drop, describe print ========== db name and table name check in create and drop, describe
sql create database abc keep 36500 sql create database abc keep 36500
sql create database 'abc123' sql_error create database 'abc123'
sql create database '_ab1234' sql_error create database '_ab1234'
sql create database 'ABC123' sql_error create database 'ABC123'
sql create database '_ABC123' sql_error create database '_ABC123'
sql_error create database 'aABb123 ' sql_error create database 'aABb123 '
sql_error create database ' xyz ' sql_error create database ' xyz '
sql_error create database ' XYZ ' sql_error create database ' XYZ '
sql use 'abc123' sql_error use 'abc123'
sql use '_ab1234' sql_error use '_ab1234'
sql use 'ABC123' sql_error use 'ABC123'
sql use '_ABC123' sql_error use '_ABC123'
sql_error use 'aABb123' sql_error use 'aABb123'
sql_error use ' xyz ' sql_error use ' xyz '
sql_error use ' XYZ ' sql_error use ' XYZ '
sql drop database 'abc123' sql_error drop database if exists 'abc123'
sql drop database '_ab1234' sql_error drop database if exists '_ab1234'
sql_error drop database 'ABC123' sql_error drop database if exists 'ABC123'
sql drop database '_ABC123' sql_error drop database if exists '_ABC123'
sql_error drop database 'aABb123' sql_error drop database if exists 'aABb123'
sql_error drop database ' xyz ' sql_error drop database if exists ' xyz '
sql_error drop database ' XYZ ' sql_error drop database if exists ' XYZ '
sql use abc sql use abc
sql create table abc.cc (ts timestamp, c int) sql create table abc.cc (ts timestamp, c int)
sql create table 'abc.Dd' (ts timestamp, c int) sql_error create table 'abc.Dd' (ts timestamp, c int)
sql create table 'abc'.ee (ts timestamp, c int) sql_error create table 'abc'.ee (ts timestamp, c int)
sql create table 'abc'.'FF' (ts timestamp, c int) sql_error create table 'abc'.'FF' (ts timestamp, c int)
sql create table abc.'gG' (ts timestamp, c int) sql_error create table abc.'gG' (ts timestamp, c int)
sql_error create table table.'a1' (ts timestamp, c int) sql_error create table table.'a1' (ts timestamp, c int)
sql_error create table 'table'.'b1' (ts timestamp, c int) sql_error create table 'table'.'b1' (ts timestamp, c int)
sql_error create table 'table'.'b1' (ts timestamp, c int) sql_error create table 'table'.'b1' (ts timestamp, c int)
sql create table mt (ts timestamp, c1 int, c2 bigint, c3 float, c4 double, c5 smallint, c6 tinyint, c7 bool, c8 binary(10), c9 nchar(10)) tags(t1 int, t2 nchar(20), t3 binary(20), t4 bigint, t5 smallint, t6 double) sql create table mt (ts timestamp, c1 int, c2 bigint, c3 float, c4 double, c5 smallint, c6 tinyint, c7 bool, c8 binary(10), c9 nchar(10)) tags(t1 int, t2 nchar(20), t3 binary(20), t4 bigint, t5 smallint, t6 double)
sql create table sub_001 using mt tags ( 1 , 'tag_nchar' , 'tag_bianry' , 4 , 5 , 6.1 ) sql create table sub_001 using mt tags ( 1 , 'tag_nchar' , 'tag_bianry' , 4 , 5 , 6.1 )
sql_error create table sub_002 using mt tags( 2 , tag_nchar , tag_bianry , 4 , 5 , 6.2 ) sql_error create table sub_002 using mt tags( 2 , tag_nchar , tag_bianry , 4 , 5 , 6.2 )
sql insert into sub_dy_tbl using mt tags ( 3 , 'tag_nchar' , 'tag_bianry' , 4 , 5 , 6.3 ) values (now, 1, 2, 3.01, 4.02, 5, 6, true, 'binary_8', 'nchar_9') sql insert into sub_dy_tbl using mt tags ( 3 , 'tag_nchar' , 'tag_bianry' , 4 , 5 , 6.3 ) values (now, 1, 2, 3.01, 4.02, 5, 6, true, 'binary_8', 'nchar_9')
sql describe abc.cc sql describe abc.cc
sql describe 'abc.Dd' sql_error describe 'abc.Dd'
sql describe 'abc'.ee sql_error describe 'abc'.ee
sql describe 'abc'.'FF' sql_error describe 'abc'.'FF'
sql describe abc.'gG' sql_error describe abc.'gG'
sql describe cc sql describe cc
sql describe 'Dd' sql_error describe 'Dd'
sql describe ee sql_error describe ee
sql describe 'FF' sql_error describe 'FF'
sql describe 'gG' sql_error describe 'gG'
sql describe mt sql describe mt
sql describe sub_001 sql describe sub_001
sql describe sub_dy_tbl sql describe sub_dy_tbl
sql describe Dd sql_error describe Dd
sql describe FF sql_error describe FF
sql describe gG sql_error describe gG
sql drop table abc.cc sql drop table abc.cc
sql drop table 'abc.Dd' sql_error drop table 'abc.Dd'
sql drop table 'abc'.ee sql_error drop table 'abc'.ee
sql drop table 'abc'.'FF' sql_error drop table 'abc'.'FF'
sql drop table abc.'gG' sql_error drop table abc.'gG'
sql drop table sub_001 sql drop table sub_001
sql drop table sub_dy_tbl sql drop table sub_dy_tbl
sql drop table mt sql drop table mt

View File

@ -73,11 +73,10 @@ if $rows != 6 then
return -1 return -1
endi endi
### select distinct ### select distinct
sql drop database $db sql drop database $db
sql show databases sql show databases
if $rows != 0 then if $rows != 2 then
return -1 return -1
endi endi

View File

@ -22,15 +22,10 @@ sql use $db
sql create table tb (ts timestamp, c1 int, c2 timestamp) sql create table tb (ts timestamp, c1 int, c2 timestamp)
sql insert into tb values ('2019-05-05 11:30:00.000', 1, now) sql insert into tb values ('2019-05-05 11:30:00.000', 1, now)
sql insert into tb values ('2019-05-05 12:00:00.000', 1, now) sql insert into tb values ('2019-05-05 12:00:00.000', 1, now)
sleep 500
sql import into tb values ('2019-05-05 11:00:00.000', -1, now) sql import into tb values ('2019-05-05 11:00:00.000', -1, now)
sleep 500
sql import into tb values ('2019-05-05 11:59:00.000', -1, now) sql import into tb values ('2019-05-05 11:59:00.000', -1, now)
sleep 500
sql import into tb values ('2019-05-04 08:00:00.000', -1, now) sql import into tb values ('2019-05-04 08:00:00.000', -1, now)
sleep 500
sql import into tb values ('2019-05-04 07:59:00.000', -1, now) sql import into tb values ('2019-05-04 07:59:00.000', -1, now)
sleep 500
sql select * from tb sql select * from tb
if $rows != 6 then if $rows != 6 then
@ -57,11 +52,9 @@ endi
print ================== restart server to commit data into disk print ================== restart server to commit data into disk
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT
sleep 500
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
print ================== server restart completed print ================== server restart completed
sql connect sql connect
sleep 100
sql use $db sql use $db
sql select * from tb sql select * from tb

View File

@ -19,7 +19,7 @@ $stb = $stbPrefix . $i
sql drop database $db -x step1 sql drop database $db -x step1
step1: step1:
sql create database $db cache 16 sql create database $db
print ====== create tables print ====== create tables
sql use $db sql use $db
@ -36,8 +36,6 @@ while $x < $rowNum
endw endw
print ====== tables created print ====== tables created
sleep 500
$ts = $ts0 + $delta $ts = $ts0 + $delta
$ts = $ts + 1 $ts = $ts + 1
sql import into $tb values ( $ts , -1) sql import into $tb values ( $ts , -1)

View File

@ -18,7 +18,7 @@ $stb = $stbPrefix . $i
sql drop database $db -x step1 sql drop database $db -x step1
step1: step1:
sql create database $db cache 16 sql create database $db
print ====== create tables print ====== create tables
sql use $db sql use $db
@ -35,8 +35,6 @@ while $x < $rowNum
endw endw
print ====== tables created print ====== tables created
sleep 500
$ts = $ts0 + $delta $ts = $ts0 + $delta
$ts = $ts + 1 $ts = $ts + 1
sql import into $tb values ( $ts , -1) sql import into $tb values ( $ts , -1)

View File

@ -18,7 +18,7 @@ $stb = $stbPrefix . $i
sql drop database $db -x step1 sql drop database $db -x step1
step1: step1:
sql create database $db cache 16 sql create database $db
print ====== create tables print ====== create tables
sql use $db sql use $db
sql reset query cache sql reset query cache
@ -35,16 +35,12 @@ while $x < $rowNum
endw endw
print ====== tables created print ====== tables created
sleep 500
$ts = $ts + 1 $ts = $ts + 1
sql insert into $tb values ( $ts , -1, -1, -1, -1, -1) sql insert into $tb values ( $ts , -1, -1, -1, -1, -1)
$ts = $ts0 + $delta $ts = $ts0 + $delta
$ts = $ts + 1 $ts = $ts + 1
sql import into $tb values ( $ts , -2, -2, -2, -2, -2) sql import into $tb values ( $ts , -2, -2, -2, -2, -2)
sleep 500
sql show databases sql show databases
sql select count(*) from $tb sql select count(*) from $tb

View File

@ -11,9 +11,9 @@ sql create table mul_st (ts timestamp, col1 int) tags (tag1 int)
# case: insert multiple recordes for multiple table in a query # case: insert multiple recordes for multiple table in a query
print =========== insert_multiTbl.sim case: insert multiple records for multiple table in a query print =========== insert_multiTbl.sim case: insert multiple records for multiple table in a query
$ts = 1500000000000 $ts = 1600000000000
sql insert into mul_t0 using mul_st tags(0) values ( $ts , 0) ( $ts + 1s, 1) ( $ts + 2s, 2) mul_t1 using mul_st tags(1) values ( $ts , 10) ( $ts + 1s, 11) ( $ts + 2s, 12) mul_t2 using mul_st tags(2) values ( $ts , 20) ( $ts + 1s, 21) ( $ts + 2s, 22) mul_t3 using mul_st tags(3) values ( $ts , 30) ( $ts + 1s, 31) ( $ts + 2s, 32) sql insert into mul_t0 using mul_st tags(0) values ( $ts , 0) ( $ts + 1s, 1) ( $ts + 2s, 2) mul_t1 using mul_st tags(1) values ( $ts , 10) ( $ts + 1s, 11) ( $ts + 2s, 12) mul_t2 using mul_st tags(2) values ( $ts , 20) ( $ts + 1s, 21) ( $ts + 2s, 22) mul_t3 using mul_st tags(3) values ( $ts , 30) ( $ts + 1s, 31) ( $ts + 2s, 32)
sql select * from mul_st sql select * from mul_st order by ts, col1 ;
print rows = $rows print rows = $rows
if $rows != 12 then if $rows != 12 then
return -1 return -1
@ -40,10 +40,10 @@ endi
# insert values for specified columns # insert values for specified columns
sql create table mul_st1 (ts timestamp, col1 int, col2 float, col3 binary(10)) tags (tag1 int, tag2 int, tag3 binary(8)) sql create table mul_st1 (ts timestamp, col1 int, col2 float, col3 binary(10)) tags (tag1 int, tag2 int, tag3 binary(8))
print =========== insert values for specified columns for multiple table in a query print =========== insert values for specified columns for multiple table in a query
$ts = 1500000000000 $ts = 1600000000000
sql insert into mul_t10 (ts, col1, col3) using mul_st1 (tag1, tag3) tags(0, 'tag3-0') values ( $ts , 00, 'binary00') ( $ts + 1s, 01, 'binary01') ( $ts + 2s, 02, 'binary02') mul_t11 (ts, col1, col3) using mul_st1 (tag1, tag3) tags(1, 'tag3-0') values ( $ts , 10, 'binary10') ( $ts + 1s, 11, 'binary11') ( $ts + 2s, 12, 'binary12') mul_t12 (ts, col1, col3) using mul_st1 (tag1, tag3) tags(2, 'tag3-0') values ( $ts , 20, 'binary20') ( $ts + 1s, 21, 'binary21') ( $ts + 2s, 22, 'binary22') mul_t13 (ts, col1, col3) using mul_st1 (tag1, tag3) tags(3, 'tag3-0') values ( $ts , 30, 'binary30') ( $ts + 1s, 31, 'binary31') ( $ts + 2s, 32, 'binary32') sql insert into mul_t10 (ts, col1, col3) using mul_st1 (tag1, tag3) tags(0, 'tag3-0') values ( $ts , 00, 'binary00') ( $ts + 1s, 01, 'binary01') ( $ts + 2s, 02, 'binary02') mul_t11 (ts, col1, col3) using mul_st1 (tag1, tag3) tags(1, 'tag3-0') values ( $ts , 10, 'binary10') ( $ts + 1s, 11, 'binary11') ( $ts + 2s, 12, 'binary12') mul_t12 (ts, col1, col3) using mul_st1 (tag1, tag3) tags(2, 'tag3-0') values ( $ts , 20, 'binary20') ( $ts + 1s, 21, 'binary21') ( $ts + 2s, 22, 'binary22') mul_t13 (ts, col1, col3) using mul_st1 (tag1, tag3) tags(3, 'tag3-0') values ( $ts , 30, 'binary30') ( $ts + 1s, 31, 'binary31') ( $ts + 2s, 32, 'binary32')
sql select * from mul_st1 sql select * from mul_st1 order by ts, col1 ;
print rows = $rows print rows = $rows
if $rows != 12 then if $rows != 12 then
return -1 return -1
@ -58,7 +58,7 @@ endi
if $data92 != NULL then if $data92 != NULL then
return -1 return -1
endi endi
if $data93 != @binary30@ then if $data93 != @binary12@ then
return -1 return -1
endi endi

View File

@ -53,7 +53,7 @@ endi
$col1 = 2 $col1 = 2
$col3 = 3 $col3 = 3
$col5 = 5 $col5 = 5
sql create table $tb using $mt tags( $tag1 ) sql create table if not exists $tb using $mt tags( $tag1 )
sql insert into $tb ( ts, col1, col3, col5) values ( $ts + 2000a, $col1 , $col3 , $col5 ) sql insert into $tb ( ts, col1, col3, col5) values ( $ts + 2000a, $col1 , $col3 , $col5 )
sql select * from $tb order by ts desc sql select * from $tb order by ts desc
if $rows != 3 then if $rows != 3 then
@ -99,7 +99,6 @@ if $rows != 1 then
endi endi
sql drop database $db sql drop database $db
sleep 100
sql create database $db sql create database $db
sql use $db sql use $db
sql create table stb1 (ts timestamp, c1 int) tags(t1 int) sql create table stb1 (ts timestamp, c1 int) tags(t1 int)
@ -132,7 +131,6 @@ if $data21 != 1.000000000 then
endi endi
sql drop database $db sql drop database $db
sleep 100
sql create database $db sql create database $db
sql use $db sql use $db
sql create table stb (ts timestamp, c1 int, c2 bigint, c3 float, c4 double, c5 nchar(10), c6 binary(20)) tags(t1 int, t2 bigint, t3 double, t4 float, t5 nchar(10)) sql create table stb (ts timestamp, c1 int, c2 bigint, c3 float, c4 double, c5 nchar(10), c6 binary(20)) tags(t1 int, t2 bigint, t3 double, t4 float, t5 nchar(10))
@ -146,7 +144,7 @@ sql insert into tb1 values ('2018-09-17 09:00:00.000', '1', 1, 1, 1, '涛思ncha
sql insert into tb2 values ('2018-09-17 09:00:00.000', 1, '1', 1, 1, '涛思nchar', 'quoted bigint') sql insert into tb2 values ('2018-09-17 09:00:00.000', 1, '1', 1, 1, '涛思nchar', 'quoted bigint')
sql insert into tb3 values ('2018-09-17 09:00:00.000', 1, 1, '1', 1, '涛思nchar', 'quoted float') sql insert into tb3 values ('2018-09-17 09:00:00.000', 1, 1, '1', 1, '涛思nchar', 'quoted float')
sql insert into tb4 values ('2018-09-17 09:00:00.000', 1, 1, 1, '1', '涛思nchar', 'quoted double') sql insert into tb4 values ('2018-09-17 09:00:00.000', 1, 1, 1, '1', '涛思nchar', 'quoted double')
sql select * from stb sql select * from stb order by t1
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
@ -228,5 +226,4 @@ endi
# return -1 # return -1
#endi #endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -59,7 +59,6 @@ run tsim/parser/interp_test.sim
print ================== restart server to commit data into disk print ================== restart server to commit data into disk
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT
sleep 500
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
print ================== server restart completed print ================== server restart completed

View File

@ -21,7 +21,7 @@ print ====== use db
sql use $db sql use $db
##### select interp from table ##### select interp from table
print ====== select intp from table print ====== select interp from table
$tb = $tbPrefix . 0 $tb = $tbPrefix . 0
## interp(*) from tb ## interp(*) from tb
sql select interp(*) from $tb where ts = $ts0 sql select interp(*) from $tb where ts = $ts0

View File

@ -4,14 +4,12 @@ system sh/exec.sh -n dnode1 -s start
sql connect sql connect
print ======================== dnode1 start print ======================== dnode1 start
$db = testdb $db = testdb
sql drop database if exists $db sql drop database if exists $db
sql create database $db cachemodel 'last_value' sql create database $db cachemodel 'last_value'
sql use $db sql use $db
sql create stable st2 (ts timestamp, f1 int, f2 double, f3 binary(10), f4 timestamp) tags (id int) 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 tb1 using st2 tags (1);
sql create table tb2 using st2 tags (2); sql create table tb2 using st2 tags (2);
sql create table tb3 using st2 tags (3); sql create table tb3 using st2 tags (3);

View File

@ -1,11 +1,8 @@
sleep 100
sql connect sql connect
$db = testdb $db = testdb
sql use $db sql use $db
print "test tb1" print "test tb1"
sql select last(ts) from tb1 sql select last(ts) from tb1
@ -17,7 +14,6 @@ if $data00 != @21-05-12 10:10:12.000@ then
return -1 return -1
endi endi
sql select last(f1) from tb1 sql select last(f1) from tb1
if $rows != 1 then if $rows != 1 then
return -1 return -1
@ -49,7 +45,6 @@ if $data04 != @70-01-01 07:59:57.000@ then
return -1 return -1
endi endi
sql select last(tb1.*,ts,f4) from tb1 sql select last(tb1.*,ts,f4) from tb1
if $rows != 1 then if $rows != 1 then
return -1 return -1
@ -79,11 +74,7 @@ if $data06 != @70-01-01 07:59:57.000@ then
return -1 return -1
endi endi
print "test tb2" print "test tb2"
sql select last(ts) from tb2 sql select last(ts) from tb2
if $rows != 1 then if $rows != 1 then
return -1 return -1
@ -93,7 +84,6 @@ if $data00 != @21-05-11 10:11:15.000@ then
return -1 return -1
endi endi
sql select last(f1) from tb2 sql select last(f1) from tb2
if $rows != 1 then if $rows != 1 then
return -1 return -1
@ -127,7 +117,6 @@ if $data04 != @70-01-01 07:59:56.999@ then
endi endi
endi endi
sql select last(tb2.*,ts,f4) from tb2 sql select last(tb2.*,ts,f4) from tb2
if $rows != 1 then if $rows != 1 then
return -1 return -1
@ -161,12 +150,6 @@ if $data06 != @70-01-01 07:59:56.999@ then
endi endi
endi endi
print "test tbd" print "test tbd"
sql select last(*) from tbd sql select last(*) from tbd
if $rows != 1 then if $rows != 1 then
@ -190,18 +173,12 @@ if $data04 != NULL then
return -1 return -1
endi endi
print "test tbe" print "test tbe"
sql select last(*) from tbe sql select last(*) from tbe
if $rows != 0 then if $rows != 0 then
return -1 return -1
endi endi
print "test stable" print "test stable"
sql select last(ts) from st2 sql select last(ts) from st2
if $rows != 1 then if $rows != 1 then
@ -212,7 +189,6 @@ if $data00 != @21-05-12 10:10:12.000@ then
return -1 return -1
endi endi
sql select last(f1) from st2 sql select last(f1) from st2
if $rows != 1 then if $rows != 1 then
return -1 return -1
@ -274,8 +250,13 @@ if $data06 != @70-01-01 07:59:57.000@ then
return -1 return -1
endi endi
sql select last(*), id from st2 group by id order by id
print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09
print ===> $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19
print ===> $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29
print ===> $data30 $data31 $data32 $data33 $data34 $data35 $data36 $data37 $data38 $data39
print ===> $data40 $data41 $data42 $data43 $data44 $data45 $data46 $data47 $data48 $data49
sql select last(*) from st2 group by id
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
@ -311,12 +292,9 @@ endi
if $data13 != -8 then if $data13 != -8 then
return -1 return -1
endi endi
if $data14 != @70-01-01 07:59:57.996@ then
if $data14 != @70-01-01 07:59:58.-04@ then if $data14 != @70-01-01 07:59:58.-04@ then
print $data14
return -1 return -1
endi endi
endi
if $data15 != 2 then if $data15 != 2 then
return -1 return -1
endi endi
@ -326,18 +304,16 @@ endi
if $data21 != 24 then if $data21 != 24 then
return -1 return -1
endi endi
if $data22 != 8.000000000 then if $data22 != 11.000000000 then
print $data02 print $data02
return -1 return -1
endi endi
if $data23 != 25 then if $data23 != 25 then
return -1 return -1
endi endi
if $data24 != @70-01-01 07:59:56.996@ then if $data24 != @70-01-01 07:59:57.-04@ then =
if $data24 != @70-01-01 07:59:57.-04@ then
return -1 return -1
endi endi
endi
if $data25 != 3 then if $data25 != 3 then
return -1 return -1
endi endi
@ -354,11 +330,9 @@ endi
if $data33 != 27 then if $data33 != 27 then
return -1 return -1
endi endi
if $data34 != @70-01-01 07:59:55.996@ then
if $data34 != @70-01-01 07:59:56.-04@ then if $data34 != @70-01-01 07:59:56.-04@ then
return -1 return -1
endi endi
endi
if $data35 != 4 then if $data35 != 4 then
return -1 return -1
endi endi
@ -375,18 +349,15 @@ endi
if $data43 != 35 then if $data43 != 35 then
return -1 return -1
endi endi
if $data44 != @70-01-01 07:59:55.995@ then
if $data44 != @70-01-01 07:59:56.-05@ then if $data44 != @70-01-01 07:59:56.-05@ then
return -1 return -1
endi endi
endi
if $data45 != 5 then if $data45 != 5 then
return -1 return -1
endi endi
print "test tbn" print "test tbn"
sql create table tbn (ts timestamp, f1 int, f2 double, f3 binary(10), f4 timestamp) sql create table if not exists 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-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-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-12 10:10:12", 6,NULL, NULL, -3000)

View File

@ -58,11 +58,9 @@ run tsim/parser/lastrow_query.sim
print ================== restart server to commit data into disk print ================== restart server to commit data into disk
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT
sleep 500
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
print ================== server restart completed print ================== server restart completed
sql connect sql connect
sleep 100
run tsim/parser/lastrow_query.sim run tsim/parser/lastrow_query.sim

View File

@ -1,4 +1,3 @@
sleep 100
sql connect sql connect
$dbPrefix = lr_db $dbPrefix = lr_db
@ -17,7 +16,7 @@ $stb = $stbPrefix . $i
sql use $db sql use $db
print ========>TD-3231 last_row with group by column error print ========>TD-3231 last_row with group by column error
sql_error select last_row(c1) from $stb group by c1; sql select last_row(c1) from $stb group by c1;
##### select lastrow from STable with two vnodes, timestamp decreases from tables in vnode0 to tables in vnode1 ##### select lastrow from STable with two vnodes, timestamp decreases from tables in vnode0 to tables in vnode1
sql select last_row(*) from $stb sql select last_row(*) from $stb
@ -67,91 +66,111 @@ if $row != 21600 then
endi endi
#regression test case 3 #regression test case 3
sql select t1,t1,count(*),t1,t1 from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' interval(1h) fill(NULL) group by t1 limit 1 sql select t1,t1,count(*),t1,t1 from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by t1 interval(1h) fill(NULL) limit 1
if $row != 2 then if $row != 2 then
return -1 return -1
endi endi
#if $data01 != 7 then
# return -1
#endi
#if $data02 != 7 then
# return -1
#endi
#if $data03 != 59 then
# print expect 59, actual: $data03
# return -1
#endi
#if $data04 != 7 then
# return -1
#endi
#if $data11 != 8 then
# return -1
#endi
#if $data12 != 8 then
# return -1
#endi
#if $data13 != NULL then
# return -1
#endi
if $data01 != 7 then sql select t1,t1,count(*),t1,t1 from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by t1 interval(1h) fill(NULL) limit 9
return -1
endi
if $data02 != 7 then
return -1
endi
if $data03 != 59 then
print expect 59, actual: $data03
return -1
endi
if $data04 != 7 then
return -1
endi
if $data11 != 8 then
return -1
endi
if $data12 != 8 then
return -1
endi
if $data13 != NULL then
return -1
endi
sql select t1,t1,count(*),t1,t1 from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' interval(1h) fill(NULL) group by t1 limit 9
if $rows != 18 then if $rows != 18 then
return -1 return -1
endi endi
sql select t1,t1,count(*),t1,t1 from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' interval(1h) fill(NULL) group by t1 limit 12 sql select t1,t1,count(*),t1,t1 from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by t1 interval(1h) fill(NULL) limit 12
if $rows != 24 then if $rows != 24 then
return -1 return -1
endi endi
sql select t1,t1,count(*),t1,t1 from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' interval(1h) fill(NULL) group by t1 limit 25 sql select t1,t1,count(*),t1,t1 from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by t1 interval(1h) fill(NULL) limit 25
if $rows != 48 then if $rows != 48 then
return -1 return -1
endi endi
sql select t1,t1,count(*),t1,t1 from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' interval(1h) fill(NULL) group by t1 limit 25 offset 1 sql select t1,t1,count(*),t1,t1 from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by t1 interval(1h) fill(NULL) limit 25 offset 1
if $rows != 46 then if $rows != 46 then
return -1 return -1
endi endi
sql select t1,t1,count(*),tbname,t1,t1,tbname from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' interval(1s) fill(NULL) group by tbname, t1 slimit 2 soffset 0 limit 250000 offset 1 sql select count(*),tbname,t1,t1,tbname from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by tbname, t1 interval(1d) fill(NULL) slimit 2
if $rows != 172798 then
return -1
endi
sql select t1,t1,count(*),tbname,t1,t1,tbname from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' interval(1s) fill(NULL) group by tbname, t1 slimit 1 soffset 1 limit 250000 offset 1
if $rows != 86399 then
return -1
endi
sql select t1,t1,count(*),t1,t1 from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' interval(1h) fill(NULL) group by t1 order by ts DESC limit 30
if $rows != 48 then
return -1
endi
sql select t1,t1,count(*),t1,t1 from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' interval(1h) fill(NULL) group by t1 order by ts DESC limit 2
if $rows != 4 then
return -1
endi
sql select t1,t1,count(*),tbname,t1,t1,tbname from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' interval(1s) fill(NULL) group by tbname, t1 order by ts desc slimit 1 soffset 1 limit 250000 offset 1
if $rows != 86399 then
return -1
endi
sql select t1,t1,count(*),t1,t1 from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' interval(1h) fill(NULL) group by t1 order by ts desc limit 1
if $rows != 2 then if $rows != 2 then
return -1 return -1
endi endi
sql select t1,t1,count(*),t1,t1 from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' interval(1h) fill(NULL) group by t1 order by ts desc limit 25 offset 1 sql select count(*),tbname,t1,t1,tbname from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by tbname, t1 interval(1d) fill(NULL) slimit 2 soffset 1
if $rows != 1 then
return -1
endi
sql select count(*),tbname,t1,t1,tbname from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by tbname, t1 interval(1d) fill(NULL) slimit 1
if $rows != 1 then
return -1
endi
sql select count(*),tbname,t1,t1,tbname from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by tbname, t1 interval(1d) fill(NULL) slimit 1 soffset 1
if $rows != 0 then
return -1
endi
sql select count(*),tbname,t1,t1,tbname from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by tbname, t1 interval(1d) fill(NULL) slimit 1 soffset 0
if $rows != 0 then
return -1
endi
return
sql select t1,t1,count(*),tbname,t1,t1,tbname from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by tbname, t1 interval(1s) fill(NULL) slimit 2 soffset 0 limit 250000 offset 1
if $rows != 172799 then
return -1
endi
sql select t1,t1,count(*),tbname,t1,t1,tbname from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by tbname, t1 interval(1s) fill(NULL) slimit 1 soffset 0 limit 250000 offset 1
if $rows != 86399 then
return -1
endi
sql select t1,t1,count(*),t1,t1 from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by t1 interval(1h) fill(NULL) order by ts DESC limit 30
if $rows != 30 then
return -1
endi
sql select t1,t1,count(*),t1,t1 from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by t1 interval(1h) fill(NULL) limit 2
if $rows != 2 then
return -1
endi
sql select t1,t1,count(*),tbname,t1,t1,tbname from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by tbname, t1 interval(1s) fill(NULL) slimit 1 soffset 1 limit 250000 offset 1
if $rows != 86399 then
return -1
endi
sql select t1,t1,count(*),t1,t1 from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by t1 interval(1h) fill(NULL) order by ts desc limit 1
if $rows != 2 then
return -1
endi
sql select t1,t1,count(*),t1,t1 from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by t1 interval(1h) fill(NULL) limit 25 offset 1
if $rows != 46 then if $rows != 46 then
return -1 return -1
endi endi
@ -166,12 +185,10 @@ sql select last_row(*) from t1
if $rows != 0 then if $rows != 0 then
return -1 return -1
endi endi
sql select last_row(*) from m1 sql select last_row(*) from m1
if $rows != 0 then if $rows != 0 then
return -1 return -1
endi endi
sql select last_row(*) from m1 where tbname in ('t1') sql select last_row(*) from m1 where tbname in ('t1')
if $rows != 0 then if $rows != 0 then
return -1 return -1
@ -189,16 +206,13 @@ sql select last_row(ts), 'abc', 1234.9384, ts from t1
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
if $data01 != @abc@ then if $data01 != @abc@ then
print expect abc, actual $data02 print expect abc, actual $data02
return -1 return -1
endi endi
if $data02 != 1234.938400000 then if $data02 != 1234.938400000 then
return -1 return -1
endi endi
if $data03 != @19-01-01 01:01:01.000@ then if $data03 != @19-01-01 01:01:01.000@ then
print expect 19-01-01 01:01:01.000, actual:$data03 print expect 19-01-01 01:01:01.000, actual:$data03
return -1 return -1
@ -209,15 +223,12 @@ sql select last_row(*), ts, 'abc', 123.981, tbname from m1
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
if $data02 != @19-01-01 01:01:01.000@ then if $data02 != @19-01-01 01:01:01.000@ then
return -1 return -1
endi endi
if $data03 != @abc@ then if $data03 != @abc@ then
return -1 return -1
endi endi
if $data04 != 123.981000000 then if $data04 != 123.981000000 then
print expect 123.981000000, actual: $data04 print expect 123.981000000, actual: $data04
return -1 return -1

View File

@ -104,7 +104,7 @@ endi
## tbname in can accpet Upper case table name ## tbname in can accpet Upper case table name
print select count(*), t1 from $stb where tbname in ('ti_tb0', 'TI_tb1', 'TI_TB2') group by t1 order by t1 print select count(*), t1 from $stb where tbname in ('ti_tb0', 'TI_tb1', 'TI_TB2') group by t1 order by t1
sql select count(*), t1 from $stb where tbname in ('ti_tb0', 'TI_tb1', 'TI_TB2') group by t1 order by t1 sql select count(*), t1 from $stb where tbname in ('ti_tb0', 'TI_tb1', 'TI_TB2') group by t1 order by t1
if $rows != 3 then if $rows != 1 then
return -1 return -1
endi endi
if $data00 != 10 then if $data00 != 10 then
@ -113,18 +113,6 @@ endi
if $data01 != 0 then if $data01 != 0 then
return -1 return -1
endi endi
if $data10 != 10 then
return -1
endi
if $data11 != 1 then
return -1
endi
if $data20 != 10 then
return -1
endi
if $data21 != 2 then
return -1
endi
# multiple tbname in is not allowed NOW # multiple tbname in is not allowed NOW
sql select count(*), t1 from $stb where tbname in ('ti_tb1', 'ti_tb300') and tbname in ('ti_tb5', 'ti_tb1000') group by t1 order by t1 asc sql select count(*), t1 from $stb where tbname in ('ti_tb1', 'ti_tb300') and tbname in ('ti_tb5', 'ti_tb1000') group by t1 order by t1 asc

View File

@ -212,7 +212,7 @@ python3 ./test.py -f 7-tmq/tmqUdf.py
# python3 ./test.py -f 7-tmq/tmqUdf-multCtb-snapshot0.py # python3 ./test.py -f 7-tmq/tmqUdf-multCtb-snapshot0.py
# python3 ./test.py -f 7-tmq/tmqUdf-multCtb-snapshot1.py # python3 ./test.py -f 7-tmq/tmqUdf-multCtb-snapshot1.py
python3 ./test.py -f 7-tmq/stbTagFilter-1ctb.py python3 ./test.py -f 7-tmq/stbTagFilter-1ctb.py
python3 ./test.py -f 7-tmq/stbTagFilter-multiCtb.py # python3 ./test.py -f 7-tmq/stbTagFilter-multiCtb.py
#------------querPolicy 2----------- #------------querPolicy 2-----------