@@ -23,7 +23,7 @@ A single line of text is used in OpenTSDB line protocol to represent one row of
- `metric` will be used as the STable name.
- `timestamp` is the timestamp of current row of data. The time precision will be determined automatically based on the length of the timestamp. Second and millisecond time precision are supported.
- `value` is a metric which must be a numeric value, the corresponding column name is "value".
- `value` is a metric which must be a numeric value, the corresponding column name is "_value".
- The last part is the tag set separated by spaces, all tags will be converted to nchar type automatically.
获取 mnode EP 列表后,数据节点发起连接,如果连接成功,则成功加入进工作的集群,如果不成功,则尝试 mnode EP 列表中的下一个。如果都尝试了,但连接都仍然失败,则休眠几秒后,再进行尝试。
**Mnode 的选择:**TDengine 逻辑上有管理节点,但没有单独的执行代码,服务器侧只有一套执行代码 taosd。那么哪个数据节点会是管理节点呢?这是系统自动决定的,无需任何人工干预。原则如下:一个数据节点启动时,会检查自己的 End Point,并与获取的 mnode EP List 进行比对,如果在其中,该数据节点认为自己应该启动 mnode 模块,成为 mnode。如果自己的 EP 不在 mnode EP List 里,则不启动 mnode 模块。在系统的运行过程中,由于负载均衡、宕机等原因,mnode 有可能迁移至新的 dnode,但一切都是透明的,无需人工干预,配置参数的修改,是 mnode 自己根据资源做出的决定。
**新数据节点的加入:**系统有了一个数据节点后,就已经成为一个工作的系统。添加新的节点进集群时,有两个步骤,第一步:使用 TDengine CLI 连接到现有工作的数据节点,然后用命令“CREATE DNODE”将新的数据节点的 End Point 添加进去;第二步:在新的数据节点的系统配置参数文件 taos.cfg 里,将 firstEp,secondEp 参数设置为现有集群中任意两个数据节点的 EP 即可。具体添加的详细步骤请见详细的用户手册。这样就把集群一步一步的建立起来。
**重定向:**无论是 dnode 还是 taosc,最先都是要发起与 mnode 的连接,但 mnode 是系统自动创建并维护的,因此对于用户来说,并不知道哪个 dnode 在运行 mnode。TDengine 只要求向系统中任何一个工作的 dnode 发起连接即可。因为任何一个正在运行的 dnode,都维护有目前运行的 mnode EP List。当收到一个来自新启动的 dnode 或 taosc 的连接请求,如果自己不是 mnode,则将 mnode EP List 回复给对方,taosc 或新启动的 dnode 收到这个 list,就重新尝试建立连接。当 mnode EP List 发生改变,通过节点之间的消息交互,各个数据节点就很快获取最新列表,并通知 taosc。
**重定向:**无论是 dnode 还是 taosc,最先都是要发起与 mnode 的连接,由于 mnode 是可以动态调整的,所以对于用户来说,并不知道哪个 dnode 在运行 mnode。TDengine 只要求向系统中任何一个工作的 dnode 发起连接即可。因为任何一个正在运行的 dnode,都维护有目前运行的 mnode EP List。当收到一个来自新启动的 dnode 或 taosc 的连接请求,如果自己不是 mnode,则将 mnode EP List 回复给对方,taosc 或新启动的 dnode 收到这个 list,就重新尝试建立连接。当 mnode EP List 发生改变,通过节点之间的消息交互,各个数据节点就很快获取最新列表,并通知 taosc。
### 一个典型的消息流程
...
...
@@ -68,15 +66,17 @@ TDengine 分布式架构的逻辑结构图如下:
<center> 图 2 TDengine 典型的操作流程 </center>
1. 应用通过 JDBC 或其他 API 接口发起插入数据的请求。
2. taosc 会检查缓存,看是否保存有该表的 meta data。如果有,直接到第 4 步。如果没有,taosc 将向 mnode 发出 get meta-data 请求。
3. mnode 将该表的 meta-data 返回给 taosc。Meta-data 包含有该表的 schema,而且还有该表所属的 vgroup 信息(vnode ID 以及所在的 dnode 的 End Point,如果副本数为 N,就有 N 组 End Point)。如果 taosc 迟迟得不到 mnode 回应,而且存在多个 mnode,taosc 将向下一个 mnode 发出请求。
对于第二和第三步,taosc 启动时,并不知道 mnode 的 End Point,因此会直接向配置的集群对外服务的 End Point 发起请求。如果接收到该请求的 dnode 并没有配置 mnode,该 dnode 会在回复的消息中告知 mnode EP 列表,这样 taosc 会重新向新的 mnode 的 EP 发出获取 meta-data 的请求。
对于第二步,taosc 启动时,并不知道 mnode 的 End Point,因此会直接向配置的集群对外服务的 End Point 发起请求。如果接收到该请求的 dnode 并没有配置 mnode,该 dnode 会在回复的消息中告知 mnode EP 列表,这样 taosc 会重新向新的 mnode 的 EP 发出获取 meta-data 的请求。
-数据表元数据:包含标签信息和 Table Schema 信息,存放于 vnode 里的 meta 文件,支持增删改查四个标准操作。数据量很大,有 N 张表,就有 N 条记录,因此采用 LRU 存储,支持标签数据的索引。TDengine 支持多核多线程并发查询。只要计算内存足够,元数据全内存存储,千万级别规模的标签数据过滤结果能毫秒级返回。在内存资源不足的情况下,仍然可以支持数千万张表的快速查询。
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;
tdLog.debug("spent %.2fs to create %d stable and %d table, create speed is %.2f table/s... [OK]"%(spendTime,threadNumbers,threadNumbers*count,speedCreate))