Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Rattenking
TDengine
提交
0b4f0680
T
TDengine
项目概览
Rattenking
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0b4f0680
编写于
2月 22, 2021
作者:
L
liuyq-617
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-2742]<test>modify case for unsigned
上级
0bcecce0
变更
24
隐藏空白更改
内联
并排
Showing
24 changed file
with
872 addition
and
42 deletion
+872
-42
tests/pytest/fulltest.sh
tests/pytest/fulltest.sh
+1
-0
tests/pytest/functions/function_diff.py
tests/pytest/functions/function_diff.py
+10
-25
tests/pytest/functions/function_diff_restart.py
tests/pytest/functions/function_diff_restart.py
+8
-1
tests/pytest/functions/function_last.py
tests/pytest/functions/function_last.py
+28
-0
tests/pytest/functions/function_last_row.py
tests/pytest/functions/function_last_row.py
+32
-0
tests/pytest/functions/function_leastsquares.py
tests/pytest/functions/function_leastsquares.py
+8
-0
tests/pytest/functions/function_max.py
tests/pytest/functions/function_max.py
+12
-0
tests/pytest/functions/function_max_restart.py
tests/pytest/functions/function_max_restart.py
+12
-0
tests/pytest/functions/function_min.py
tests/pytest/functions/function_min.py
+12
-0
tests/pytest/functions/function_operations.py
tests/pytest/functions/function_operations.py
+3
-3
tests/pytest/functions/function_percentile.py
tests/pytest/functions/function_percentile.py
+52
-0
tests/pytest/functions/function_spread.py
tests/pytest/functions/function_spread.py
+9
-1
tests/pytest/functions/function_stddev.py
tests/pytest/functions/function_stddev.py
+12
-0
tests/pytest/functions/function_stddev_td2555.py
tests/pytest/functions/function_stddev_td2555.py
+14
-0
tests/pytest/functions/function_sum.py
tests/pytest/functions/function_sum.py
+8
-0
tests/pytest/functions/function_top.py
tests/pytest/functions/function_top.py
+28
-0
tests/pytest/functions/function_twa.py
tests/pytest/functions/function_twa.py
+21
-1
tests/pytest/functions/function_twa_restart.py
tests/pytest/functions/function_twa_restart.py
+21
-1
tests/pytest/pytest_4.sh
tests/pytest/pytest_4.sh
+2
-1
tests/pytest/query/filterAllUnsignedIntTypes.py
tests/pytest/query/filterAllUnsignedIntTypes.py
+176
-0
tests/pytest/query/queryNullValueTest.py
tests/pytest/query/queryNullValueTest.py
+1
-1
tests/pytest/query/querySort.py
tests/pytest/query/querySort.py
+8
-8
tests/pytest/tag_lite/add.py
tests/pytest/tag_lite/add.py
+307
-0
tests/pytest/tag_lite/delete.py
tests/pytest/tag_lite/delete.py
+87
-0
未找到文件。
tests/pytest/fulltest.sh
浏览文件 @
0b4f0680
...
@@ -154,6 +154,7 @@ python3 ./test.py -f query/filterCombo.py
...
@@ -154,6 +154,7 @@ python3 ./test.py -f query/filterCombo.py
python3 ./test.py
-f
query/queryNormal.py
python3 ./test.py
-f
query/queryNormal.py
python3 ./test.py
-f
query/queryError.py
python3 ./test.py
-f
query/queryError.py
python3 ./test.py
-f
query/filterAllIntTypes.py
python3 ./test.py
-f
query/filterAllIntTypes.py
python3 ./test.py
-f
query/filterAllUnsignedIntTypes.py
python3 ./test.py
-f
query/filterFloatAndDouble.py
python3 ./test.py
-f
query/filterFloatAndDouble.py
python3 ./test.py
-f
query/filterOtherTypes.py
python3 ./test.py
-f
query/filterOtherTypes.py
python3 ./test.py
-f
query/querySort.py
python3 ./test.py
-f
query/querySort.py
...
...
tests/pytest/functions/function_diff.py
浏览文件 @
0b4f0680
...
@@ -54,18 +54,6 @@ class TDTestCase:
...
@@ -54,18 +54,6 @@ class TDTestCase:
tdSql
.
query
(
"select diff(col6) from test1"
)
tdSql
.
query
(
"select diff(col6) from test1"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select diff(col11) from test1"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select diff(col12) from test1"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select diff(col13) from test1"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select diff(col14) from test1"
)
tdSql
.
checkRows
(
0
)
for
i
in
range
(
self
.
rowNum
):
for
i
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
"insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
tdSql
.
execute
(
"insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
%
(
self
.
ts
+
i
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
0.1
,
i
+
0.1
,
i
%
2
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
))
%
(
self
.
ts
+
i
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
0.1
,
i
+
0.1
,
i
%
2
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
))
...
@@ -84,7 +72,16 @@ class TDTestCase:
...
@@ -84,7 +72,16 @@ class TDTestCase:
tdSql
.
error
(
"select diff(col8) from test1"
)
tdSql
.
error
(
"select diff(col8) from test1"
)
tdSql
.
error
(
"select diff(col9) from test"
)
tdSql
.
error
(
"select diff(col9) from test"
)
tdSql
.
error
(
"select diff(col9) from test1"
)
tdSql
.
error
(
"select diff(col9) from test1"
)
tdSql
.
error
(
"select diff(col11) from test1"
)
tdSql
.
error
(
"select diff(col12) from test1"
)
tdSql
.
error
(
"select diff(col13) from test1"
)
tdSql
.
error
(
"select diff(col14) from test1"
)
tdSql
.
error
(
"select diff(col11) from test"
)
tdSql
.
error
(
"select diff(col12) from test"
)
tdSql
.
error
(
"select diff(col13) from test"
)
tdSql
.
error
(
"select diff(col14) from test"
)
tdSql
.
query
(
"select diff(col1) from test1"
)
tdSql
.
query
(
"select diff(col1) from test1"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
...
@@ -97,18 +94,6 @@ class TDTestCase:
...
@@ -97,18 +94,6 @@ class TDTestCase:
tdSql
.
query
(
"select diff(col4) from test1"
)
tdSql
.
query
(
"select diff(col4) from test1"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select diff(col11) from test1"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select diff(col12) from test1"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select diff(col13) from test1"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select diff(col14) from test1"
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select diff(col5) from test1"
)
tdSql
.
query
(
"select diff(col5) from test1"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
...
...
tests/pytest/functions/function_diff_restart.py
浏览文件 @
0b4f0680
...
@@ -71,7 +71,14 @@ class TDTestCase:
...
@@ -71,7 +71,14 @@ class TDTestCase:
tdSql
.
error
(
"select diff(col8) from test"
)
tdSql
.
error
(
"select diff(col8) from test"
)
tdSql
.
error
(
"select diff(col8) from test1"
)
tdSql
.
error
(
"select diff(col8) from test1"
)
tdSql
.
error
(
"select diff(col9) from test"
)
tdSql
.
error
(
"select diff(col9) from test"
)
tdSql
.
error
(
"select diff(col9) from test1"
)
tdSql
.
err
(
"select diff(col11) from test1"
)
tdSql
.
err
(
"select diff(col12) from test1"
)
tdSql
.
err
(
"select diff(col13) from test1"
)
tdSql
.
err
(
"select diff(col14) from test1"
)
tdSql
.
err
(
"select diff(col11) from test"
)
tdSql
.
err
(
"select diff(col12) from test"
)
tdSql
.
err
(
"select diff(col13) from test"
)
tdSql
.
err
(
"select diff(col14) from test"
)
tdSql
.
query
(
"select diff(col1) from test1"
)
tdSql
.
query
(
"select diff(col1) from test1"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
...
...
tests/pytest/functions/function_last.py
浏览文件 @
0b4f0680
...
@@ -52,6 +52,18 @@ class TDTestCase:
...
@@ -52,6 +52,18 @@ class TDTestCase:
tdSql
.
query
(
"select last(col4) from test1"
)
tdSql
.
query
(
"select last(col4) from test1"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select last(col11) from test1"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select last(col12) from test1"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select last(col13) from test1"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select last(col14) from test1"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select last(col5) from test1"
)
tdSql
.
query
(
"select last(col5) from test1"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
...
@@ -91,6 +103,22 @@ class TDTestCase:
...
@@ -91,6 +103,22 @@ class TDTestCase:
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select last(col11) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select last(col12) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select last(col13) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select last(col14) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select last(col5) from test1"
)
tdSql
.
query
(
"select last(col5) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
9.1
)
tdSql
.
checkData
(
0
,
0
,
9.1
)
...
...
tests/pytest/functions/function_last_row.py
浏览文件 @
0b4f0680
...
@@ -56,6 +56,22 @@ class TDTestCase:
...
@@ -56,6 +56,22 @@ class TDTestCase:
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select last_row(col11) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select last_row(col12) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select last_row(col13) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select last_row(col14) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select last_row(col5) from test1"
)
tdSql
.
query
(
"select last_row(col5) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
checkData
(
0
,
0
,
None
)
...
@@ -100,6 +116,22 @@ class TDTestCase:
...
@@ -100,6 +116,22 @@ class TDTestCase:
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select last_row(col11) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select last_row(col12) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select last_row(col13) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select last_row(col14) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select last_row(col5) from test1"
)
tdSql
.
query
(
"select last_row(col5) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
9.1
)
tdSql
.
checkData
(
0
,
0
,
9.1
)
...
...
tests/pytest/functions/function_leastsquares.py
浏览文件 @
0b4f0680
...
@@ -48,6 +48,14 @@ class TDTestCase:
...
@@ -48,6 +48,14 @@ class TDTestCase:
tdSql
.
error
(
"select leastsquares(col7, 1, 1) from test1"
)
tdSql
.
error
(
"select leastsquares(col7, 1, 1) from test1"
)
tdSql
.
error
(
"select leastsquares(col8, 1, 1) from test1"
)
tdSql
.
error
(
"select leastsquares(col8, 1, 1) from test1"
)
tdSql
.
error
(
"select leastsquares(col9, 1, 1) from test1"
)
tdSql
.
error
(
"select leastsquares(col9, 1, 1) from test1"
)
tdSql
.
error
(
"select leastsquares(col11, 1, 1) from test"
)
tdSql
.
error
(
"select leastsquares(col12, 1, 1) from test"
)
tdSql
.
error
(
"select leastsquares(col13, 1, 1) from test"
)
tdSql
.
error
(
"select leastsquares(col14, 1, 1) from test"
)
tdSql
.
error
(
"select leastsquares(col11, 1, 1) from test1"
)
tdSql
.
error
(
"select leastsquares(col12, 1, 1) from test1"
)
tdSql
.
error
(
"select leastsquares(col13, 1, 1) from test1"
)
tdSql
.
error
(
"select leastsquares(col14, 1, 1) from test1"
)
tdSql
.
query
(
"select leastsquares(col1, 1, 1) from test1"
)
tdSql
.
query
(
"select leastsquares(col1, 1, 1) from test1"
)
tdSql
.
checkData
(
0
,
0
,
'{slop:1.000000, intercept:0.000000}'
)
tdSql
.
checkData
(
0
,
0
,
'{slop:1.000000, intercept:0.000000}'
)
...
...
tests/pytest/functions/function_max.py
浏览文件 @
0b4f0680
...
@@ -63,6 +63,18 @@ class TDTestCase:
...
@@ -63,6 +63,18 @@ class TDTestCase:
tdSql
.
query
(
"select max(col4) from test1"
)
tdSql
.
query
(
"select max(col4) from test1"
)
tdSql
.
checkData
(
0
,
0
,
np
.
max
(
intData
))
tdSql
.
checkData
(
0
,
0
,
np
.
max
(
intData
))
tdSql
.
query
(
"select max(col11) from test1"
)
tdSql
.
checkData
(
0
,
0
,
np
.
max
(
intData
))
tdSql
.
query
(
"select max(col12) from test1"
)
tdSql
.
checkData
(
0
,
0
,
np
.
max
(
intData
))
tdSql
.
query
(
"select max(col13) from test1"
)
tdSql
.
checkData
(
0
,
0
,
np
.
max
(
intData
))
tdSql
.
query
(
"select max(col14) from test1"
)
tdSql
.
checkData
(
0
,
0
,
np
.
max
(
intData
))
tdSql
.
query
(
"select max(col5) from test1"
)
tdSql
.
query
(
"select max(col5) from test1"
)
tdSql
.
checkData
(
0
,
0
,
np
.
max
(
floatData
))
tdSql
.
checkData
(
0
,
0
,
np
.
max
(
floatData
))
...
...
tests/pytest/functions/function_max_restart.py
浏览文件 @
0b4f0680
...
@@ -61,6 +61,18 @@ class TDTestCase:
...
@@ -61,6 +61,18 @@ class TDTestCase:
tdSql
.
query
(
"select max(col4) from test1"
)
tdSql
.
query
(
"select max(col4) from test1"
)
tdSql
.
checkData
(
0
,
0
,
np
.
max
(
intData
))
tdSql
.
checkData
(
0
,
0
,
np
.
max
(
intData
))
tdSql
.
query
(
"select max(col11) from test1"
)
tdSql
.
checkData
(
0
,
0
,
np
.
max
(
intData
))
tdSql
.
query
(
"select max(col12) from test1"
)
tdSql
.
checkData
(
0
,
0
,
np
.
max
(
intData
))
tdSql
.
query
(
"select max(col13) from test1"
)
tdSql
.
checkData
(
0
,
0
,
np
.
max
(
intData
))
tdSql
.
query
(
"select max(col14) from test1"
)
tdSql
.
checkData
(
0
,
0
,
np
.
max
(
intData
))
tdSql
.
query
(
"select max(col5) from test1"
)
tdSql
.
query
(
"select max(col5) from test1"
)
tdSql
.
checkData
(
0
,
0
,
np
.
max
(
floatData
))
tdSql
.
checkData
(
0
,
0
,
np
.
max
(
floatData
))
...
...
tests/pytest/functions/function_min.py
浏览文件 @
0b4f0680
...
@@ -63,6 +63,18 @@ class TDTestCase:
...
@@ -63,6 +63,18 @@ class TDTestCase:
tdSql
.
query
(
"select min(col4) from test1"
)
tdSql
.
query
(
"select min(col4) from test1"
)
tdSql
.
checkData
(
0
,
0
,
np
.
min
(
intData
))
tdSql
.
checkData
(
0
,
0
,
np
.
min
(
intData
))
tdSql
.
query
(
"select min(col11) from test1"
)
tdSql
.
checkData
(
0
,
0
,
np
.
min
(
intData
))
tdSql
.
query
(
"select min(col12) from test1"
)
tdSql
.
checkData
(
0
,
0
,
np
.
min
(
intData
))
tdSql
.
query
(
"select min(col13) from test1"
)
tdSql
.
checkData
(
0
,
0
,
np
.
min
(
intData
))
tdSql
.
query
(
"select min(col14) from test1"
)
tdSql
.
checkData
(
0
,
0
,
np
.
min
(
intData
))
tdSql
.
query
(
"select min(col5) from test1"
)
tdSql
.
query
(
"select min(col5) from test1"
)
tdSql
.
checkData
(
0
,
0
,
np
.
min
(
floatData
))
tdSql
.
checkData
(
0
,
0
,
np
.
min
(
floatData
))
...
...
tests/pytest/functions/function_operations.py
浏览文件 @
0b4f0680
...
@@ -51,9 +51,9 @@ class TDTestCase:
...
@@ -51,9 +51,9 @@ class TDTestCase:
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkData
(
0
,
0
,
2.0
)
tdSql
.
checkData
(
0
,
0
,
2.0
)
tdSql
.
query
(
"select col1 + col2 * col3 + col3 / col4 + col5 + col6 from test1"
)
tdSql
.
query
(
"select col1 + col2 * col3 + col3 / col4 + col5 + col6
+ col11 + col12 + col13 + col14
from test1"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkData
(
0
,
0
,
3
.2
)
tdSql
.
checkData
(
0
,
0
,
7
.2
)
tdSql
.
execute
(
"insert into test1(ts, col1) values(%d, 11)"
%
(
self
.
ts
+
11
))
tdSql
.
execute
(
"insert into test1(ts, col1) values(%d, 11)"
%
(
self
.
ts
+
11
))
tdSql
.
query
(
"select col1 + col2 from test1"
)
tdSql
.
query
(
"select col1 + col2 from test1"
)
...
@@ -64,7 +64,7 @@ class TDTestCase:
...
@@ -64,7 +64,7 @@ class TDTestCase:
tdSql
.
checkRows
(
11
)
tdSql
.
checkRows
(
11
)
tdSql
.
checkData
(
10
,
0
,
None
)
tdSql
.
checkData
(
10
,
0
,
None
)
tdSql
.
query
(
"select col1 + col2 * col3 + col3 / col4 + col5 + col6 from test1"
)
tdSql
.
query
(
"select col1 + col2 * col3 + col3 / col4 + col5 + col6
+ col11 + col12 + col13 + col14
from test1"
)
tdSql
.
checkRows
(
11
)
tdSql
.
checkRows
(
11
)
tdSql
.
checkData
(
10
,
0
,
None
)
tdSql
.
checkData
(
10
,
0
,
None
)
...
...
tests/pytest/functions/function_percentile.py
浏览文件 @
0b4f0680
...
@@ -103,6 +103,58 @@ class TDTestCase:
...
@@ -103,6 +103,58 @@ class TDTestCase:
tdSql
.
query
(
"select apercentile(col4, 100) from test"
)
tdSql
.
query
(
"select apercentile(col4, 100) from test"
)
print
(
"apercentile result: %s"
%
tdSql
.
getData
(
0
,
0
))
print
(
"apercentile result: %s"
%
tdSql
.
getData
(
0
,
0
))
tdSql
.
query
(
"select percentile(col11, 0) from test"
)
tdSql
.
checkData
(
0
,
0
,
np
.
percentile
(
intData
,
0
))
tdSql
.
query
(
"select apercentile(col11, 0) from test"
)
print
(
"apercentile result: %s"
%
tdSql
.
getData
(
0
,
0
))
tdSql
.
query
(
"select percentile(col11, 50) from test"
)
tdSql
.
checkData
(
0
,
0
,
np
.
percentile
(
intData
,
50
))
tdSql
.
query
(
"select apercentile(col11, 50) from test"
)
print
(
"apercentile result: %s"
%
tdSql
.
getData
(
0
,
0
))
tdSql
.
query
(
"select percentile(col11, 100) from test"
)
tdSql
.
checkData
(
0
,
0
,
np
.
percentile
(
intData
,
100
))
tdSql
.
query
(
"select apercentile(col11, 100) from test"
)
print
(
"apercentile result: %s"
%
tdSql
.
getData
(
0
,
0
))
tdSql
.
query
(
"select percentile(col12, 0) from test"
)
tdSql
.
checkData
(
0
,
0
,
np
.
percentile
(
intData
,
0
))
tdSql
.
query
(
"select apercentile(col12, 0) from test"
)
print
(
"apercentile result: %s"
%
tdSql
.
getData
(
0
,
0
))
tdSql
.
query
(
"select percentile(col12, 50) from test"
)
tdSql
.
checkData
(
0
,
0
,
np
.
percentile
(
intData
,
50
))
tdSql
.
query
(
"select apercentile(col12, 50) from test"
)
print
(
"apercentile result: %s"
%
tdSql
.
getData
(
0
,
0
))
tdSql
.
query
(
"select percentile(col12, 100) from test"
)
tdSql
.
checkData
(
0
,
0
,
np
.
percentile
(
intData
,
100
))
tdSql
.
query
(
"select apercentile(col12, 100) from test"
)
print
(
"apercentile result: %s"
%
tdSql
.
getData
(
0
,
0
))
tdSql
.
query
(
"select percentile(col13, 0) from test"
)
tdSql
.
checkData
(
0
,
0
,
np
.
percentile
(
intData
,
0
))
tdSql
.
query
(
"select apercentile(col13, 0) from test"
)
print
(
"apercentile result: %s"
%
tdSql
.
getData
(
0
,
0
))
tdSql
.
query
(
"select percentile(col13, 50) from test"
)
tdSql
.
checkData
(
0
,
0
,
np
.
percentile
(
intData
,
50
))
tdSql
.
query
(
"select apercentile(col13, 50) from test"
)
print
(
"apercentile result: %s"
%
tdSql
.
getData
(
0
,
0
))
tdSql
.
query
(
"select percentile(col13, 100) from test"
)
tdSql
.
checkData
(
0
,
0
,
np
.
percentile
(
intData
,
100
))
tdSql
.
query
(
"select apercentile(col13, 100) from test"
)
print
(
"apercentile result: %s"
%
tdSql
.
getData
(
0
,
0
))
tdSql
.
query
(
"select percentile(col14, 0) from test"
)
tdSql
.
checkData
(
0
,
0
,
np
.
percentile
(
intData
,
0
))
tdSql
.
query
(
"select apercentile(col14, 0) from test"
)
print
(
"apercentile result: %s"
%
tdSql
.
getData
(
0
,
0
))
tdSql
.
query
(
"select percentile(col14, 50) from test"
)
tdSql
.
checkData
(
0
,
0
,
np
.
percentile
(
intData
,
50
))
tdSql
.
query
(
"select apercentile(col14, 50) from test"
)
print
(
"apercentile result: %s"
%
tdSql
.
getData
(
0
,
0
))
tdSql
.
query
(
"select percentile(col14, 100) from test"
)
tdSql
.
checkData
(
0
,
0
,
np
.
percentile
(
intData
,
100
))
tdSql
.
query
(
"select apercentile(col14, 100) from test"
)
print
(
"apercentile result: %s"
%
tdSql
.
getData
(
0
,
0
))
tdSql
.
query
(
"select percentile(col5, 0) from test"
)
tdSql
.
query
(
"select percentile(col5, 0) from test"
)
print
(
"query result: %s"
%
tdSql
.
getData
(
0
,
0
))
print
(
"query result: %s"
%
tdSql
.
getData
(
0
,
0
))
print
(
"array result: %s"
%
np
.
percentile
(
floatData
,
0
))
print
(
"array result: %s"
%
np
.
percentile
(
floatData
,
0
))
...
...
tests/pytest/functions/function_spread.py
浏览文件 @
0b4f0680
...
@@ -33,7 +33,7 @@ class TDTestCase:
...
@@ -33,7 +33,7 @@ class TDTestCase:
tdSql
.
execute
(
'''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
tdSql
.
execute
(
'''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))'''
)
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))'''
)
tdSql
.
execute
(
"create table test1 using test tags('beijing')"
)
tdSql
.
execute
(
"create table test1 using test tags('beijing')"
)
tdSql
.
execute
(
"insert into test1 values(%d, 0, 0, 0, 0, 0.0, 0.0, False, ' ', ' ')"
%
(
self
.
ts
-
1
))
tdSql
.
execute
(
"insert into test1 values(%d, 0, 0, 0, 0, 0.0, 0.0, False, ' ', ' '
, 0, 0, 0, 0
)"
%
(
self
.
ts
-
1
))
# spread verifacation
# spread verifacation
tdSql
.
query
(
"select spread(ts) from test1"
)
tdSql
.
query
(
"select spread(ts) from test1"
)
...
@@ -73,6 +73,14 @@ class TDTestCase:
...
@@ -73,6 +73,14 @@ class TDTestCase:
tdSql
.
error
(
"select spread(col8) from test1"
)
tdSql
.
error
(
"select spread(col8) from test1"
)
tdSql
.
error
(
"select spread(col9) from test"
)
tdSql
.
error
(
"select spread(col9) from test"
)
tdSql
.
error
(
"select spread(col9) from test1"
)
tdSql
.
error
(
"select spread(col9) from test1"
)
tdSql
.
error
(
"select spread(col11) from test"
)
tdSql
.
error
(
"select spread(col11) from test1"
)
tdSql
.
error
(
"select spread(col12) from test"
)
tdSql
.
error
(
"select spread(col12) from test1"
)
tdSql
.
error
(
"select spread(col13) from test"
)
tdSql
.
error
(
"select spread(col13) from test1"
)
tdSql
.
error
(
"select spread(col14) from test"
)
tdSql
.
error
(
"select spread(col14) from test1"
)
tdSql
.
query
(
"select spread(col1) from test1"
)
tdSql
.
query
(
"select spread(col1) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
...
...
tests/pytest/functions/function_stddev.py
浏览文件 @
0b4f0680
...
@@ -68,6 +68,18 @@ class TDTestCase:
...
@@ -68,6 +68,18 @@ class TDTestCase:
tdSql
.
query
(
"select stddev(col4) from test1"
)
tdSql
.
query
(
"select stddev(col4) from test1"
)
tdSql
.
checkData
(
0
,
0
,
np
.
std
(
intData
))
tdSql
.
checkData
(
0
,
0
,
np
.
std
(
intData
))
tdSql
.
query
(
"select stddev(col11) from test1"
)
tdSql
.
checkData
(
0
,
0
,
np
.
std
(
intData
))
tdSql
.
query
(
"select stddev(col12) from test1"
)
tdSql
.
checkData
(
0
,
0
,
np
.
std
(
intData
))
tdSql
.
query
(
"select stddev(col13) from test1"
)
tdSql
.
checkData
(
0
,
0
,
np
.
std
(
intData
))
tdSql
.
query
(
"select stddev(col14) from test1"
)
tdSql
.
checkData
(
0
,
0
,
np
.
std
(
intData
))
tdSql
.
query
(
"select stddev(col5) from test1"
)
tdSql
.
query
(
"select stddev(col5) from test1"
)
tdSql
.
checkData
(
0
,
0
,
np
.
std
(
floatData
))
tdSql
.
checkData
(
0
,
0
,
np
.
std
(
floatData
))
...
...
tests/pytest/functions/function_stddev_td2555.py
浏览文件 @
0b4f0680
...
@@ -32,11 +32,17 @@ class TDTestCase:
...
@@ -32,11 +32,17 @@ class TDTestCase:
self
.
clist4
=
[]
self
.
clist4
=
[]
self
.
clist5
=
[]
self
.
clist5
=
[]
self
.
clist6
=
[]
self
.
clist6
=
[]
self
.
clist11
=
[]
self
.
clist12
=
[]
self
.
clist13
=
[]
self
.
clist14
=
[]
def
getData
(
self
):
def
getData
(
self
):
for
i
in
range
(
tdSql
.
queryRows
):
for
i
in
range
(
tdSql
.
queryRows
):
for
j
in
range
(
6
):
for
j
in
range
(
6
):
exec
(
'self.clist{}.append(tdSql.queryResult[i][j+1])'
.
format
(
j
+
1
))
exec
(
'self.clist{}.append(tdSql.queryResult[i][j+1])'
.
format
(
j
+
1
))
for
j
in
range
(
11
,
15
):
exec
(
'self.clist{}.append(tdSql.queryResult[i][j-1])'
.
format
(
j
))
def
run
(
self
):
def
run
(
self
):
tdSql
.
prepare
()
tdSql
.
prepare
()
...
@@ -70,6 +76,10 @@ class TDTestCase:
...
@@ -70,6 +76,10 @@ class TDTestCase:
exec
(
'tdSql.query("select stddev(col{}) from test {}")'
.
format
(
i
+
1
,
condition
))
exec
(
'tdSql.query("select stddev(col{}) from test {}")'
.
format
(
i
+
1
,
condition
))
exec
(
'tdSql.checkData(0, 0, np.std(self.clist{}))'
.
format
(
i
+
1
))
exec
(
'tdSql.checkData(0, 0, np.std(self.clist{}))'
.
format
(
i
+
1
))
exec
(
'self.clist{}.clear()'
.
format
(
i
+
1
))
exec
(
'self.clist{}.clear()'
.
format
(
i
+
1
))
for
i
in
range
(
11
,
15
):
exec
(
'tdSql.query("select stddev(col{}) from test {}")'
.
format
(
i
,
condition
))
exec
(
'tdSql.checkData(0, 0, np.std(self.clist{}))'
.
format
(
i
))
exec
(
'self.clist{}.clear()'
.
format
(
i
))
print
(
'step 2'
)
print
(
'step 2'
)
con_group_list
=
{
con_group_list
=
{
' cid = 2 and ts >=now - 1d and ts <now group by tbname'
:
2
,
' cid = 2 and ts >=now - 1d and ts <now group by tbname'
:
2
,
...
@@ -82,6 +92,10 @@ class TDTestCase:
...
@@ -82,6 +92,10 @@ class TDTestCase:
exec
(
'tdSql.query("select stddev(col{}) from test where {}")'
.
format
(
i
+
1
,
key
))
exec
(
'tdSql.query("select stddev(col{}) from test where {}")'
.
format
(
i
+
1
,
key
))
for
j
in
range
(
value
):
for
j
in
range
(
value
):
tdSql
.
checkData
(
j
,
0
,
result
[
i
])
tdSql
.
checkData
(
j
,
0
,
result
[
i
])
for
i
in
range
(
11
,
15
):
exec
(
'tdSql.query("select stddev(col{}) from test where {}")'
.
format
(
i
,
key
))
for
j
in
range
(
value
):
tdSql
.
checkData
(
j
,
0
,
result
[
0
])
def
stop
(
self
):
def
stop
(
self
):
tdSql
.
close
()
tdSql
.
close
()
...
...
tests/pytest/functions/function_sum.py
浏览文件 @
0b4f0680
...
@@ -56,6 +56,14 @@ class TDTestCase:
...
@@ -56,6 +56,14 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
0
,
np
.
sum
(
intData
))
tdSql
.
checkData
(
0
,
0
,
np
.
sum
(
intData
))
tdSql
.
query
(
"select sum(col4) from test"
)
tdSql
.
query
(
"select sum(col4) from test"
)
tdSql
.
checkData
(
0
,
0
,
np
.
sum
(
intData
))
tdSql
.
checkData
(
0
,
0
,
np
.
sum
(
intData
))
tdSql
.
query
(
"select sum(col11) from test"
)
tdSql
.
checkData
(
0
,
0
,
np
.
sum
(
intData
))
tdSql
.
query
(
"select sum(col12) from test"
)
tdSql
.
checkData
(
0
,
0
,
np
.
sum
(
intData
))
tdSql
.
query
(
"select sum(col13) from test"
)
tdSql
.
checkData
(
0
,
0
,
np
.
sum
(
intData
))
tdSql
.
query
(
"select sum(col14) from test"
)
tdSql
.
checkData
(
0
,
0
,
np
.
sum
(
intData
))
tdSql
.
query
(
"select sum(col5) from test"
)
tdSql
.
query
(
"select sum(col5) from test"
)
tdSql
.
checkData
(
0
,
0
,
np
.
sum
(
floatData
))
tdSql
.
checkData
(
0
,
0
,
np
.
sum
(
floatData
))
tdSql
.
query
(
"select sum(col6) from test"
)
tdSql
.
query
(
"select sum(col6) from test"
)
...
...
tests/pytest/functions/function_top.py
浏览文件 @
0b4f0680
...
@@ -59,6 +59,14 @@ class TDTestCase:
...
@@ -59,6 +59,14 @@ class TDTestCase:
tdSql
.
error
(
"select top(col7, 10) from test"
)
tdSql
.
error
(
"select top(col7, 10) from test"
)
tdSql
.
error
(
"select top(col8, 10) from test"
)
tdSql
.
error
(
"select top(col8, 10) from test"
)
tdSql
.
error
(
"select top(col9, 10) from test"
)
tdSql
.
error
(
"select top(col9, 10) from test"
)
tdSql
.
error
(
"select top(col11, 0) from test"
)
tdSql
.
error
(
"select top(col11, 101) from test"
)
tdSql
.
error
(
"select top(col12, 0) from test"
)
tdSql
.
error
(
"select top(col12, 101) from test"
)
tdSql
.
error
(
"select top(col13, 0) from test"
)
tdSql
.
error
(
"select top(col13, 101) from test"
)
tdSql
.
error
(
"select top(col14, 0) from test"
)
tdSql
.
error
(
"select top(col14, 101) from test"
)
tdSql
.
query
(
"select top(col1, 2) from test"
)
tdSql
.
query
(
"select top(col1, 2) from test"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkRows
(
2
)
...
@@ -80,6 +88,26 @@ class TDTestCase:
...
@@ -80,6 +88,26 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
1
,
9
)
tdSql
.
checkData
(
0
,
1
,
9
)
tdSql
.
checkData
(
1
,
1
,
10
)
tdSql
.
checkData
(
1
,
1
,
10
)
tdSql
.
query
(
"select top(col11, 2) from test"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
9
)
tdSql
.
checkData
(
1
,
1
,
10
)
tdSql
.
query
(
"select top(col12, 2) from test"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
9
)
tdSql
.
checkData
(
1
,
1
,
10
)
tdSql
.
query
(
"select top(col13, 2) from test"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
9
)
tdSql
.
checkData
(
1
,
1
,
10
)
tdSql
.
query
(
"select top(col14, 2) from test"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
9
)
tdSql
.
checkData
(
1
,
1
,
10
)
tdSql
.
query
(
"select top(col5, 2) from test"
)
tdSql
.
query
(
"select top(col5, 2) from test"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
8.1
)
tdSql
.
checkData
(
0
,
1
,
8.1
)
...
...
tests/pytest/functions/function_twa.py
浏览文件 @
0b4f0680
...
@@ -52,7 +52,15 @@ class TDTestCase:
...
@@ -52,7 +52,15 @@ class TDTestCase:
tdSql
.
error
(
"select twa(col3) from test"
)
tdSql
.
error
(
"select twa(col3) from test"
)
tdSql
.
error
(
"select twa(col4) from test"
)
tdSql
.
error
(
"select twa(col4) from test"
)
tdSql
.
error
(
"select twa(col11) from test"
)
tdSql
.
error
(
"select twa(col12) from test"
)
tdSql
.
error
(
"select twa(col13) from test"
)
tdSql
.
error
(
"select twa(col14) from test"
)
tdSql
.
error
(
"select twa(col5) from test"
)
tdSql
.
error
(
"select twa(col5) from test"
)
...
@@ -79,6 +87,18 @@ class TDTestCase:
...
@@ -79,6 +87,18 @@ class TDTestCase:
tdSql
.
error
(
"select twa(col4) from test where ts > %d and ts < %d"
%
(
self
.
ts
,
self
.
ts
+
self
.
rowNum
))
tdSql
.
error
(
"select twa(col4) from test where ts > %d and ts < %d"
%
(
self
.
ts
,
self
.
ts
+
self
.
rowNum
))
tdSql
.
query
(
"select twa(col4) from test1 where ts > %d and ts < %d"
%
(
self
.
ts
,
self
.
ts
+
self
.
rowNum
))
tdSql
.
query
(
"select twa(col4) from test1 where ts > %d and ts < %d"
%
(
self
.
ts
,
self
.
ts
+
self
.
rowNum
))
tdSql
.
error
(
"select twa(col11) from test where ts > %d and ts < %d"
%
(
self
.
ts
,
self
.
ts
+
self
.
rowNum
))
tdSql
.
query
(
"select twa(col11) from test1 where ts > %d and ts < %d"
%
(
self
.
ts
,
self
.
ts
+
self
.
rowNum
))
tdSql
.
error
(
"select twa(col12) from test where ts > %d and ts < %d"
%
(
self
.
ts
,
self
.
ts
+
self
.
rowNum
))
tdSql
.
query
(
"select twa(col12) from test1 where ts > %d and ts < %d"
%
(
self
.
ts
,
self
.
ts
+
self
.
rowNum
))
tdSql
.
error
(
"select twa(col13) from test where ts > %d and ts < %d"
%
(
self
.
ts
,
self
.
ts
+
self
.
rowNum
))
tdSql
.
query
(
"select twa(col13) from test1 where ts > %d and ts < %d"
%
(
self
.
ts
,
self
.
ts
+
self
.
rowNum
))
tdSql
.
error
(
"select twa(col14) from test where ts > %d and ts < %d"
%
(
self
.
ts
,
self
.
ts
+
self
.
rowNum
))
tdSql
.
query
(
"select twa(col14) from test1 where ts > %d and ts < %d"
%
(
self
.
ts
,
self
.
ts
+
self
.
rowNum
))
tdSql
.
error
(
"select twa(col5) from test where ts > %d and ts < %d"
%
(
self
.
ts
,
self
.
ts
+
self
.
rowNum
))
tdSql
.
error
(
"select twa(col5) from test where ts > %d and ts < %d"
%
(
self
.
ts
,
self
.
ts
+
self
.
rowNum
))
tdSql
.
query
(
"select twa(col5) from test1 where ts > %d and ts < %d"
%
(
self
.
ts
,
self
.
ts
+
self
.
rowNum
))
tdSql
.
query
(
"select twa(col5) from test1 where ts > %d and ts < %d"
%
(
self
.
ts
,
self
.
ts
+
self
.
rowNum
))
...
...
tests/pytest/functions/function_twa_restart.py
浏览文件 @
0b4f0680
...
@@ -52,7 +52,15 @@ class TDTestCase:
...
@@ -52,7 +52,15 @@ class TDTestCase:
tdSql
.
error
(
"select twa(col3) from test"
)
tdSql
.
error
(
"select twa(col3) from test"
)
tdSql
.
error
(
"select twa(col4) from test"
)
tdSql
.
error
(
"select twa(col4) from test"
)
tdSql
.
error
(
"select twa(col11) from test"
)
tdSql
.
error
(
"select twa(col12) from test"
)
tdSql
.
error
(
"select twa(col13) from test"
)
tdSql
.
error
(
"select twa(col14) from test"
)
tdSql
.
error
(
"select twa(col5) from test"
)
tdSql
.
error
(
"select twa(col5) from test"
)
...
@@ -79,6 +87,18 @@ class TDTestCase:
...
@@ -79,6 +87,18 @@ class TDTestCase:
tdSql
.
error
(
"select twa(col4) from test where ts > %d and ts < %d"
%
(
self
.
ts
,
self
.
ts
+
self
.
rowNum
))
tdSql
.
error
(
"select twa(col4) from test where ts > %d and ts < %d"
%
(
self
.
ts
,
self
.
ts
+
self
.
rowNum
))
tdSql
.
query
(
"select twa(col4) from test1 where ts > %d and ts < %d"
%
(
self
.
ts
,
self
.
ts
+
self
.
rowNum
))
tdSql
.
query
(
"select twa(col4) from test1 where ts > %d and ts < %d"
%
(
self
.
ts
,
self
.
ts
+
self
.
rowNum
))
tdSql
.
error
(
"select twa(col11) from test where ts > %d and ts < %d"
%
(
self
.
ts
,
self
.
ts
+
self
.
rowNum
))
tdSql
.
query
(
"select twa(col11) from test1 where ts > %d and ts < %d"
%
(
self
.
ts
,
self
.
ts
+
self
.
rowNum
))
tdSql
.
error
(
"select twa(col12) from test where ts > %d and ts < %d"
%
(
self
.
ts
,
self
.
ts
+
self
.
rowNum
))
tdSql
.
query
(
"select twa(col12) from test1 where ts > %d and ts < %d"
%
(
self
.
ts
,
self
.
ts
+
self
.
rowNum
))
tdSql
.
error
(
"select twa(col13) from test where ts > %d and ts < %d"
%
(
self
.
ts
,
self
.
ts
+
self
.
rowNum
))
tdSql
.
query
(
"select twa(col13) from test1 where ts > %d and ts < %d"
%
(
self
.
ts
,
self
.
ts
+
self
.
rowNum
))
tdSql
.
error
(
"select twa(col14) from test where ts > %d and ts < %d"
%
(
self
.
ts
,
self
.
ts
+
self
.
rowNum
))
tdSql
.
query
(
"select twa(col14) from test1 where ts > %d and ts < %d"
%
(
self
.
ts
,
self
.
ts
+
self
.
rowNum
))
tdSql
.
error
(
"select twa(col5) from test where ts > %d and ts < %d"
%
(
self
.
ts
,
self
.
ts
+
self
.
rowNum
))
tdSql
.
error
(
"select twa(col5) from test where ts > %d and ts < %d"
%
(
self
.
ts
,
self
.
ts
+
self
.
rowNum
))
tdSql
.
query
(
"select twa(col5) from test1 where ts > %d and ts < %d"
%
(
self
.
ts
,
self
.
ts
+
self
.
rowNum
))
tdSql
.
query
(
"select twa(col5) from test1 where ts > %d and ts < %d"
%
(
self
.
ts
,
self
.
ts
+
self
.
rowNum
))
...
...
tests/pytest/pytest_4.sh
浏览文件 @
0b4f0680
...
@@ -35,4 +35,5 @@ python3 ./test.py -f query/queryGroupbySort.py
...
@@ -35,4 +35,5 @@ python3 ./test.py -f query/queryGroupbySort.py
python3 ./test.py
-f
insert/unsignedInt.py
python3 ./test.py
-f
insert/unsignedInt.py
python3 ./test.py
-f
insert/unsignedBigint.py
python3 ./test.py
-f
insert/unsignedBigint.py
python3 ./test.py
-f
insert/unsignedSmallint.py
python3 ./test.py
-f
insert/unsignedSmallint.py
python3 ./test.py
-f
insert/unsignedTinyint.py
python3 ./test.py
-f
insert/unsignedTinyint.py
\ No newline at end of file
python3 ./test.py
-f
query/filterAllUnsignedIntTypes.py
\ No newline at end of file
tests/pytest/query/filterAllUnsignedIntTypes.py
0 → 100644
浏览文件 @
0b4f0680
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
sys
import
taos
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
())
self
.
powers
=
[
8
,
16
,
32
,
64
]
self
.
types
=
[
"tinyint"
,
"smallint"
,
"int"
,
"bigint"
]
self
.
rowNum
=
10
self
.
ts
=
1537146000000
def
run
(
self
):
tdSql
.
prepare
()
for
i
in
range
(
len
(
self
.
powers
)):
curType
=
self
.
types
[
i
]
print
(
"======= Verify filter for %s type ========="
%
(
curType
))
tdLog
.
debug
(
"create table st%s(ts timestamp, num %s unsigned) tags(id %s unsigned)"
%
(
curType
,
curType
,
curType
))
tdSql
.
execute
(
"create table st%s(ts timestamp, num %s unsigned) tags(id %s unsigned)"
%
(
curType
,
curType
,
curType
))
# create 10 tables, insert 10 rows for each table
for
j
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
"create table st%s%d using st%s tags(%d)"
%
(
curType
,
j
+
1
,
curType
,
j
+
1
))
for
k
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
"insert into st%s%d values(%d, %d)"
%
(
curType
,
j
+
1
,
self
.
ts
+
k
+
1
,
j
*
10
+
k
+
1
))
tdSql
.
error
(
"insert into st%s10 values(%d, %d)"
%
(
curType
,
self
.
ts
+
11
,
pow
(
2
,
self
.
powers
[
i
])
-
1
))
tdSql
.
execute
(
"insert into st%s10 values(%d, %d)"
%
(
curType
,
self
.
ts
+
12
,
pow
(
2
,
self
.
powers
[
i
])
-
2
))
tdSql
.
error
(
"insert into st%s10 values(%d, %d)"
%
(
curType
,
self
.
ts
+
13
,
-
1
))
tdSql
.
execute
(
"insert into st%s10 values(%d, %d)"
%
(
curType
,
self
.
ts
+
14
,
0
))
# select all data
# tdSql.query("select * from st%s " % curType)
# tdSql.checkRows(102)
# > for int type on column
tdSql
.
query
(
"select * from st%s where num > 50"
%
curType
)
tdSql
.
checkRows
(
51
)
# >= for int type on column
tdSql
.
query
(
"select * from st%s where num >= 50"
%
curType
)
tdSql
.
checkRows
(
52
)
# = for int type on column
tdSql
.
query
(
"select * from st%s where num = 50"
%
curType
)
tdSql
.
checkRows
(
1
)
# < for int type on column
tdSql
.
query
(
"select * from st%s where num < 50"
%
curType
)
tdSql
.
checkRows
(
50
)
# <= for int type on column
tdSql
.
query
(
"select * from st%s where num <= 50"
%
curType
)
tdSql
.
checkRows
(
51
)
# <> for int type on column
tdSql
.
query
(
"select * from st%s where num <> 50"
%
curType
)
tdSql
.
checkRows
(
101
)
# != for int type on column
tdSql
.
query
(
"select * from st%s where num != 50"
%
curType
)
tdSql
.
checkRows
(
101
)
# range for int type on column
tdSql
.
query
(
"select * from st%s where num > 50 and num < 100"
%
curType
)
tdSql
.
checkRows
(
49
)
tdSql
.
query
(
"select * from st%s where num >= 50 and num < 100"
%
curType
)
tdSql
.
checkRows
(
50
)
tdSql
.
query
(
"select * from st%s where num > 50 and num <= 100"
%
curType
)
tdSql
.
checkRows
(
50
)
tdSql
.
query
(
"select * from st%s where num >= 50 and num <= 100"
%
curType
)
tdSql
.
checkRows
(
51
)
# > for int type on tag
tdSql
.
query
(
"select * from st%s where id > 5"
%
curType
)
tdSql
.
checkRows
(
52
)
# >= for int type on tag
tdSql
.
query
(
"select * from st%s where id >= 5"
%
curType
)
tdSql
.
checkRows
(
62
)
# = for int type on tag
tdSql
.
query
(
"select * from st%s where id = 5"
%
curType
)
tdSql
.
checkRows
(
10
)
# < for int type on tag
tdSql
.
query
(
"select * from st%s where id < 5"
%
curType
)
tdSql
.
checkRows
(
40
)
# <= for int type on tag
tdSql
.
query
(
"select * from st%s where id <= 5"
%
curType
)
tdSql
.
checkRows
(
50
)
# <> for int type on tag
tdSql
.
query
(
"select * from st%s where id <> 5"
%
curType
)
tdSql
.
checkRows
(
92
)
# != for int type on tag
tdSql
.
query
(
"select * from st%s where id != 5"
%
curType
)
tdSql
.
checkRows
(
92
)
# != for int type on tag
tdSql
.
query
(
"select * from st%s where id != 5"
%
curType
)
tdSql
.
checkRows
(
92
)
# range for int type on tag
tdSql
.
query
(
"select * from st%s where id > 5 and id < 7"
%
curType
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
"select * from st%s where id >= 5 and id < 7"
%
curType
)
tdSql
.
checkRows
(
20
)
tdSql
.
query
(
"select * from st%s where id > 5 and id <= 7"
%
curType
)
tdSql
.
checkRows
(
20
)
tdSql
.
query
(
"select * from st%s where id >= 5 and id <= 7"
%
curType
)
tdSql
.
checkRows
(
30
)
print
(
"======= Verify filter for %s type finished ========="
%
curType
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/query/queryNullValueTest.py
浏览文件 @
0b4f0680
...
@@ -25,7 +25,7 @@ class TDTestCase:
...
@@ -25,7 +25,7 @@ class TDTestCase:
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
self
.
types
=
[
"tinyint"
,
"smallint"
,
"int"
,
"bigint"
,
"float"
,
"double"
,
"bool"
,
"binary(10)"
,
"nchar(10)"
]
self
.
types
=
[
"tinyint"
,
"smallint"
,
"int"
,
"bigint"
,
"float"
,
"double"
,
"bool"
,
"binary(10)"
,
"nchar(10)"
,
"tinyint unsigned"
,
"smallint unsigned"
,
"int unsigned"
,
"bigint unsigned"
]
self
.
ts
=
1537146000000
self
.
ts
=
1537146000000
def
checkNullValue
(
self
,
result
):
def
checkNullValue
(
self
,
result
):
...
...
tests/pytest/query/querySort.py
浏览文件 @
0b4f0680
...
@@ -73,19 +73,19 @@ class TDTestCase:
...
@@ -73,19 +73,19 @@ class TDTestCase:
print
(
"======= step 1: create table and insert data ========="
)
print
(
"======= step 1: create table and insert data ========="
)
tdLog
.
debug
(
tdLog
.
debug
(
''' create table st(ts timestamp, tbcol1 tinyint, tbcol2 smallint, tbcol3 int, tbcol4 bigint, tbcol5 float, tbcol6 double,
''' create table st(ts timestamp, tbcol1 tinyint, tbcol2 smallint, tbcol3 int, tbcol4 bigint, tbcol5 float, tbcol6 double,
tbcol7 bool, tbcol8 nchar(20), tbcol9 binary(20)) tags(tagcol1 tinyint, tagcol2 smallint, tagcol3 int, tagcol4 bigint, tagcol5 float,
tbcol7 bool, tbcol8 nchar(20), tbcol9 binary(20)
, tbcol11 tinyint unsigned, tbcol12 smallint unsigned, tbcol13 int unsigned, tbcol14 bigint unsigned
) tags(tagcol1 tinyint, tagcol2 smallint, tagcol3 int, tagcol4 bigint, tagcol5 float,
tagcol6 double, tagcol7 bool, tagcol8 nchar(20), tagcol9 binary(20))'''
)
tagcol6 double, tagcol7 bool, tagcol8 nchar(20), tagcol9 binary(20)
, tagcol11 tinyint unsigned, tagcol12 smallint unsigned, tagcol13 int unsigned, tagcol14 bigint unsigned
)'''
)
tdSql
.
execute
(
tdSql
.
execute
(
''' create table st(ts timestamp, tbcol1 tinyint, tbcol2 smallint, tbcol3 int, tbcol4 bigint, tbcol5 float, tbcol6 double,
''' create table st(ts timestamp, tbcol1 tinyint, tbcol2 smallint, tbcol3 int, tbcol4 bigint, tbcol5 float, tbcol6 double,
tbcol7 bool, tbcol8 nchar(20), tbcol9 binary(20)) tags(tagcol1 tinyint, tagcol2 smallint, tagcol3 int, tagcol4 bigint, tagcol5 float,
tbcol7 bool, tbcol8 nchar(20), tbcol9 binary(20)
, tbcol11 tinyint unsigned, tbcol12 smallint unsigned, tbcol13 int unsigned, tbcol14 bigint unsigned
) tags(tagcol1 tinyint, tagcol2 smallint, tagcol3 int, tagcol4 bigint, tagcol5 float,
tagcol6 double, tagcol7 bool, tagcol8 nchar(20), tagcol9 binary(20))'''
)
tagcol6 double, tagcol7 bool, tagcol8 nchar(20), tagcol9 binary(20)
, tagcol11 tinyint unsigned, tagcol12 smallint unsigned, tagcol13 int unsigned, tagcol14 bigint unsigned
)'''
)
for
i
in
range
(
self
.
rowNum
):
for
i
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
"create table st%d using st tags(%d, %d, %d, %d, %f, %f, %d, 'tag%d', '标签%d')"
%
(
tdSql
.
execute
(
"create table st%d using st tags(%d, %d, %d, %d, %f, %f, %d, 'tag%d', '标签%d'
, %d, %d, %d, %d
)"
%
(
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
,
1.1
*
(
i
+
1
),
1.23
*
(
i
+
1
),
(
i
+
1
)
%
2
,
i
+
1
,
i
+
1
))
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
,
1.1
*
(
i
+
1
),
1.23
*
(
i
+
1
),
(
i
+
1
)
%
2
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
))
for
j
in
range
(
self
.
rowNum
):
for
j
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
"insert into st%d values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
%
(
tdSql
.
execute
(
"insert into st%d values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d'
, %d, %d, %d, %d
)"
%
(
i
+
1
,
self
.
ts
+
10
*
(
i
+
1
)
+
j
+
1
,
j
+
1
,
j
+
1
,
j
+
1
,
j
+
1
,
1.1
*
(
j
+
1
),
1.23
*
(
j
+
1
),
(
j
+
1
)
%
2
,
j
+
1
,
j
+
1
))
i
+
1
,
self
.
ts
+
10
*
(
i
+
1
)
+
j
+
1
,
j
+
1
,
j
+
1
,
j
+
1
,
j
+
1
,
1.1
*
(
j
+
1
),
1.23
*
(
j
+
1
),
(
j
+
1
)
%
2
,
j
+
1
,
j
+
1
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
))
print
(
"======= step 2: verify order for each column ========="
)
print
(
"======= step 2: verify order for each column ========="
)
# sort for timestamp in asc order
# sort for timestamp in asc order
...
...
tests/pytest/tag_lite/add.py
浏览文件 @
0b4f0680
...
@@ -141,6 +141,98 @@ class TDTestCase:
...
@@ -141,6 +141,98 @@ class TDTestCase:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step2
# TSIM: sql select * from $mt where tgcol2 = 1 -x step2
tdLog
.
info
(
'select * from %s where tgcol2 = 1 -x step2'
%
(
mt
))
tdLog
.
info
(
'select * from %s where tgcol2 = 1 -x step2'
%
(
mt
))
tdSql
.
error
(
'select * from %s where tgcol2 = 1'
%
(
mt
))
tdSql
.
error
(
'select * from %s where tgcol2 = 1'
%
(
mt
))
tdLog
.
info
(
'=============== step2-1'
)
# TSIM: $i = 2
i
=
21
# TSIM: $mt = $mtPrefix . $i
mt
=
"%s%d"
%
(
mtPrefix
,
i
)
# TSIM: $tb = $tbPrefix . $i
tb
=
"%s%d"
%
(
tbPrefix
,
i
)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# bool, tgcol2 int)
tdLog
.
info
(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int unsigned)'
%
(
mt
))
tdSql
.
execute
(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bool, tgcol2 int unsigned)'
%
(
mt
))
# TSIM: sql create table $tb using $mt tags( 1, 2 )
tdLog
.
info
(
'create table %s using %s tags( 1, 2 )'
%
(
tb
,
mt
))
tdSql
.
execute
(
'create table %s using %s tags( 1, 2 )'
%
(
tb
,
mt
))
# TSIM: sql insert into $tb values(now, 1)
tdLog
.
info
(
'insert into %s values(now, 1)'
%
(
tb
))
tdSql
.
execute
(
'insert into %s values(now, 1)'
%
(
tb
))
# TSIM: sql select * from $mt where tgcol2 = 2
tdLog
.
info
(
'select * from %s where tgcol2 = 2'
%
(
mt
))
tdSql
.
query
(
'select * from %s where tgcol2 = 2'
%
(
mt
))
# TSIM: if $rows != 1 then
tdLog
.
info
(
'tdSql.checkRow(1)'
)
tdSql
.
checkRows
(
1
)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data01 != 1 then
tdLog
.
info
(
'tdSql.checkData(0, 1, 1)'
)
tdSql
.
checkData
(
0
,
1
,
1
)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data02 != 1 then
tdLog
.
info
(
'tdSql.checkData(0, 2, 1)'
)
tdSql
.
checkData
(
0
,
2
,
1
)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data03 != 2 then
tdLog
.
info
(
'tdSql.checkData(0, 3, 2)'
)
tdSql
.
checkData
(
0
,
3
,
2
)
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol2
tdLog
.
info
(
'alter table %s drop tag tgcol2'
%
(
mt
))
tdSql
.
execute
(
'alter table %s drop tag tgcol2'
%
(
mt
))
# TSIM: sql alter table $mt add tag tgcol4 int
tdLog
.
info
(
'alter table %s add tag tgcol4 int unsigned'
%
(
mt
))
tdSql
.
execute
(
'alter table %s add tag tgcol4 int unsigned'
%
(
mt
))
tdLog
.
info
(
'select * from %s where tgcol4=6'
%
(
mt
))
tdSql
.
query
(
'select * from %s where tgcol4=6'
%
(
mt
))
# TSIM: sql reset query cache
tdLog
.
info
(
'reset query cache'
)
tdSql
.
execute
(
'reset query cache'
)
# TSIM: sql alter table $tb set tag tgcol4 =4
tdLog
.
info
(
'alter table %s set tag tgcol4 =4'
%
(
tb
))
tdSql
.
execute
(
'alter table %s set tag tgcol4 =4'
%
(
tb
))
# TSIM: sql reset query cache
tdLog
.
info
(
'reset query cache'
)
tdSql
.
execute
(
'reset query cache'
)
# TSIM:
# TSIM: sql select * from $mt where tgcol4 = 4
tdLog
.
info
(
'select * from %s where tgcol4 = 4'
%
(
mt
))
tdSql
.
query
(
'select * from %s where tgcol4 = 4'
%
(
mt
))
# TSIM: print $data01 $data02 $data03
tdLog
.
info
(
'$data01 $data02 $data03'
)
# TSIM: if $rows != 1 then
tdLog
.
info
(
'tdSql.checkRow(1)'
)
tdSql
.
checkRows
(
1
)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data01 != 1 then
tdLog
.
info
(
'tdSql.checkData(0, 1, 1)'
)
tdSql
.
checkData
(
0
,
1
,
1
)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data02 != 1 then
tdLog
.
info
(
'tdSql.checkData(0, 2, 1)'
)
tdSql
.
checkData
(
0
,
2
,
1
)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data03 != 4 then
tdLog
.
info
(
'tdSql.checkData(0, 3, 4)'
)
tdSql
.
checkData
(
0
,
3
,
4
)
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step2
tdLog
.
info
(
'select * from %s where tgcol2 = 1 -x step2'
%
(
mt
))
tdSql
.
error
(
'select * from %s where tgcol2 = 1'
%
(
mt
))
# TSIM: return -1
# TSIM: return -1
# TSIM: step2:
# TSIM: step2:
# TSIM:
# TSIM:
...
@@ -235,6 +327,96 @@ class TDTestCase:
...
@@ -235,6 +327,96 @@ class TDTestCase:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step3
# TSIM: sql select * from $mt where tgcol2 = 1 -x step3
tdLog
.
info
(
'select * from %s where tgcol2 = 1 -x step3'
%
(
mt
))
tdLog
.
info
(
'select * from %s where tgcol2 = 1 -x step3'
%
(
mt
))
tdSql
.
error
(
'select * from %s where tgcol2 = 1'
%
(
mt
))
tdSql
.
error
(
'select * from %s where tgcol2 = 1'
%
(
mt
))
tdLog
.
info
(
'=============== step3-1'
)
# TSIM: $i = 3
i
=
31
# TSIM: $mt = $mtPrefix . $i
mt
=
"%s%d"
%
(
mtPrefix
,
i
)
# TSIM: $tb = $tbPrefix . $i
tb
=
"%s%d"
%
(
tbPrefix
,
i
)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# smallint, tgcol2 tinyint)
tdLog
.
info
(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint unsigned, tgcol2 tinyint unsigned)'
%
(
mt
))
tdSql
.
execute
(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 smallint unsigned, tgcol2 tinyint unsigned)'
%
(
mt
))
# TSIM: sql create table $tb using $mt tags( 1, 2 )
tdLog
.
info
(
'create table %s using %s tags( 1, 2 )'
%
(
tb
,
mt
))
tdSql
.
execute
(
'create table %s using %s tags( 1, 2 )'
%
(
tb
,
mt
))
# TSIM: sql insert into $tb values(now, 1)
tdLog
.
info
(
'insert into %s values(now, 1)'
%
(
tb
))
tdSql
.
execute
(
'insert into %s values(now, 1)'
%
(
tb
))
# TSIM: sql select * from $mt where tgcol2 = 2
tdLog
.
info
(
'select * from %s where tgcol2 = 2'
%
(
mt
))
tdSql
.
query
(
'select * from %s where tgcol2 = 2'
%
(
mt
))
# TSIM: if $rows != 1 then
tdLog
.
info
(
'tdSql.checkRow(1)'
)
tdSql
.
checkRows
(
1
)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data01 != 1 then
tdLog
.
info
(
'tdSql.checkData(0, 1, 1)'
)
tdSql
.
checkData
(
0
,
1
,
1
)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data02 != 1 then
tdLog
.
info
(
'tdSql.checkData(0, 2, 1)'
)
tdSql
.
checkData
(
0
,
2
,
1
)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data03 != 2 then
tdLog
.
info
(
'tdSql.checkData(0, 3, 2)'
)
tdSql
.
checkData
(
0
,
3
,
2
)
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol2
tdLog
.
info
(
'alter table %s drop tag tgcol2'
%
(
mt
))
tdSql
.
execute
(
'alter table %s drop tag tgcol2'
%
(
mt
))
# TSIM: sql alter table $mt add tag tgcol4 tinyint
tdLog
.
info
(
'alter table %s add tag tgcol4 tinyint unsigned'
%
(
mt
))
tdSql
.
execute
(
'alter table %s add tag tgcol4 tinyint unsigned'
%
(
mt
))
# TSIM: sql reset query cache
tdLog
.
info
(
'reset query cache'
)
tdSql
.
execute
(
'reset query cache'
)
# TSIM: sql alter table $tb set tag tgcol4=4
tdLog
.
info
(
'alter table %s set tag tgcol4=4'
%
(
tb
))
tdSql
.
execute
(
'alter table %s set tag tgcol4=4'
%
(
tb
))
# TSIM: sql reset query cache
tdLog
.
info
(
'reset query cache'
)
tdSql
.
execute
(
'reset query cache'
)
# TSIM:
# TSIM: sql select * from $mt where tgcol4 = 4
tdLog
.
info
(
'select * from %s where tgcol4 = 4'
%
(
mt
))
tdSql
.
query
(
'select * from %s where tgcol4 = 4'
%
(
mt
))
# TSIM: print $data01 $data02 $data03
tdLog
.
info
(
'$data01 $data02 $data03'
)
# TSIM: if $rows != 1 then
tdLog
.
info
(
'tdSql.checkRow(1)'
)
tdSql
.
checkRows
(
1
)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data01 != 1 then
tdLog
.
info
(
'tdSql.checkData(0, 1, 1)'
)
tdSql
.
checkData
(
0
,
1
,
1
)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data02 != 1 then
tdLog
.
info
(
'tdSql.checkData(0, 2, 1)'
)
tdSql
.
checkData
(
0
,
2
,
1
)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data03 != 4 then
tdLog
.
info
(
'tdSql.checkData(0, 3, 4)'
)
tdSql
.
checkData
(
0
,
3
,
4
)
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step3
tdLog
.
info
(
'select * from %s where tgcol2 = 1 -x step3'
%
(
mt
))
tdSql
.
error
(
'select * from %s where tgcol2 = 1'
%
(
mt
))
# TSIM: return -1
# TSIM: return -1
# TSIM: step3:
# TSIM: step3:
# TSIM:
# TSIM:
...
@@ -353,6 +535,120 @@ class TDTestCase:
...
@@ -353,6 +535,120 @@ class TDTestCase:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step4
# TSIM: sql select * from $mt where tgcol2 = 1 -x step4
tdLog
.
info
(
'select * from %s where tgcol2 = 1 -x step4'
%
(
mt
))
tdLog
.
info
(
'select * from %s where tgcol2 = 1 -x step4'
%
(
mt
))
tdSql
.
error
(
'select * from %s where tgcol2 = 1'
%
(
mt
))
tdSql
.
error
(
'select * from %s where tgcol2 = 1'
%
(
mt
))
tdLog
.
info
(
'=============== step4-1'
)
# TSIM: $i = 4
i
=
41
# TSIM: $mt = $mtPrefix . $i
mt
=
"%s%d"
%
(
mtPrefix
,
i
)
# TSIM: $tb = $tbPrefix . $i
tb
=
"%s%d"
%
(
tbPrefix
,
i
)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# bigint, tgcol2 float)
tdLog
.
info
(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint unsigned, tgcol2 float)'
%
(
mt
))
tdSql
.
execute
(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 bigint unsigned, tgcol2 float)'
%
(
mt
))
# TSIM: sql create table $tb using $mt tags( 1, 2 )
tdLog
.
info
(
'create table %s using %s tags( 1, 2 )'
%
(
tb
,
mt
))
tdSql
.
execute
(
'create table %s using %s tags( 1, 2 )'
%
(
tb
,
mt
))
# TSIM: sql insert into $tb values(now, 1)
tdLog
.
info
(
'insert into %s values(now, 1)'
%
(
tb
))
tdSql
.
execute
(
'insert into %s values(now, 1)'
%
(
tb
))
# TSIM: sql select * from $mt where tgcol2 = 2
tdLog
.
info
(
'select * from %s where tgcol2 = 2'
%
(
mt
))
tdSql
.
query
(
'select * from %s where tgcol2 = 2'
%
(
mt
))
# TSIM: if $rows != 1 then
tdLog
.
info
(
'tdSql.checkRow(1)'
)
tdSql
.
checkRows
(
1
)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data01 != 1 then
tdLog
.
info
(
'tdSql.checkData(0, 1, 1)'
)
tdSql
.
checkData
(
0
,
1
,
1
)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data02 != 1 then
tdLog
.
info
(
'tdSql.checkData(0, 2, 1)'
)
tdSql
.
checkData
(
0
,
2
,
1
)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data03 != 2.00000 then
tdLog
.
info
(
'tdSql.checkData(0, 3, 2.00000)'
)
tdSql
.
checkData
(
0
,
3
,
2.00000
)
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql describe $tb
tdLog
.
info
(
'describe %s'
%
(
tb
))
tdSql
.
query
(
'describe %s'
%
(
tb
))
# TSIM: if $data21 != BIGINT then
tdLog
.
info
(
'tdSql.checkDataType(2, 1, "BIGINT UNSIGNED")'
)
tdSql
.
checkDataType
(
2
,
1
,
"BIGINT"
)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data31 != FLOAT then
tdLog
.
info
(
'tdSql.checkDataType(3, 1, "FLOAT")'
)
tdSql
.
checkDataType
(
3
,
1
,
"FLOAT"
)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data23 != 1 then
tdLog
.
info
(
'tdSql.checkData(2, 3, TAG)'
)
tdSql
.
checkData
(
2
,
3
,
"TAG"
)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data33 != 2.000000 then
tdLog
.
info
(
'tdSql.checkData(3, 3, 2.000000)'
)
tdSql
.
checkData
(
3
,
3
,
"TAG"
)
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol2
tdLog
.
info
(
'alter table %s drop tag tgcol2'
%
(
mt
))
tdSql
.
execute
(
'alter table %s drop tag tgcol2'
%
(
mt
))
# TSIM: sql alter table $mt add tag tgcol4 float
tdLog
.
info
(
'alter table %s add tag tgcol4 float'
%
(
mt
))
tdSql
.
execute
(
'alter table %s add tag tgcol4 float'
%
(
mt
))
# TSIM: sql reset query cache
tdLog
.
info
(
'reset query cache'
)
tdSql
.
execute
(
'reset query cache'
)
# TSIM: sql alter table $tb set tag tgcol4=4
tdLog
.
info
(
'alter table %s set tag tgcol4=4'
%
(
tb
))
tdSql
.
execute
(
'alter table %s set tag tgcol4=4'
%
(
tb
))
# TSIM: sql reset query cache
tdLog
.
info
(
'reset query cache'
)
tdSql
.
execute
(
'reset query cache'
)
# TSIM:
# TSIM: sql select * from $mt where tgcol4 = 4
tdLog
.
info
(
'select * from %s where tgcol4 = 4'
%
(
mt
))
tdSql
.
query
(
'select * from %s where tgcol4 = 4'
%
(
mt
))
# TSIM: print $data01 $data02 $data03
tdLog
.
info
(
'$data01 $data02 $data03'
)
# TSIM: if $rows != 1 then
tdLog
.
info
(
'tdSql.checkRow(1)'
)
tdSql
.
checkRows
(
1
)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data01 != 1 then
tdLog
.
info
(
'tdSql.checkData(0, 1, 1)'
)
tdSql
.
checkData
(
0
,
1
,
1
)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data02 != 1 then
tdLog
.
info
(
'tdSql.checkData(0, 2, 1)'
)
tdSql
.
checkData
(
0
,
2
,
1
)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data03 != 4.00000 then
tdLog
.
info
(
'tdSql.checkData(0, 3, 4.00000)'
)
tdSql
.
checkData
(
0
,
3
,
4.00000
)
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql select * from $mt where tgcol2 = 1 -x step4
tdLog
.
info
(
'select * from %s where tgcol2 = 1 -x step4'
%
(
mt
))
tdSql
.
error
(
'select * from %s where tgcol2 = 1'
%
(
mt
))
# TSIM: return -1
# TSIM: return -1
# TSIM: step4:
# TSIM: step4:
# TSIM:
# TSIM:
...
@@ -408,12 +704,18 @@ class TDTestCase:
...
@@ -408,12 +704,18 @@ class TDTestCase:
# TSIM: sql alter table $mt add tag tgcol4 smallint
# TSIM: sql alter table $mt add tag tgcol4 smallint
tdLog
.
info
(
'alter table %s add tag tgcol4 smallint'
%
(
mt
))
tdLog
.
info
(
'alter table %s add tag tgcol4 smallint'
%
(
mt
))
tdSql
.
execute
(
'alter table %s add tag tgcol4 smallint'
%
(
mt
))
tdSql
.
execute
(
'alter table %s add tag tgcol4 smallint'
%
(
mt
))
# TSIM: sql alter table $mt add tag tgcol5 smallint unsigned
tdLog
.
info
(
'alter table %s add tag tgcol5 smallint unsigned'
%
(
mt
))
tdSql
.
execute
(
'alter table %s add tag tgcol5 smallint unsigned'
%
(
mt
))
# TSIM: sql reset query cache
# TSIM: sql reset query cache
tdLog
.
info
(
'reset query cache'
)
tdLog
.
info
(
'reset query cache'
)
tdSql
.
execute
(
'reset query cache'
)
tdSql
.
execute
(
'reset query cache'
)
# TSIM: sql alter table $tb set tag tgcol4=4
# TSIM: sql alter table $tb set tag tgcol4=4
tdLog
.
info
(
'alter table %s set tag tgcol4=4'
%
(
tb
))
tdLog
.
info
(
'alter table %s set tag tgcol4=4'
%
(
tb
))
tdSql
.
execute
(
'alter table %s set tag tgcol4=4'
%
(
tb
))
tdSql
.
execute
(
'alter table %s set tag tgcol4=4'
%
(
tb
))
# TSIM: sql alter table $tb set tag tgcol5=5
tdLog
.
info
(
'alter table %s set tag tgcol5=5'
%
(
tb
))
tdSql
.
execute
(
'alter table %s set tag tgcol5=5'
%
(
tb
))
# TSIM: sql reset query cache
# TSIM: sql reset query cache
tdLog
.
info
(
'reset query cache'
)
tdLog
.
info
(
'reset query cache'
)
tdSql
.
execute
(
'reset query cache'
)
tdSql
.
execute
(
'reset query cache'
)
...
@@ -441,6 +743,11 @@ class TDTestCase:
...
@@ -441,6 +743,11 @@ class TDTestCase:
# TSIM: if $data03 != 4 then
# TSIM: if $data03 != 4 then
tdLog
.
info
(
'tdSql.checkData(0, 3, 4)'
)
tdLog
.
info
(
'tdSql.checkData(0, 3, 4)'
)
tdSql
.
checkData
(
0
,
3
,
4
)
tdSql
.
checkData
(
0
,
3
,
4
)
tdSql
.
query
(
'select * from %s where tgcol5 = 5'
%
(
mt
))
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkData
(
0
,
2
,
1.000000000
)
tdSql
.
checkData
(
0
,
4
,
5
)
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM:
# TSIM:
...
...
tests/pytest/tag_lite/delete.py
浏览文件 @
0b4f0680
...
@@ -869,6 +869,93 @@ class TDTestCase:
...
@@ -869,6 +869,93 @@ class TDTestCase:
# TSIM: sql alter table $mt drop tag tgcol6
# TSIM: sql alter table $mt drop tag tgcol6
tdLog
.
info
(
'alter table %s drop tag tgcol6'
%
(
mt
))
tdLog
.
info
(
'alter table %s drop tag tgcol6'
%
(
mt
))
tdSql
.
execute
(
'alter table %s drop tag tgcol6'
%
(
mt
))
tdSql
.
execute
(
'alter table %s drop tag tgcol6'
%
(
mt
))
tdLog
.
info
(
'=============== step14'
)
# TSIM: $i = 14
i
=
14
# TSIM: $mt = $mtPrefix . $i
mt
=
"%s%d"
%
(
mtPrefix
,
i
)
# TSIM: $tb = $tbPrefix . $i
tb
=
"%s%d"
%
(
tbPrefix
,
i
)
# TSIM: sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1
# binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5
# double, tgcol6 binary(20))
tdLog
.
info
(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int unsigned, tgcol3 smallint unsigned, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20), tgcol7 tinyint unsigned, tgcol8 bigint unsigned)'
%
(
mt
))
tdSql
.
execute
(
'create table %s (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int unsigned, tgcol3 smallint unsigned, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20), tgcol7 tinyint unsigned, tgcol8 bigint unsigned)'
%
(
mt
))
# TSIM: sql create table $tb using $mt tags( '1', 2, 3, '4', 5, '6' )
tdLog
.
info
(
'create table %s using %s tags( "1", 2, 3, "4", 5, "6", 7, 8 )'
%
(
tb
,
mt
))
tdSql
.
execute
(
'create table %s using %s tags( "1", 2, 3, "4", 5, "6", 7, 8 )'
%
(
tb
,
mt
))
# TSIM: sql insert into $tb values(now, 1)
tdLog
.
info
(
'insert into %s values(now, 1)'
%
(
tb
))
tdSql
.
execute
(
'insert into %s values(now, 1)'
%
(
tb
))
# TSIM: sql select * from $mt where tgcol1 = '1'
tdLog
.
info
(
'select * from %s where tgcol1 = "1"'
%
(
mt
))
tdSql
.
query
(
'select * from %s where tgcol1 = "1"'
%
(
mt
))
# TSIM: if $rows != 1 then
tdLog
.
info
(
'tdSql.checkRow(1)'
)
tdSql
.
checkRows
(
1
)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data01 != 1 then
tdLog
.
info
(
'tdSql.checkData(0, 1, 1)'
)
tdSql
.
checkData
(
0
,
1
,
1
)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data02 != 1 then
tdLog
.
info
(
'tdSql.checkData(0, 2, "1")'
)
tdSql
.
checkData
(
0
,
2
,
"1"
)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data03 != 2 then
tdLog
.
info
(
'tdSql.checkData(0, 3, 2)'
)
tdSql
.
checkData
(
0
,
3
,
2
)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data04 != 3 then
tdLog
.
info
(
'tdSql.checkData(0, 4, 3)'
)
tdSql
.
checkData
(
0
,
4
,
3
)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data05 != 4 then
tdLog
.
info
(
'tdSql.checkData(0, 5, "4")'
)
tdSql
.
checkData
(
0
,
5
,
"4"
)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data06 != 5.000000000 then
tdLog
.
info
(
'tdSql.checkData(0, 6, 5.000000000)'
)
tdSql
.
checkData
(
0
,
6
,
5.000000000
)
# TSIM: return -1
# TSIM: endi
# TSIM: if $data07 != 6 then
tdLog
.
info
(
'tdSql.checkData(0, 7, "6")'
)
tdSql
.
checkData
(
0
,
7
,
"6"
)
tdLog
.
info
(
'tdSql.checkData(0, 8, 7)'
)
tdSql
.
checkData
(
0
,
8
,
7
)
tdLog
.
info
(
'tdSql.checkData(0, 9, 8)'
)
tdSql
.
checkData
(
0
,
9
,
8
)
# TSIM: return -1
# TSIM: endi
# TSIM:
# TSIM: sql alter table $mt drop tag tgcol3
tdLog
.
info
(
'alter table %s drop tag tgcol3'
%
(
mt
))
tdSql
.
execute
(
'alter table %s drop tag tgcol3'
%
(
mt
))
# TSIM: sql alter table $mt drop tag tgcol4
tdLog
.
info
(
'alter table %s drop tag tgcol4'
%
(
mt
))
tdSql
.
execute
(
'alter table %s drop tag tgcol4'
%
(
mt
))
# TSIM: sql alter table $mt drop tag tgcol6
tdLog
.
info
(
'alter table %s drop tag tgcol6'
%
(
mt
))
tdSql
.
execute
(
'alter table %s drop tag tgcol6'
%
(
mt
))
tdLog
.
info
(
'alter table %s drop tag tgcol8'
%
(
mt
))
tdSql
.
execute
(
'alter table %s drop tag tgcol8'
%
(
mt
))
tdLog
.
info
(
'alter table %s drop tag tgcol9'
%
(
mt
))
tdSql
.
execute
(
'alter table %s drop tag tgcol9'
%
(
mt
))
# TSIM:
# TSIM:
# TSIM: sleep 5000
# TSIM: sleep 5000
# TSIM:
# TSIM:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录