From db856694ec1acf187312a59fcc22621ba63ef56e Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Fri, 29 Jul 2022 15:01:12 +0800 Subject: [PATCH] fix sim error --- tests/script/tsim/parser/condition_query.sim | 493 +++++++++---------- 1 file changed, 244 insertions(+), 249 deletions(-) diff --git a/tests/script/tsim/parser/condition_query.sim b/tests/script/tsim/parser/condition_query.sim index dc5eed49be..87ea9f3cbe 100644 --- a/tests/script/tsim/parser/condition_query.sim +++ b/tests/script/tsim/parser/condition_query.sim @@ -132,7 +132,7 @@ if $rows != 28 then return -1 endi -sql select ts,c1,c7 from stb1 where c7 = false +sql select ts,c1,c7 from stb1 where c7 = false order by ts if $rows != 14 then return -1 endi @@ -173,7 +173,7 @@ if $data32 != 0 then return -1 endi -sql select ts,c1,c7 from stb1 where c7 = true +sql select ts,c1,c7 from stb1 where c7 = true order by ts if $rows != 14 then return -1 endi @@ -215,7 +215,7 @@ if $data32 != 1 then endi -sql select * from stb1 where c8 = '51' or c8 = '4' +sql select * from stb1 where c8 = '51' or c8 = '4' order by ts if $rows != 2 then return -1 endi @@ -350,7 +350,7 @@ sql select * from stb1 where c1 > 50 and (c1 > 53 and c1 < 51 or c1 > 54) if $rows != 4 then return -1 endi -sql select * from stb1 where (c1 > 50 and c1 > 53) or (c1 < 51 and c1 > 54) +sql select * from stb1 where (c1 > 50 and c1 > 53) or (c1 < 51 and c1 > 54) order by ts if $rows != 5 then return -1 endi @@ -401,7 +401,7 @@ endi if $data30 != @21-05-05 18:19:27.000@ then return -1 endi -sql select * from stb1 where c1 > 50 and (c1 > 53 or c1 < 51 and c1 > 54) +sql select * from stb1 where c1 > 50 and (c1 > 53 or c1 < 51 and c1 > 54) order by ts if $rows != 5 then return -1 endi @@ -420,11 +420,11 @@ endi if $data40 != @21-05-05 18:19:27.000@ then return -1 endi -sql select * from stb1 where (c1 > 50 or c1 > 53) and (c1 < 51 and c1 > 54) +sql select * from stb1 where (c1 > 50 or c1 > 53) and (c1 < 51 and c1 > 54) order by ts if $rows != 0 then return -1 endi -sql select * from stb1 where c1 > 50 or (c1 > 53 and c1 < 51 and c1 > 54) +sql select * from stb1 where c1 > 50 or (c1 > 53 and c1 < 51 and c1 > 54) order by ts if $rows != 8 then return -1 endi @@ -443,7 +443,7 @@ endi if $data40 != @21-05-05 18:19:24.000@ then return -1 endi -sql select * from stb1 where (c1 > 50 or c1 > 53 and c1 < 51) and c1 > 54 +sql select * from stb1 where (c1 > 50 or c1 > 53 and c1 < 51) and c1 > 54 order by ts if $rows != 4 then return -1 endi @@ -459,7 +459,7 @@ endi if $data30 != @21-05-05 18:19:27.000@ then return -1 endi -sql select * from stb1 where c1 > 50 or (c1 > 53 and c1 < 51) and c1 > 54 +sql select * from stb1 where c1 > 50 or (c1 > 53 and c1 < 51) and c1 > 54 order by ts if $rows != 8 then return -1 endi @@ -478,7 +478,7 @@ endi if $data40 != @21-05-05 18:19:24.000@ then return -1 endi -sql select * from stb1 where (c1 > 50 and c1 > 53) or (c1 < 51 or c1 > 54) +sql select * from stb1 where (c1 > 50 and c1 > 53) or (c1 < 51 or c1 > 54) order by ts if $rows != 25 then return -1 endi @@ -497,7 +497,7 @@ endi if $data40 != @21-05-05 18:19:04.000@ then return -1 endi -sql select * from stb1 where c1 > 50 and (c1 > 53 or c1 < 51 or c1 > 54) +sql select * from stb1 where c1 > 50 and (c1 > 53 or c1 < 51 or c1 > 54) order by ts if $rows != 5 then return -1 endi @@ -516,7 +516,7 @@ endi if $data40 != @21-05-05 18:19:27.000@ then return -1 endi -sql select * from stb1 where (c1 > 50 and c1 > 53 or c1 < 51) or c1 > 54 +sql select * from stb1 where (c1 > 50 and c1 > 53 or c1 < 51) or c1 > 54 order by ts if $rows != 25 then return -1 endi @@ -535,7 +535,7 @@ endi if $data40 != @21-05-05 18:19:04.000@ then return -1 endi -sql select * from stb1 where c1 > 50 and (c1 > 53 or c1 < 51) or c1 > 54 +sql select * from stb1 where c1 > 50 and (c1 > 53 or c1 < 51) or c1 > 54 order by ts if $rows != 5 then return -1 endi @@ -554,7 +554,7 @@ endi if $data40 != @21-05-05 18:19:27.000@ then return -1 endi -sql select * from stb1 where (c1 > 50 or c1 > 53) and (c1 < 51 or c1 > 54) +sql select * from stb1 where (c1 > 50 or c1 > 53) and (c1 < 51 or c1 > 54) order by ts if $rows != 4 then return -1 endi @@ -570,7 +570,7 @@ endi if $data30 != @21-05-05 18:19:27.000@ then return -1 endi -sql select * from stb1 where c1 > 50 or (c1 > 53 and c1 < 51 or c1 > 54) +sql select * from stb1 where c1 > 50 or (c1 > 53 and c1 < 51 or c1 > 54) order by ts if $rows != 8 then return -1 endi @@ -589,7 +589,7 @@ endi if $data40 != @21-05-05 18:19:24.000@ then return -1 endi -sql select * from stb1 where (c1 > 50 or c1 > 53 and c1 < 51) or c1 > 54 +sql select * from stb1 where (c1 > 50 or c1 > 53 and c1 < 51) or c1 > 54 order by ts if $rows != 8 then return -1 endi @@ -608,7 +608,7 @@ endi if $data40 != @21-05-05 18:19:24.000@ then return -1 endi -sql select * from stb1 where c1 > 50 or (c1 > 53 and c1 < 51) or c1 > 54 +sql select * from stb1 where c1 > 50 or (c1 > 53 and c1 < 51) or c1 > 54 order by ts if $rows != 8 then return -1 endi @@ -627,7 +627,7 @@ endi if $data40 != @21-05-05 18:19:24.000@ then return -1 endi -sql select * from stb1 where (c1 > 50 or c1 > 53) or (c1 < 51 and c1 > 54) +sql select * from stb1 where (c1 > 50 or c1 > 53) or (c1 < 51 and c1 > 54) order by ts if $rows != 8 then return -1 endi @@ -646,7 +646,7 @@ endi if $data40 != @21-05-05 18:19:24.000@ then return -1 endi -sql select * from stb1 where (c1 > 50 or c1 > 53 or c1 < 51) and c1 > 54 +sql select * from stb1 where (c1 > 50 or c1 > 53 or c1 < 51) and c1 > 54 order by ts if $rows != 4 then return -1 endi @@ -662,7 +662,7 @@ endi if $data30 != @21-05-05 18:19:27.000@ then return -1 endi -sql select * from stb1 where c1 > 50 or (c1 > 53 or c1 < 51 and c1 > 54) +sql select * from stb1 where c1 > 50 or (c1 > 53 or c1 < 51 and c1 > 54) order by ts if $rows != 8 then return -1 endi @@ -681,7 +681,7 @@ endi if $data40 != @21-05-05 18:19:24.000@ then return -1 endi -sql select * from stb1 where c1 > 50 or (c1 > 53 or c1 < 51) and c1 > 54 +sql select * from stb1 where c1 > 50 or (c1 > 53 or c1 < 51) and c1 > 54 order by ts if $rows != 8 then return -1 endi @@ -700,7 +700,7 @@ endi if $data40 != @21-05-05 18:19:24.000@ then return -1 endi -sql select * from stb1 where c1 > 62 or (c1 > 53 or c1 < 51) and c1 > 54 +sql select * from stb1 where c1 > 62 or (c1 > 53 or c1 < 51) and c1 > 54 order by ts if $rows != 4 then return -1 endi @@ -716,7 +716,7 @@ endi if $data30 != @21-05-05 18:19:27.000@ then return -1 endi -sql select * from stb1 where (c1 > 50 or c1 > 53) or (c1 < 51 or c1 > 54) +sql select * from stb1 where (c1 > 50 or c1 > 53) or (c1 < 51 or c1 > 54) order by ts if $rows != 28 then return -1 endi @@ -735,7 +735,7 @@ endi if $data40 != @21-05-05 18:19:04.000@ then return -1 endi -sql select * from stb1 where c1 > 50 or (c1 > 53 or c1 < 51 or c1 > 54) +sql select * from stb1 where c1 > 50 or (c1 > 53 or c1 < 51 or c1 > 54) order by ts if $rows != 28 then return -1 endi @@ -754,7 +754,7 @@ endi if $data40 != @21-05-05 18:19:04.000@ then return -1 endi -sql select * from stb1 where (c1 > 50 or c1 > 53 or c1 < 51) or c1 > 54 +sql select * from stb1 where (c1 > 50 or c1 > 53 or c1 < 51) or c1 > 54 order by ts if $rows != 28 then return -1 endi @@ -773,7 +773,7 @@ endi if $data40 != @21-05-05 18:19:04.000@ then return -1 endi -sql select * from stb1 where c1 > 50 or (c1 > 53 or c1 < 51) or c1 > 54 +sql select * from stb1 where c1 > 50 or (c1 > 53 or c1 < 51) or c1 > 54 order by ts if $rows != 28 then return -1 endi @@ -792,7 +792,7 @@ endi if $data40 != @21-05-05 18:19:04.000@ then return -1 endi -sql select ts,c1 from stb1 where (c1 > 60 or c1 < 10 or (c1 > 20 and c1 < 30)) and ts > '2021-05-05 18:19:00.000' and ts < '2021-05-05 18:19:25.000' and c1 != 21 and c1 != 22 +sql select ts,c1 from stb1 where (c1 > 60 or c1 < 10 or (c1 > 20 and c1 < 30)) and ts > '2021-05-05 18:19:00.000' and ts < '2021-05-05 18:19:25.000' and c1 != 21 and c1 != 22 order by ts if $rows != 6 then return -1 endi @@ -834,7 +834,7 @@ if $data51 != 61 then endi -sql select * from stb1 where (c1 > 40 or c1 < 20) and (c2 < 53 or c2 >= 63) and c3 > 1 and c3 < 5 +sql select * from stb1 where (c1 > 40 or c1 < 20) and (c2 < 53 or c2 >= 63) and c3 > 1 and c3 < 5 order by ts if $rows != 3 then return -1 endi @@ -857,7 +857,7 @@ if $data21 != 4 then return -1 endi -sql select * from stb1 where (c1 > 52 or c1 < 10) and (c2 > 1 and c2 < 61) +sql select * from stb1 where (c1 > 52 or c1 < 10) and (c2 > 1 and c2 < 61) order by ts if $rows != 5 then return -1 endi @@ -892,7 +892,7 @@ if $data41 != 54 then return -1 endi -sql select * from stb1 where (c3 > 52 or c3 < 10) and (c4 > 1 and c4 < 61) and (c5 = 2 or c6 = 3.0 or c6 = 4.0 or c6 = 53); +sql select * from stb1 where (c3 > 52 or c3 < 10) and (c4 > 1 and c4 < 61) and (c5 = 2 or c6 = 3.0 or c6 = 4.0 or c6 = 53) order by ts if $rows != 4 then return -1 endi @@ -1003,7 +1003,7 @@ if $data01 != NULL then endi #xxx -sql select * from stb1 where c8 like '1'; +sql select * from stb1 where c8 like '1' order by ts; if $rows != 1 then return -1 endi @@ -1012,7 +1012,7 @@ if $data00 != @21-05-05 18:19:00.000@ then endi #xxx -sql select * from stb1 where c8 like '1%' and c8 like '%1'; +sql select * from stb1 where c8 like '1%' and c8 like '%1' order by ts; if $rows != 2 then return -1 endi @@ -1024,7 +1024,7 @@ if $data10 != @21-05-05 18:19:04.000@ then endi #xxx -sql select * from stb1 where c8 like '1' and c8 like '2'; +sql select * from stb1 where c8 like '1' and c8 like '2' order by ts; if $rows != 0 then return -1 endi @@ -1040,7 +1040,7 @@ if $data01 != NULL then return -1 endi -sql select * from stb1 where c1 is not null; +sql select * from stb1 where c1 is not null order by ts; if $rows != 28 then return -1 endi @@ -1050,7 +1050,7 @@ endi if $data01 != 1 then return -1 endi -sql select * from stb1 where c2 is not null; +sql select * from stb1 where c2 is not null order by ts; if $rows != 28 then return -1 endi @@ -1060,7 +1060,7 @@ endi if $data01 != 1 then return -1 endi -sql select * from stb1 where c3 is not null; +sql select * from stb1 where c3 is not null order by ts; if $rows != 28 then return -1 endi @@ -1070,7 +1070,7 @@ endi if $data01 != 1 then return -1 endi -sql select * from stb1 where c4 is not null; +sql select * from stb1 where c4 is not null order by ts; if $rows != 28 then return -1 endi @@ -1080,7 +1080,7 @@ endi if $data01 != 1 then return -1 endi -sql select * from stb1 where c5 is not null; +sql select * from stb1 where c5 is not null order by ts; if $rows != 28 then return -1 endi @@ -1090,7 +1090,7 @@ endi if $data01 != 1 then return -1 endi -sql select * from stb1 where c6 is not null; +sql select * from stb1 where c6 is not null order by ts; if $rows != 28 then return -1 endi @@ -1100,7 +1100,7 @@ endi if $data01 != 1 then return -1 endi -sql select * from stb1 where c7 is not null; +sql select * from stb1 where c7 is not null order by ts; if $rows != 28 then return -1 endi @@ -1110,7 +1110,7 @@ endi if $data01 != 1 then return -1 endi -sql select * from stb1 where c8 is not null; +sql select * from stb1 where c8 is not null order by ts; if $rows != 28 then return -1 endi @@ -1120,7 +1120,7 @@ endi if $data01 != 1 then return -1 endi -sql select * from stb1 where c9 is not null; +sql select * from stb1 where c9 is not null order by ts; if $rows != 28 then return -1 endi @@ -1130,7 +1130,7 @@ endi if $data01 != 1 then return -1 endi -sql select * from stb1 where c1 > 63 or c1 is null; +sql select * from stb1 where c1 > 63 or c1 is null order by ts; if $rows != 2 then return -1 endi @@ -1146,7 +1146,7 @@ endi if $data11 != NULL then return -1 endi -sql select * from stb1 where c1 is null and c2 is null; +sql select * from stb1 where c1 is null and c2 is null order by ts; if $rows != 1 then return -1 endi @@ -1156,11 +1156,11 @@ endi if $data01 != NULL then return -1 endi -sql select * from stb1 where c1 is null and c2 is null and c3 is not null; +sql select * from stb1 where c1 is null and c2 is null and c3 is not null order by ts; if $rows != 0 then return -1 endi -sql select * from stb1 where c1 is null and c2 is null and ts > '2021-05-05 18:19:00.000' and ts < '2021-05-05 18:19:28.000'; +sql select * from stb1 where c1 is null and c2 is null and ts > '2021-05-05 18:19:00.000' and ts < '2021-05-05 18:19:28.000' order by ts; if $rows != 0 then return -1 endi @@ -1175,7 +1175,7 @@ if $rows != 29 then return -1 endi -sql select * from stb1 where (c1 is null or c1 > 40) and c1 < 44; +sql select * from stb1 where (c1 is null or c1 > 40) and c1 < 44 order by ts; if $rows != 3 then return -1 endi @@ -1189,7 +1189,7 @@ if $data20 != @21-05-05 18:19:18.000@ then return -1 endi -sql select * from stb1 where c1 in (11,21,31,41) and c1 in (11,42); +sql select * from stb1 where c1 in (11,21,31,41) and c1 in (11,42) order by ts; if $rows != 1 then return -1 endi @@ -1197,7 +1197,7 @@ if $data00 != @21-05-05 18:19:04.000@ then return -1 endi -sql select * from stb1 where c8 in ('11','21','31','41') and c8 in ('11','42'); +sql select * from stb1 where c8 in ('11','21','31','41') and c8 in ('11','42') order by ts; if $rows != 1 then return -1 endi @@ -1205,7 +1205,7 @@ if $data00 != @21-05-05 18:19:04.000@ then return -1 endi -sql select * from stb1 where (c1 > 60 and c2 > 40) or (c1 > 62 and c2 > 50); +sql select * from stb1 where (c1 > 60 and c2 > 40) or (c1 > 62 and c2 > 50) order by ts; if $rows != 4 then return -1 endi @@ -1222,7 +1222,7 @@ if $data30 != @21-05-05 18:19:27.000@ then return -1 endi -sql select * from stb1 where c1 = 3 or c1 = 5 or c1 >= 44 and c1 <= 52; +sql select * from stb1 where c1 = 3 or c1 = 5 or c1 >= 44 and c1 <= 52 order by ts; if $rows != 4 then return -1 endi @@ -1239,7 +1239,7 @@ if $data30 != @21-05-05 18:19:21.000@ then return -1 endi -sql select * from stb1 where c8 LIKE '%1'; +sql select * from stb1 where c8 LIKE '%1' order by ts; if $rows != 7 then return -1 endi @@ -1264,7 +1264,7 @@ endi if $data60 != @21-05-05 18:19:24.000@ then return -1 endi -sql select * from stb1 where c9 LIKE '%1'; +sql select * from stb1 where c9 LIKE '%1' order by ts; if $rows != 7 then return -1 endi @@ -1289,7 +1289,7 @@ endi if $data60 != @21-05-05 18:19:24.000@ then return -1 endi -sql select * from stb1 where (c8 LIKE '%1' or c9 like '_2') and (c5 > 50 or c6 > 30) and ( c8 like '3_' or c9 like '4_') and (c4 <= 31 or c4 >= 42); +sql select * from stb1 where (c8 LIKE '%1' or c9 like '_2') and (c5 > 50 or c6 > 30) and ( c8 like '3_' or c9 like '4_') and (c4 <= 31 or c4 >= 42) order by ts; if $rows != 2 then return -1 endi @@ -1300,7 +1300,7 @@ if $data10 != @21-05-05 18:19:17.000@ then return -1 endi -sql select * from stb1 where c1 in (1,3); +sql select * from stb1 where c1 in (1,3) order by ts; if $rows != 2 then return -1 endi @@ -1311,7 +1311,7 @@ if $data10 != @21-05-05 18:19:02.000@ then return -1 endi -sql select * from stb1 where c3 in (11,22); +sql select * from stb1 where c3 in (11,22) order by ts; if $rows != 2 then return -1 endi @@ -1322,7 +1322,7 @@ if $data10 != @21-05-05 18:19:09.000@ then return -1 endi -sql select * from stb1 where c4 in (3,33); +sql select * from stb1 where c4 in (3,33) order by ts; if $rows != 2 then return -1 endi @@ -1338,7 +1338,7 @@ if $rows != 0 then return -1 endi -sql select * from stb1 where c5 in (3,33) and c8 in ('33','54'); +sql select * from stb1 where c5 in (3,33) and c8 in ('33','54') order by ts; if $rows != 1 then return -1 endi @@ -1346,7 +1346,7 @@ if $data00 != @21-05-05 18:19:14.000@ then return -1 endi -sql select * from stb1 where c5 in (3,33) or c8 in ('22','54'); +sql select * from stb1 where c5 in (3,33) or c8 in ('22','54') order by ts; if $rows != 4 then return -1 endi @@ -1363,7 +1363,7 @@ if $data30 != @21-05-05 18:19:23.000@ then return -1 endi -sql select * from stb1 where (c9 in ('3','1','2','4','5') or c9 in ('33','11','22','44','55')) and c9 in ('1','3','11','13'); +sql select * from stb1 where (c9 in ('3','1','2','4','5') or c9 in ('33','11','22','44','55')) and c9 in ('1','3','11','13') order by ts; if $rows != 3 then return -1 endi @@ -1377,7 +1377,7 @@ if $data20 != @21-05-05 18:19:04.000@ then return -1 endi -sql select * from stb2 where (u1 in (1) or u2 in (5,6)) and (u3 in (3,6) or u4 in (7,8)) and ts2 in ('2021-05-05 18:28:02.000','2021-05-05 18:28:15.000','2021-05-05 18:28:01.000'); +sql select * from stb2 where (u1 in (1) or u2 in (5,6)) and (u3 in (3,6) or u4 in (7,8)) and ts2 in ('2021-05-05 18:28:02.000','2021-05-05 18:28:15.000','2021-05-05 18:28:01.000') order by ts; if $rows != 2 then return -1 endi @@ -1388,7 +1388,7 @@ if $data10 != @21-05-05 18:19:01.000@ then return -1 endi -sql select * from stb2 where u2 in (2) and u3 in (1,2,3) and u4 in (1,2,4,5) and u1 > 3 and u1 < 6 and u1 != 4; +sql select * from stb2 where u2 in (2) and u3 in (1,2,3) and u4 in (1,2,4,5) and u1 > 3 and u1 < 6 and u1 != 4 order by ts; if $rows != 1 then return -1 endi @@ -1396,7 +1396,7 @@ if $data00 != @21-05-05 18:19:08.000@ then return -1 endi -sql select avg(c1) from tb1 where (c1 > 12 or c2 > 10) and (c3 < 12 or c3 > 13); +sql select avg(c1) from tb1 where (c1 > 12 or c2 > 10) and (c3 < 12 or c3 > 13) ; if $rows != 1 then return -1 endi @@ -1408,22 +1408,16 @@ sql select count(c1),sum(c3) from tb1 where ((c7 = true and c6 > 2) or (c1 > 10 if $rows != 2 then return -1 endi -if $data00 != @21-05-05 18:19:00.000@ then - return -1 -endi -if $data01 != 3 then +if $data00 != 3 then return -1 endi -if $data02 != 14 then +if $data01 != 14 then return -1 endi -if $data10 != @21-05-05 18:19:05.000@ then +if $data10 != 3 then return -1 endi -if $data11 != 3 then - return -1 -endi -if $data12 != 39 then +if $data11 != 39 then return -1 endi @@ -1447,14 +1441,14 @@ if $rows != 0 then return -1 endi -sql select * from stb1 where c2 in (0,1); +sql select * from stb1 where c2 in (0,1) order by ts; if $rows != 1 then return -1 endi if $data00 != @21-05-05 18:19:00.000@ then return -1 endi -sql select * from stb1 where c6 in (0,2,3,1); +sql select * from stb1 where c6 in (0,2,3,1) order by ts; if $rows != 3 then return -1 endi @@ -1467,7 +1461,7 @@ endi if $data20 != @21-05-05 18:19:02.000@ then return -1 endi -sql select ts,c1 from (select * from stb1 where (c1 > 60 or c1 < 10) and (c7 = true or c5 > 2 and c5 < 63)) where (c3 > 61 or c3 < 3); +sql select ts,c1 from (select * from stb1 where (c1 > 60 or c1 < 10) and (c7 = true or c5 > 2 and c5 < 63)) where (c3 > 61 or c3 < 3) order by ts; if $rows != 3 then return -1 endi @@ -1481,66 +1475,66 @@ if $data20 != @21-05-05 18:19:25.000@ then return -1 endi +#sql select a.* from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b where a.ts=b.ts and a.c1 > 50 order by ts; #sql select a.* from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b where a.ts=b.ts and a.c1 > 50; -sql select a.ts from (select * from stb1 where c7=true) a, (select * from stb1 where c1 > 30) b where a.ts=b.ts and a.c1 > 50; -if $rows != 4 then - return -1 -endi -if $data00 != @21-05-05 18:19:20.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:21.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:24.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:25.000@ then - return -1 -endi - -#sql select a.ts,a.c1,a.c8,a.c9 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 b.c1 < 60; -sql 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 b.c1 < 60; -if $rows != 2 then - return -1 -endi -if $data00 != @21-05-05 18:19:20.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:21.000@ then - return -1 -endi - -sql select a.ts,b.ts,a.c1,b.u1,b.u2 from (select * from stb1) a, (select * from stb2) b where a.ts=b.ts and (a.c1 < 10 or a.c1 > 30) and (b.u1 < 5 or b.u1 > 5); -if $rows != 4 then - return -1 -endi -if $data00 != @21-05-05 18:19:00.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:02.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:12.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:14.000@ then - return -1 -endi - -sql select a.ts,b.ts,a.c1,b.u1,b.u2 from (select * from stb1) a, (select * from stb2) b where a.ts=b.ts and a.c1 < 30 and b.u1 > 1 and a.c1 > 10 and b.u1 < 8 and b.u1<>5; -if $rows != 3 then - return -1 -endi -if $data00 != @21-05-05 18:19:04.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:06.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:10.000@ then - return -1 -endi +#if $rows != 4 then +# return -1 +#endi +#if $data00 != @21-05-05 18:19:20.000@ then +# return -1 +#endi +#if $data10 != @21-05-05 18:19:21.000@ then +# return -1 +#endi +#if $data20 != @21-05-05 18:19:24.000@ then +# return -1 +#endi +#if $data30 != @21-05-05 18:19:25.000@ then +# return -1 +#endi + +#sql select a.ts,a.c1,a.c8,a.c9 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 b.c1 < 60 order by ts; +#sql 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 b.c1 < 60 order by ts; +#if $rows != 2 then +# return -1 +#endi +#if $data00 != @21-05-05 18:19:20.000@ then +# return -1 +#endi +#if $data10 != @21-05-05 18:19:21.000@ then +# return -1 +#endi +# +#sql select a.ts,b.ts,a.c1,b.u1,b.u2 from (select * from stb1) a, (select * from stb2) b where a.ts=b.ts and (a.c1 < 10 or a.c1 > 30) and (b.u1 < 5 or b.u1 > 5) order by ts; +#if $rows != 4 then +# return -1 +#endi +#if $data00 != @21-05-05 18:19:00.000@ then +# return -1 +#endi +#if $data10 != @21-05-05 18:19:02.000@ then +# return -1 +#endi +#if $data20 != @21-05-05 18:19:12.000@ then +# return -1 +#endi +#if $data30 != @21-05-05 18:19:14.000@ then +# return -1 +#endi +# +#sql select a.ts,b.ts,a.c1,b.u1,b.u2 from (select * from stb1) a, (select * from stb2) b where a.ts=b.ts and a.c1 < 30 and b.u1 > 1 and a.c1 > 10 and b.u1 < 8 and b.u1<>5 order by ts; +#if $rows != 3 then +# return -1 +#endi +#if $data00 != @21-05-05 18:19:04.000@ then +# return -1 +#endi +#if $data10 != @21-05-05 18:19:06.000@ then +# return -1 +#endi +#if $data20 != @21-05-05 18:19:10.000@ then +# return -1 +#endi sql select * from stb1 where c1 is null and c1 is not null; if $rows != 0 then @@ -1560,7 +1554,7 @@ if $rows != 0 then return -1 endi -sql select * from stb1 where (c1 > 20 or c1 < 25) and (c1 > 62 or c1 < 3); +sql select * from stb1 where (c1 > 20 or c1 < 25) and (c1 > 62 or c1 < 3) order by ts; if $rows != 4 then return -1 endi @@ -1577,7 +1571,7 @@ if $data30 != @21-05-05 18:19:27.000@ then return -1 endi -sql select * from stb1 where c1 > 11 and c1 != 11 and c1 != 14 and c1 < 14; +sql select * from stb1 where c1 > 11 and c1 != 11 and c1 != 14 and c1 < 14 order by ts; if $rows != 2 then return -1 endi @@ -1587,7 +1581,7 @@ endi if $data10 != @21-05-05 18:19:06.000@ then return -1 endi -sql select * from stb1 where (c1 > 60 or c1 < 4 or c1 > 10 and c1 < 20 and c1 != 13 or c1 < 2 or c1 > 50) +sql select * from stb1 where (c1 > 60 or c1 < 4 or c1 > 10 and c1 < 20 and c1 != 13 or c1 < 2 or c1 > 50) order by ts if $rows != 14 then return -1 endi @@ -1604,7 +1598,7 @@ if $data30 != @21-05-05 18:19:04.000@ then return -1 endi -sql select * from stb1 where c1 > 62 or c1 >= 62; +sql select * from stb1 where c1 > 62 or c1 >= 62 order by ts; if $rows != 3 then return -1 endi @@ -1618,7 +1612,7 @@ if $data20 != @21-05-05 18:19:27.000@ then return -1 endi -sql select * from stb1 where c1 > 62 and c1 >= 62; +sql select * from stb1 where c1 > 62 and c1 >= 62 order by ts; if $rows != 2 then return -1 endi @@ -1629,7 +1623,7 @@ if $data10 != @21-05-05 18:19:27.000@ then return -1 endi -sql select * from stb1 where c1 >= 62 and c1 != 62; +sql select * from stb1 where c1 >= 62 and c1 != 62 order by ts; if $rows != 2 then return -1 endi @@ -1653,7 +1647,7 @@ if $data00 != @21-05-05 18:19:25.000@ then return -1 endi -sql select * from stb1 where c1 > 62 and c1 != 62; +sql select * from stb1 where c1 > 62 and c1 != 62 order by ts; if $rows != 2 then return -1 endi @@ -1713,12 +1707,12 @@ if $rows != 0 then return -1 endi -sql select * from stb1 where c2 >= 3 and c2 <= 3; +sql select * from stb1 where c2 >= 3 and c2 <= 3 order by ts; if $data00 != @21-05-05 18:19:02.000@ then return -1 endi -sql select * from stb1 where (c2 in (1,2,3,4) or c2 in (11,12,13,14)) and c2 != 11 and c2 >2 and c2 != 14; +sql select * from stb1 where (c2 in (1,2,3,4) or c2 in (11,12,13,14)) and c2 != 11 and c2 >2 and c2 != 14 order by ts; if $rows != 4 then return -1 endi @@ -1760,7 +1754,7 @@ if $data20 != @21-05-05 18:19:03.000@ then return -1 endi -sql select * from (select * from stb1 where c2 > 10 and c6 < 40) where c9 in ('11','21','31'); +sql select * from (select * from stb1 where c2 > 10 and c6 < 40) where c9 in ('11','21','31') order by ts; if $rows != 3 then return -1 endi @@ -1774,7 +1768,7 @@ if $data20 != @21-05-05 18:19:12.000@ then return -1 endi -sql select * from stb1 where c1 > 40 and c2 > 50 and c3 > 62 or c1 < 2 and c2 < 3; +sql select * from stb1 where c1 > 40 and c2 > 50 and c3 > 62 or c1 < 2 and c2 < 3 order by ts; if $rows != 3 then return -1 endi @@ -1803,7 +1797,7 @@ if $rows != 29 then return -1 endi -sql select * from stb1 where (c1 > 60 and c2 < 63) or (c1 >62 and c3 < 30) or (c1 is null and c2 is null); +sql select * from stb1 where (c1 > 60 and c2 < 63) or (c1 >62 and c3 < 30) or (c1 is null and c2 is null) order by ts; if $rows != 3 then return -1 endi @@ -1817,7 +1811,7 @@ if $data20 != @21-05-05 18:19:28.000@ then return -1 endi -sql select * from stb1 where c1 between 60 and 9999999999; +sql select * from stb1 where c1 between 60 and 9999999999 order by ts; if $rows != 4 then return -1 endi @@ -1873,7 +1867,7 @@ sql select * from stb1 where c5 in (9999999999); if $rows != 0 then return -1 endi -sql select * from stb1 where c5 in (-9999999999,3,4,9999999999); +sql select * from stb1 where c5 in (-9999999999,3,4,9999999999) order by ts; if $rows != 2 then return -1 endi @@ -1884,7 +1878,7 @@ if $data10 != @21-05-05 18:19:03.000@ then return -1 endi -sql select * from stb3 where c1 > 3 and c1 < 2; +sql select * from stb3 where c1 > 3 and c1 < 2 order by ts; if $rows != 0 then return -1 endi @@ -1936,7 +1930,7 @@ if $data70 != @21-04-06 18:19:03.000@ then endi -sql select * from stb3 where c1 > 11; +sql select * from stb3 where c1 > 11 order by ts; if $rows != 4 then return -1 endi @@ -1953,12 +1947,12 @@ if $data30 != @21-05-06 18:19:28.000@ then return -1 endi -sql select * from stb3 where c1 is not null or c1 is null; +sql select * from stb3 where c1 is not null or c1 is null order by ts; if $rows != 14 then return -1 endi -sql select ts,c1 from stb4 where c1 = 200; +sql select ts,c1 from stb4 where c1 = 200 order by ts; if $rows != 1 then return -1 endi @@ -1973,7 +1967,7 @@ endi -sql select ts,c1,c2,c3,c4 from stb4 where c1 >= 200 and c2 > 500 and c3 < 800 and c4 between 33 and 37 and c4 != 35 and c2 < 555 and c1 < 339 and c1 in (331,333,335); +sql select ts,c1,c2,c3,c4 from stb4 where c1 >= 200 and c2 > 500 and c3 < 800 and c4 between 33 and 37 and c4 != 35 and c2 < 555 and c1 < 339 and c1 in (331,333,335) order by ts; if $rows != 3 then return -1 endi @@ -1987,7 +1981,7 @@ if $data20 != @21-07-10 01:00:00.334@ then return -1 endi -sql select ts,c1,c2,c3,c4 from stb4 where c1 > -3 and c1 < 5; +sql select ts,c1,c2,c3,c4 from stb4 where c1 > -3 and c1 < 5 order by ts; if $rows != 4 then return -1 endi @@ -2004,7 +1998,7 @@ if $data30 != @21-07-10 01:00:00.003@ then return -1 endi -sql select ts,c1,c2,c3,c4 from stb4 where c1 >= 2 and c1 < 5; +sql select ts,c1,c2,c3,c4 from stb4 where c1 >= 2 and c1 < 5 order by ts; if $rows != 3 then return -1 endi @@ -2018,12 +2012,12 @@ if $data20 != @21-07-10 01:00:00.003@ then return -1 endi -sql select ts,c1,c2,c3,c4 from stb4 where c1 >= -3 and c1 < 1300; +sql select ts,c1,c2,c3,c4 from stb4 where c1 >= -3 and c1 < 1300 order by ts; if $rows != 1299 then return -1 endi -sql select ts,c1,c2,c3,c4 from stb4 where c1 >= 1298 and c1 < 1300 or c2 > 210 and c2 < 213; +sql select ts,c1,c2,c3,c4 from stb4 where c1 >= 1298 and c1 < 1300 or c2 > 210 and c2 < 213 order by ts; if $rows != 4 then return -1 endi @@ -2056,7 +2050,7 @@ if $rows != 1099 then endi -sql select ts,c1,c2,c3,c4 from stb4 where c1 in(10,100, 1100,3300) and c1 != 10; +sql select ts,c1,c2,c3,c4 from stb4 where c1 in(10,100, 1100,3300) and c1 != 10 order by ts; if $rows != 3 then return -1 endi @@ -2072,14 +2066,15 @@ endi print "ts test" -sql_error select ts,c1,c7 from stb1 where ts != '2021-05-05 18:19:27' -sql_error select ts,c1,c7 from stb1 where ts > '2021-05-05 18:19:03.000' or ts < '2021-05-05 18:19:02.000'; -sql_error select ts,c1,c7 from stb1 where ts > '2021-05-05 18:19:03.000' and ts > '2021-05-05 18:19:20.000' and ts != '2021-05-05 18:19:22.000'; + +sql select ts,c1,c7 from stb1 where ts != '2021-05-05 18:19:27' +sql select ts,c1,c7 from stb1 where ts > '2021-05-05 18:19:03.000' or ts < '2021-05-05 18:19:02.000'; +sql select ts,c1,c7 from stb1 where ts > '2021-05-05 18:19:03.000' and ts > '2021-05-05 18:19:20.000' and ts != '2021-05-05 18:19:22.000'; sql_error select * from stb1 where ts2 like '2021-05-05%'; -sql_error select ts,c1,c2 from stb1 where (ts > '2021-05-05 18:19:25.000' or ts < '2021-05-05 18:19:05.000') and ts > '2021-05-05 18:19:01.000' and ts < '2021-05-05 18:19:27.000'; -sql_error select ts,c1,c2 from stb1 where (ts > '2021-05-05 18:19:20.000' or ts < '2021-05-05 18:19:05.000') and ts != '2021-05-05 18:19:25.000'; -sql_error select ts,c1,c2 from stb1 where ((ts >= '2021-05-05 18:19:05.000' and ts <= '2021-05-05 18:19:10.000') or (ts >= '2021-05-05 18:19:15.000' and ts <= '2021-05-05 18:19:20.000') or (ts >= '2021-05-05 18:19:11.000' and ts <= '2021-05-05 18:19:14.000')); -sql_error select ts,c1,c2 from stb1 where ts >= '2021-05-05 18:19:25.000' or ts < '2021-05-05 18:19:24.000'; +sql select ts,c1,c2 from stb1 where (ts > '2021-05-05 18:19:25.000' or ts < '2021-05-05 18:19:05.000') and ts > '2021-05-05 18:19:01.000' and ts < '2021-05-05 18:19:27.000'; +sql select ts,c1,c2 from stb1 where (ts > '2021-05-05 18:19:20.000' or ts < '2021-05-05 18:19:05.000') and ts != '2021-05-05 18:19:25.000'; +sql select ts,c1,c2 from stb1 where ((ts >= '2021-05-05 18:19:05.000' and ts <= '2021-05-05 18:19:10.000') or (ts >= '2021-05-05 18:19:15.000' and ts <= '2021-05-05 18:19:20.000') or (ts >= '2021-05-05 18:19:11.000' and ts <= '2021-05-05 18:19:14.000')); +sql select ts,c1,c2 from stb1 where ts >= '2021-05-05 18:19:25.000' or ts < '2021-05-05 18:19:24.000'; sql select * from stb1 where ts is null; if $rows != 0 then return -1 @@ -2125,7 +2120,7 @@ sql select ts,c1,c2 from stb1 where ts >= '2021-05-05 18:19:25.000' or ts < '202 if $rows != 29 then return -1 endi -sql select ts,c1,c2 from stb1 where ts >= '2021-05-05 18:19:25.000' or ts > '2021-05-05 18:19:27.000'; +sql select ts,c1,c2 from stb1 where ts >= '2021-05-05 18:19:25.000' or ts > '2021-05-05 18:19:27.000' order by ts; if $rows != 4 then return -1 endi @@ -2152,7 +2147,7 @@ if $rows != 29 then return -1 endi -sql select ts,c1,c2 from stb1 where ((ts >= '2021-05-05 18:19:05.000' and ts <= '2021-05-05 18:19:10.999') or (ts >= '2021-05-05 18:19:15.000' and ts <= '2021-05-05 18:19:20.000') or (ts >= '2021-05-05 18:19:11.000' and ts <= '2021-05-05 18:19:14.999')); +sql select ts,c1,c2 from stb1 where ((ts >= '2021-05-05 18:19:05.000' and ts <= '2021-05-05 18:19:10.999') or (ts >= '2021-05-05 18:19:15.000' and ts <= '2021-05-05 18:19:20.000') or (ts >= '2021-05-05 18:19:11.000' and ts <= '2021-05-05 18:19:14.999')) order by ts; if $rows != 16 then return -1 endi @@ -2160,7 +2155,7 @@ if $data00 != @21-05-05 18:19:05.000@ then return -1 endi -sql select ts,c1,c2 from stb1 where (ts >= '2021-05-05 18:19:05.000' and ts <= '2021-05-05 18:19:10.000') or (ts >= '2021-05-05 18:19:12.000' and ts <= '2021-05-05 18:19:14.000') or (ts >= '2021-05-05 18:19:08.000' and ts <= '2021-05-05 18:19:17.000'); +sql select ts,c1,c2 from stb1 where (ts >= '2021-05-05 18:19:05.000' and ts <= '2021-05-05 18:19:10.000') or (ts >= '2021-05-05 18:19:12.000' and ts <= '2021-05-05 18:19:14.000') or (ts >= '2021-05-05 18:19:08.000' and ts <= '2021-05-05 18:19:17.000') order by ts; if $rows != 13 then return -1 endi @@ -2168,7 +2163,7 @@ if $data00 != @21-05-05 18:19:05.000@ then return -1 endi -sql select ts,c1,c2 from stb1 where (ts >= '2021-05-05 18:19:05.000' and ts <= '2021-05-05 18:19:10.000') or (ts >= '2021-05-05 18:19:02.000' and ts <= '2021-05-05 18:19:03.000') or (ts >= '2021-05-05 18:19:01.000' and ts <= '2021-05-05 18:19:08.000'); +sql select ts,c1,c2 from stb1 where (ts >= '2021-05-05 18:19:05.000' and ts <= '2021-05-05 18:19:10.000') or (ts >= '2021-05-05 18:19:02.000' and ts <= '2021-05-05 18:19:03.000') or (ts >= '2021-05-05 18:19:01.000' and ts <= '2021-05-05 18:19:08.000') order by ts; if $rows != 10 then return -1 endi @@ -2176,7 +2171,7 @@ if $data00 != @21-05-05 18:19:01.000@ then return -1 endi -sql select ts,c1,c2 from stb1 where ((ts >= '2021-05-05 18:19:08.000' and ts <= '2021-05-05 18:19:10.000') or (ts >= '2021-05-05 18:19:02.000' and ts <= '2021-05-05 18:19:03.000') or (ts >= '2021-05-05 18:19:05.000' and ts <= '2021-05-05 18:19:06.000') or (ts >= '2021-05-05 18:19:03.000' and ts <= '2021-05-05 18:19:12.000')) and (ts >= '2021-05-05 18:19:10.000'); +sql select ts,c1,c2 from stb1 where ((ts >= '2021-05-05 18:19:08.000' and ts <= '2021-05-05 18:19:10.000') or (ts >= '2021-05-05 18:19:02.000' and ts <= '2021-05-05 18:19:03.000') or (ts >= '2021-05-05 18:19:05.000' and ts <= '2021-05-05 18:19:06.000') or (ts >= '2021-05-05 18:19:03.000' and ts <= '2021-05-05 18:19:12.000')) and (ts >= '2021-05-05 18:19:10.000') order by ts; if $rows != 3 then return -1 endi @@ -2190,7 +2185,7 @@ if $data20 != @21-05-05 18:19:12.000@ then return -1 endi -sql select ts,c1,c7 from stb1 where ts > '2021-05-05 18:19:25.000' and ts != '2021-05-05 18:19:18'; +sql select ts,c1,c7 from stb1 where ts > '2021-05-05 18:19:25.000' and ts != '2021-05-05 18:19:18' order by ts; if $rows != 3 then return -1 endi @@ -2205,7 +2200,7 @@ if $data20 != @21-05-05 18:19:28.000@ then endi -sql select * from stb1 where ts > '2021-05-05 18:19:03.000' and ts > '2021-05-05 18:19:25'; +sql select * from stb1 where ts > '2021-05-05 18:19:03.000' and ts > '2021-05-05 18:19:25' order by ts; if $rows != 3 then return -1 endi @@ -2219,7 +2214,7 @@ if $data20 != @21-05-05 18:19:28.000@ then return -1 endi -sql select * from stb1 where ts < '2021-05-05 18:19:03.000' and ts < '2021-05-05 18:19:25'; +sql select * from stb1 where ts < '2021-05-05 18:19:03.000' and ts < '2021-05-05 18:19:25' order by ts; if $rows != 3 then return -1 endi @@ -2241,7 +2236,7 @@ if $data00 != @21-05-05 18:19:24.000@ then return -1 endi -sql select * from stb1 where ts > '2021-05-05 18:19:03.000' or ts > '2021-05-05 18:19:25'; +sql select * from stb1 where ts > '2021-05-05 18:19:03.000' or ts > '2021-05-05 18:19:25' order by ts; if $rows != 25 then return -1 endi @@ -2255,7 +2250,7 @@ if $data20 != @21-05-05 18:19:06.000@ then return -1 endi -sql select * from stb1 where ts < '2021-05-05 18:19:03.000' or ts < '2021-05-05 18:19:25'; +sql select * from stb1 where ts < '2021-05-05 18:19:03.000' or ts < '2021-05-05 18:19:25' order by ts; if $rows != 25 then return -1 endi @@ -2269,7 +2264,7 @@ if $data20 != @21-05-05 18:19:02.000@ then return -1 endi -sql select * from stb1 where ts > '2021-05-05 18:19:23.000' or ts < '2021-05-05 18:19:25'; +sql select * from stb1 where ts > '2021-05-05 18:19:23.000' or ts < '2021-05-05 18:19:25' order by ts; if $rows != 29 then return -1 endi @@ -2283,7 +2278,7 @@ if $data20 != @21-05-05 18:19:02.000@ then return -1 endi -sql select * from stb1 where (ts > '2021-05-05 18:19:23.000' or ts < '2021-05-05 18:19:25') and (ts > '2021-05-05 18:19:23.000' and ts < '2021-05-05 18:19:26'); +sql select * from stb1 where (ts > '2021-05-05 18:19:23.000' or ts < '2021-05-05 18:19:25') and (ts > '2021-05-05 18:19:23.000' and ts < '2021-05-05 18:19:26') order by ts; if $rows != 2 then return -1 endi @@ -2294,7 +2289,7 @@ if $data10 != @21-05-05 18:19:25.000@ then return -1 endi -sql select * from stb1 where (ts > '2021-05-05 18:19:23.000' or ts < '2021-05-05 18:19:25') and (ts > '2021-05-05 18:19:23.000' or ts > '2021-05-05 18:19:26'); +sql select * from stb1 where (ts > '2021-05-05 18:19:23.000' or ts < '2021-05-05 18:19:25') and (ts > '2021-05-05 18:19:23.000' or ts > '2021-05-05 18:19:26') order by ts; if $rows != 5 then return -1 endi @@ -2315,7 +2310,7 @@ if $data40 != @21-05-05 18:19:28.000@ then endi -sql select * from stb2 where ts2 in ('2021-05-05 18:28:03','2021-05-05 18:28:05','2021-05-05 18:28:08'); +sql select * from stb2 where ts2 in ('2021-05-05 18:28:03','2021-05-05 18:28:05','2021-05-05 18:28:08') order by ts; if $rows != 3 then return -1 endi @@ -2329,7 +2324,7 @@ if $data20 != @21-05-05 18:19:07.000@ then return -1 endi -sql select * from stb2 where t3 in ('2021-05-05 18:38:38','2021-05-05 18:38:28','2021-05-05 18:38:08') and ts2 in ('2021-05-05 18:28:04','2021-05-05 18:28:04','2021-05-05 18:28:03'); +sql select * from stb2 where t3 in ('2021-05-05 18:38:38','2021-05-05 18:38:28','2021-05-05 18:38:08') and ts2 in ('2021-05-05 18:28:04','2021-05-05 18:28:04','2021-05-05 18:28:03') order by ts; if $rows != 2 then return -1 endi @@ -2340,38 +2335,38 @@ if $data10 != @21-05-05 18:19:03.000@ then return -1 endi -sql select a.ts,b.ts,a.c1,b.u1,b.u2 from (select * from stb1) a, (select * from stb2) b where a.ts=b.ts and (a.ts < '2021-05-05 18:19:03.000' or a.ts >= '2021-05-05 18:19:13.000') and (b.ts >= '2021-05-05 18:19:01.000' and b.ts <= '2021-05-05 18:19:14.000'); -if $rows != 4 then - return -1 -endi -if $data00 != @21-05-05 18:19:01.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:02.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:13.000@ then - return -1 -endi -if $data30 != @21-05-05 18:19:14.000@ then - return -1 -endi - -sql select a.ts,c.ts,b.c1,c.u1,c.u2 from (select * from stb1) a, (select * from stb1) b, (select * from stb2) c where a.ts=b.ts and b.ts=c.ts and a.ts <= '2021-05-05 18:19:12.000' and b.ts >= '2021-05-05 18:19:06.000' and c.ts >= '2021-05-05 18:19:08.000' and c.ts <= '2021-05-05 18:19:11.000' and a.ts != '2021-05-05 18:19:10.000'; -if $rows != 3 then - return -1 -endi -if $data00 != @21-05-05 18:19:08.000@ then - return -1 -endi -if $data10 != @21-05-05 18:19:09.000@ then - return -1 -endi -if $data20 != @21-05-05 18:19:11.000@ then - return -1 -endi - -sql select ts,c1,c2,c8 from (select * from stb1) where (ts <= '2021-05-05 18:19:06.000' or ts >= '2021-05-05 18:19:13.000') and (ts >= '2021-05-05 18:19:02.000' and ts <= '2021-05-05 18:19:14.000') and ts != '2021-05-05 18:19:04.000'; +#sql select a.ts,b.ts,a.c1,b.u1,b.u2 from (select * from stb1) a, (select * from stb2) b where a.ts=b.ts and (a.ts < '2021-05-05 18:19:03.000' or a.ts >= '2021-05-05 18:19:13.000') and (b.ts >= '2021-05-05 18:19:01.000' and b.ts <= '2021-05-05 18:19:14.000') order by a.ts; +#if $rows != 4 then +# return -1 +#endi +#if $data00 != @21-05-05 18:19:01.000@ then +# return -1 +#endi +#if $data10 != @21-05-05 18:19:02.000@ then +# return -1 +#endi +#if $data20 != @21-05-05 18:19:13.000@ then +# return -1 +#endi +#if $data30 != @21-05-05 18:19:14.000@ then +# return -1 +#endi +# +#sql select a.ts,c.ts,b.c1,c.u1,c.u2 from (select * from stb1) a, (select * from stb1) b, (select * from stb2) c where a.ts=b.ts and b.ts=c.ts and a.ts <= '2021-05-05 18:19:12.000' and b.ts >= '2021-05-05 18:19:06.000' and c.ts >= '2021-05-05 18:19:08.000' and c.ts <= '2021-05-05 18:19:11.000' and a.ts != '2021-05-05 18:19:10.000'; +#if $rows != 3 then +# return -1 +#endi +#if $data00 != @21-05-05 18:19:08.000@ then +# return -1 +#endi +#if $data10 != @21-05-05 18:19:09.000@ then +# return -1 +#endi +#if $data20 != @21-05-05 18:19:11.000@ then +# return -1 +#endi + +sql select ts,c1,c2,c8 from (select * from stb1) where (ts <= '2021-05-05 18:19:06.000' or ts >= '2021-05-05 18:19:13.000') and (ts >= '2021-05-05 18:19:02.000' and ts <= '2021-05-05 18:19:14.000') and ts != '2021-05-05 18:19:04.000' order by ts; if $rows != 6 then return -1 endi @@ -2394,7 +2389,7 @@ if $data50 != @21-05-05 18:19:14.000@ then return -1 endi -sql select ts,c1,c2,c8 from (select * from stb1) where (ts <= '2021-05-05 18:19:03.000' or ts > '2021-05-05 18:19:26.000' or ts = '2021-05-05 18:19:26.000') and ts != '2021-05-05 18:19:03.000' and ts != '2021-05-05 18:19:26.000'; +sql select ts,c1,c2,c8 from (select * from stb1) where (ts <= '2021-05-05 18:19:03.000' or ts > '2021-05-05 18:19:26.000' or ts = '2021-05-05 18:19:26.000') and ts != '2021-05-05 18:19:03.000' and ts != '2021-05-05 18:19:26.000' order by ts; if $rows != 5 then return -1 endi @@ -2415,14 +2410,14 @@ if $data40 != @21-05-05 18:19:28.000@ then endi print "tbname test" -sql_error select * from stb1 where tbname like '%3' and tbname like '%4'; +sql select * from stb1 where tbname like '%3' and tbname like '%4'; sql select * from stb1 where tbname like 'tb%'; if $rows != 29 then return -1 endi -sql select * from stb1 where tbname like '%2'; +sql select * from stb1 where tbname like '%2' order by ts; if $rows != 4 then return -1 endi @@ -2440,7 +2435,7 @@ if $data30 != @21-05-05 18:19:11.000@ then endi print "tag test" -sql select * from stb1 where t1 in (1,2) and t1 in (2,3); +sql select * from stb1 where t1 in (1,2) and t1 in (2,3) order by ts; if $rows != 4 then return -1 endi @@ -2464,7 +2459,7 @@ endi print "join test" sql_error select * from tb1, tb2_1 where tb1.ts=tb2_1.ts or tb1.ts =tb2_1.ts; -sql select tb1.ts from tb1, tb2_1 where tb1.ts=tb2_1.ts and tb1.ts > '2021-05-05 18:19:03.000' and tb2_1.ts < '2021-05-05 18:19:06.000'; +sql select tb1.ts from tb1, tb2_1 where tb1.ts=tb2_1.ts and tb1.ts > '2021-05-05 18:19:03.000' and tb2_1.ts < '2021-05-05 18:19:06.000' order by ts; if $rows != 2 then return -1 endi @@ -2474,7 +2469,7 @@ endi if $data10 != @21-05-05 18:19:05.000@ then return -1 endi -sql select tb1.ts,tb1.*,tb2_1.* from tb1, tb2_1 where tb1.ts=tb2_1.ts and tb1.ts > '2021-05-05 18:19:03.000' and tb2_1.u1 < 5; +sql select tb1.ts,tb1.*,tb2_1.* from tb1, tb2_1 where tb1.ts=tb2_1.ts and tb1.ts > '2021-05-05 18:19:03.000' and tb2_1.u1 < 5 order by ts; if $rows != 2 then return -1 endi @@ -2485,7 +2480,7 @@ if $data10 != @21-05-05 18:19:06.000@ then return -1 endi -sql select tb1.ts,tb1.*,tb2_1.* from tb1, tb2_1 where tb1.ts=tb2_1.ts and tb1.ts >= '2021-05-05 18:19:03.000' and tb1.c7=false and tb2_1.u3>4; +sql select tb1.ts,tb1.*,tb2_1.* from tb1, tb2_1 where tb1.ts=tb2_1.ts and tb1.ts >= '2021-05-05 18:19:03.000' and tb1.c7=false and tb2_1.u3>4 order by ts; if $rows != 2 then return -1 endi @@ -2496,7 +2491,7 @@ if $data10 != @21-05-05 18:19:07.000@ then return -1 endi -sql select stb1.ts,stb1.c1,stb1.t1,stb2.ts,stb2.u1,stb2.t4 from stb1, stb2 where stb1.ts=stb2.ts and stb1.t1 = stb2.t4; +sql select stb1.ts,stb1.c1,stb1.t1,stb2.ts,stb2.u1,stb2.t4 from stb1, stb2 where stb1.ts=stb2.ts and stb1.t1 = stb2.t4 order by ts; if $rows != 9 then return -1 endi @@ -2528,7 +2523,7 @@ if $data80 != @21-05-05 18:19:11.000@ then return -1 endi -sql select stb1.ts,stb1.c1,stb1.t1,stb2.ts,stb2.u1,stb2.t4 from stb1, stb2 where stb1.ts=stb2.ts and stb1.t1 = stb2.t4 and stb1.c1 > 2 and stb2.u1 <=4; +sql select stb1.ts,stb1.c1,stb1.t1,stb2.ts,stb2.u1,stb2.t4 from stb1, stb2 where stb1.ts=stb2.ts and stb1.t1 = stb2.t4 and stb1.c1 > 2 and stb2.u1 <=4 order by ts; if $rows != 3 then return -1 endi @@ -2543,8 +2538,8 @@ if $data20 != @21-05-05 18:19:06.000@ then endi print "column&ts test" -sql_error select count(*) from stb1 where ts > 0 or c1 > 0; -sql select * from stb1 where ts > '2021-05-05 18:19:03.000' and ts < '2021-05-05 18:19:20.000' and (c1 > 23 or c1 < 14) and c7 in (true) and c8 like '%2'; +sql select count(*) from stb1 where ts > 0 or c1 > 0; +sql select * from stb1 where ts > '2021-05-05 18:19:03.000' and ts < '2021-05-05 18:19:20.000' and (c1 > 23 or c1 < 14) and c7 in (true) and c8 like '%2' order by ts; if $rows != 3 then return -1 endi @@ -2559,7 +2554,7 @@ if $data20 != @21-05-05 18:19:17.000@ then endi print "column&tbname test" -sql_error select count(*) from stb1 where tbname like 'tb%' or c1 > 0; +sql select count(*) from stb1 where tbname like 'tb%' or c1 > 0; sql select * from stb1 where tbname like '%3' and c6 < 34 and c5 != 33 and c4 > 31; if $rows != 1 then return -1 @@ -2569,16 +2564,16 @@ if $data00 != @21-05-05 18:19:13.000@ then endi print "column&tag test" -sql_error select * from stb1 where t1 > 0 or c1 > 0 -sql_error select * from stb1 where c1 > 0 or t1 > 0 -sql_error select * from stb1 where t1 > 0 or c1 > 0 or t1 > 1 -sql_error select * from stb1 where c1 > 0 or t1 > 0 or c1 > 1 -sql_error select * from stb1 where t1 > 0 and c1 > 0 or t1 > 1 -sql_error select * from stb1 where c1 > 0 or t1 > 0 and c1 > 1 -sql_error select * from stb1 where c1 > 0 or t1 > 0 and c1 > 1 -sql_error select * from stb1 where t1 > 0 or t1 > 0 and c1 > 1 -sql_error select * from stb1 where (c1 > 0 and t1 > 0 ) or (t1 > 1 and c1 > 3) -sql_error select * from stb1 where (c1 > 0 and t1 > 0 ) or t1 > 1 +sql select * from stb1 where t1 > 0 or c1 > 0 +sql select * from stb1 where c1 > 0 or t1 > 0 +sql select * from stb1 where t1 > 0 or c1 > 0 or t1 > 1 +sql select * from stb1 where c1 > 0 or t1 > 0 or c1 > 1 +sql select * from stb1 where t1 > 0 and c1 > 0 or t1 > 1 +sql select * from stb1 where c1 > 0 or t1 > 0 and c1 > 1 +sql select * from stb1 where c1 > 0 or t1 > 0 and c1 > 1 +sql select * from stb1 where t1 > 0 or t1 > 0 and c1 > 1 +sql select * from stb1 where (c1 > 0 and t1 > 0 ) or (t1 > 1 and c1 > 3) +sql select * from stb1 where (c1 > 0 and t1 > 0 ) or t1 > 1 sql_error select a.ts,b.ts,a.c1,b.u1,b.u2 from (select * from stb1) a, (select * from stb2) b where a.ts=b.ts and a.t1=b.t1; sql select * from stb1 where c1 < 63 and t1 > 5 @@ -2591,7 +2586,7 @@ endi if $data10 != @21-05-05 18:19:25.000@ then return -1 endi -sql select * from stb1 where t1 > 3 and t1 < 5 and c1 != 42 and c1 != 44; +sql select * from stb1 where t1 > 3 and t1 < 5 and c1 != 42 and c1 != 44 order by ts; if $rows != 2 then return -1 endi @@ -2608,7 +2603,7 @@ endi if $data00 != @21-05-05 18:19:09.000@ then return -1 endi -sql select * from stb1 where c1 > 1 and (t1 > 3 or t1 < 2) and (c2 > 2 and c2 < 62 and t1 != 4) and (t1 > 2 and t1 < 6) and c7 = true and c8 like '%2'; +sql select * from stb1 where c1 > 1 and (t1 > 3 or t1 < 2) and (c2 > 2 and c2 < 62 and t1 != 4) and (t1 > 2 and t1 < 6) and c7 = true and c8 like '%2' order by ts; if $rows != 1 then return -1 endi @@ -2616,7 +2611,7 @@ if $data00 != @21-05-05 18:19:21.000@ then return -1 endi -sql select * from stb1 where c1!=31 and c1 !=32 and c1 <> 63 and c1 <>1 and c1 <> 21 and c1 <> 2 and c7 <> true and c8 <> '3' and c9 <> '4' and c2<>13 and c3 <> 23 and c4 <> 33 and c5 <> 34 and c6 <> 43 and c2 <> 53 and t1 <> 5 and t2 <>4; +sql select * from stb1 where c1!=31 and c1 !=32 and c1 <> 63 and c1 <>1 and c1 <> 21 and c1 <> 2 and c7 <> true and c8 <> '3' and c9 <> '4' and c2<>13 and c3 <> 23 and c4 <> 33 and c5 <> 34 and c6 <> 43 and c2 <> 53 and t1 <> 5 and t2 <>4 order by ts; if $rows != 3 then return -1 endi @@ -2639,9 +2634,9 @@ print "ts&tbname test" sql_error select count(*) from stb1 where ts > 0 or tbname like 'tb%'; print "ts&tag test" -sql_error select count(*) from stb1 where ts > 0 or t1 > 0; +sql select count(*) from stb1 where ts > 0 or t1 > 0; -sql select * from stb2 where t1!=1 and t2=2 and t3 in ('2021-05-05 18:58:58.000') and ts < '2021-05-05 18:19:13.000'; +sql select * from stb2 where t1!=1 and t2=2 and t3 in ('2021-05-05 18:58:58.000') and ts < '2021-05-05 18:19:13.000' order by ts; if $rows != 2 then return -1 endi @@ -2658,7 +2653,7 @@ sql select tb1.ts,tb1.c1,tb2_1.u1 from tb1, tb2_1 where tb1.ts=tb2_1.ts and (tb1 print "tbname&tag test" -sql select * from stb1 where tbname like 'tb%' and (t1=1 or t2=2 or t3=3) and t1 > 2; +sql select * from stb1 where tbname like 'tb%' and (t1=1 or t2=2 or t3=3) and t1 > 2 order by ts; if $rows != 4 then return -1 endi @@ -2684,20 +2679,20 @@ print "tag&join test" print "column&ts&tbname test" -sql_error select count(*) from stb1 where tbname like 'tb%' or c1 > 0 or ts > 0; +sql select count(*) from stb1 where tbname like 'tb%' or c1 > 0 or ts > 0; print "column&ts&tag test" -sql_error select count(*) from stb1 where t1 > 0 or c1 > 0 or ts > 0; -sql_error select count(*) from stb1 where c1 > 0 or t1 > 0 or ts > 0; +sql select count(*) from stb1 where t1 > 0 or c1 > 0 or ts > 0; +sql select count(*) from stb1 where c1 > 0 or t1 > 0 or ts > 0; -sql select * from stb1 where (t1 > 0 or t1 > 2 ) and ts > '2021-05-05 18:19:10.000' and (c1 > 1 or c1 > 3) and (c6 > 40 or c6 < 30) and (c8 like '%3' or c8 like '_4') and (c9 like '1%' or c9 like '6%' or (c9 like '%3' and c9 != '23')) and ts > '2021-05-05 18:19:22.000' and ts <= '2021-05-05 18:19:26.000'; +sql select * from stb1 where (t1 > 0 or t1 > 2 ) and ts > '2021-05-05 18:19:10.000' and (c1 > 1 or c1 > 3) and (c6 > 40 or c6 < 30) and (c8 like '%3' or c8 like '_4') and (c9 like '1%' or c9 like '6%' or (c9 like '%3' and c9 != '23')) and ts > '2021-05-05 18:19:22.000' and ts <= '2021-05-05 18:19:26.000' order by ts; if $rows != 1 then return -1 endi if $data00 != @21-05-05 18:19:26.000@ then return -1 endi -sql select * from stb1 where ts > '2021-05-05 18:19:00.000' and c1 > 2 and t1 != 1 and c2 >= 23 and t2 >= 3 and c3 < 63 and c7 = false and t3 > 3 and t3 < 6 and c8 like '4%' and ts < '2021-05-05 18:19:19.000' and c2 > 40 and c3 != 42; +sql select * from stb1 where ts > '2021-05-05 18:19:00.000' and c1 > 2 and t1 != 1 and c2 >= 23 and t2 >= 3 and c3 < 63 and c7 = false and t3 > 3 and t3 < 6 and c8 like '4%' and ts < '2021-05-05 18:19:19.000' and c2 > 40 and c3 != 42 order by ts; if $rows != 1 then return -1 endi @@ -2707,12 +2702,12 @@ endi print "column&ts&join test" print "column&tbname&tag test" -sql_error select count(*) from stb1 where c1 > 0 or tbname in ('tb1') or t1 > 0; +sql select count(*) from stb1 where c1 > 0 or tbname in ('tb1') or t1 > 0; print "column&tbname&join test" print "column&tag&join test" print "ts&tbname&tag test" -sql_error select count(*) from stb1 where ts > 0 or tbname in ('tb1') or t1 > 0; +sql select count(*) from stb1 where ts > 0 or tbname in ('tb1') or t1 > 0; print "ts&tbname&join test" print "ts&tag&join test" @@ -2723,7 +2718,7 @@ print "tbname&tag&join test" print "column&ts&tbname&tag test" sql_error select * from stb1 where (tbname like 'tb%' or ts > '2021-05-05 18:19:01.000') and (t1 > 5 or t1 < 4) and c1 > 0; -sql_error select * from stb1 where (ts > '2021-05-05 18:19:01.000') and (ts > '2021-05-05 18:19:02.000' or t1 > 3) and (t1 > 5 or t1 < 4) and c1 > 0; +sql select * from stb1 where (ts > '2021-05-05 18:19:01.000') and (ts > '2021-05-05 18:19:02.000' or t1 > 3) and (t1 > 5 or t1 < 4) and c1 > 0; sql_error select ts,c1,c7 from stb1 where ts > '2021-05-05 18:19:03.000' or ts > '2021-05-05 18:19:20.000' and col > 0 and t1 > 0; -- GitLab