Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
loser646
TDengine
提交
1b093a0d
T
TDengine
项目概览
loser646
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
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,发现更多精彩内容 >>
未验证
提交
1b093a0d
编写于
3月 03, 2021
作者:
H
huili
提交者:
GitHub
3月 03, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5313 from taosdata/test/jenkins
<test>add test case for unsigned type
上级
c79f1a29
ff3b8bdc
变更
52
展开全部
隐藏空白更改
内联
并排
Showing
52 changed file
with
3976 addition
and
99 deletion
+3976
-99
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+1
-0
tests/pytest/alter/alter_stable.py
tests/pytest/alter/alter_stable.py
+4
-0
tests/pytest/alter/alter_table.py
tests/pytest/alter/alter_table.py
+4
-0
tests/pytest/alter/alter_table_crash.py
tests/pytest/alter/alter_table_crash.py
+8
-0
tests/pytest/fulltest.sh
tests/pytest/fulltest.sh
+5
-0
tests/pytest/functions/function_avg.py
tests/pytest/functions/function_avg.py
+12
-4
tests/pytest/functions/function_avg_restart.py
tests/pytest/functions/function_avg_restart.py
+12
-4
tests/pytest/functions/function_bottom.py
tests/pytest/functions/function_bottom.py
+23
-3
tests/pytest/functions/function_bottom_restart.py
tests/pytest/functions/function_bottom_restart.py
+23
-3
tests/pytest/functions/function_count.py
tests/pytest/functions/function_count.py
+13
-4
tests/pytest/functions/function_count_restart.py
tests/pytest/functions/function_count_restart.py
+12
-3
tests/pytest/functions/function_diff.py
tests/pytest/functions/function_diff.py
+14
-5
tests/pytest/functions/function_diff_restart.py
tests/pytest/functions/function_diff_restart.py
+11
-4
tests/pytest/functions/function_first.py
tests/pytest/functions/function_first.py
+31
-3
tests/pytest/functions/function_last.py
tests/pytest/functions/function_last.py
+31
-3
tests/pytest/functions/function_last_row.py
tests/pytest/functions/function_last_row.py
+35
-3
tests/pytest/functions/function_leastsquares.py
tests/pytest/functions/function_leastsquares.py
+19
-3
tests/pytest/functions/function_leastsquares_restart.py
tests/pytest/functions/function_leastsquares_restart.py
+12
-0
tests/pytest/functions/function_max.py
tests/pytest/functions/function_max.py
+15
-3
tests/pytest/functions/function_max_restart.py
tests/pytest/functions/function_max_restart.py
+13
-1
tests/pytest/functions/function_min.py
tests/pytest/functions/function_min.py
+15
-3
tests/pytest/functions/function_min_restart.py
tests/pytest/functions/function_min_restart.py
+12
-0
tests/pytest/functions/function_operations.py
tests/pytest/functions/function_operations.py
+6
-6
tests/pytest/functions/function_operations_restart.py
tests/pytest/functions/function_operations_restart.py
+3
-3
tests/pytest/functions/function_percentile.py
tests/pytest/functions/function_percentile.py
+55
-3
tests/pytest/functions/function_percentile_restart.py
tests/pytest/functions/function_percentile_restart.py
+52
-0
tests/pytest/functions/function_spread.py
tests/pytest/functions/function_spread.py
+36
-4
tests/pytest/functions/function_spread_restart.py
tests/pytest/functions/function_spread_restart.py
+18
-1
tests/pytest/functions/function_stddev.py
tests/pytest/functions/function_stddev.py
+15
-3
tests/pytest/functions/function_stddev_restart.py
tests/pytest/functions/function_stddev_restart.py
+12
-0
tests/pytest/functions/function_stddev_td2555.py
tests/pytest/functions/function_stddev_td2555.py
+17
-3
tests/pytest/functions/function_sum.py
tests/pytest/functions/function_sum.py
+11
-3
tests/pytest/functions/function_sum_restart.py
tests/pytest/functions/function_sum_restart.py
+7
-0
tests/pytest/functions/function_top.py
tests/pytest/functions/function_top.py
+31
-3
tests/pytest/functions/function_top_restart.py
tests/pytest/functions/function_top_restart.py
+20
-0
tests/pytest/functions/function_twa.py
tests/pytest/functions/function_twa.py
+24
-4
tests/pytest/functions/function_twa_restart.py
tests/pytest/functions/function_twa_restart.py
+24
-4
tests/pytest/insert/basic_unsigned.py
tests/pytest/insert/basic_unsigned.py
+1
-1
tests/pytest/insert/unsignedBigint.py
tests/pytest/insert/unsignedBigint.py
+108
-0
tests/pytest/insert/unsignedInt.py
tests/pytest/insert/unsignedInt.py
+108
-0
tests/pytest/insert/unsignedSmallint.py
tests/pytest/insert/unsignedSmallint.py
+108
-0
tests/pytest/insert/unsignedTinyint.py
tests/pytest/insert/unsignedTinyint.py
+1
-1
tests/pytest/pytest_4.sh
tests/pytest/pytest_4.sh
+7
-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
+86
-1
tests/pytest/tag_lite/unsignedBigint.py
tests/pytest/tag_lite/unsignedBigint.py
+602
-0
tests/pytest/tag_lite/unsignedInt.py
tests/pytest/tag_lite/unsignedInt.py
+602
-0
tests/pytest/tag_lite/unsignedSmallint.py
tests/pytest/tag_lite/unsignedSmallint.py
+603
-0
tests/pytest/tag_lite/unsignedTinyint.py
tests/pytest/tag_lite/unsignedTinyint.py
+602
-0
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
1b093a0d
...
...
@@ -2013,6 +2013,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
if
((
getColumnIndexByName
(
pCmd
,
&
pParamElem
->
pNode
->
colInfo
,
pQueryInfo
,
&
index
)
!=
TSDB_CODE_SUCCESS
))
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
}
if
(
index
.
columnIndex
==
TSDB_TBNAME_COLUMN_INDEX
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg6
);
}
...
...
tests/pytest/alter/alter_stable.py
浏览文件 @
1b093a0d
...
...
@@ -19,6 +19,10 @@ class TDTestCase:
"double"
,
"smallint"
,
"tinyint"
,
"int unsigned"
,
"bigint unsigned"
,
"smallint unsigned"
,
"tinyint unsigned"
,
"binary(10)"
,
"nchar(10)"
,
"timestamp"
]
...
...
tests/pytest/alter/alter_table.py
浏览文件 @
1b093a0d
...
...
@@ -19,6 +19,10 @@ class TDTestCase:
"double"
,
"smallint"
,
"tinyint"
,
"int unsigned"
,
"bigint unsigned"
,
"smallint unsigned"
,
"tinyint unsigned"
,
"binary(10)"
,
"nchar(10)"
,
"timestamp"
]
...
...
tests/pytest/alter/alter_table_crash.py
浏览文件 @
1b093a0d
...
...
@@ -66,6 +66,14 @@ class TDTestCase:
"alter table dt add column tbcol8 nchar(20)"
)
tdSql
.
execute
(
"alter table dt add column tbcol9 binary(20)"
)
tdSql
.
execute
(
"alter table dt add column tbcol10 tinyint unsigned"
)
tdSql
.
execute
(
"alter table dt add column tbcol11 int unsigned"
)
tdSql
.
execute
(
"alter table dt add column tbcol12 smallint unsigned"
)
tdSql
.
execute
(
"alter table dt add column tbcol13 bigint unsigned"
)
# restart taosd
tdDnodes
.
forcestop
(
1
)
...
...
tests/pytest/fulltest.sh
浏览文件 @
1b093a0d
...
...
@@ -3,12 +3,16 @@ ulimit -c unlimited
python3 ./test.py
-f
insert/basic.py
python3 ./test.py
-f
insert/int.py
python3 ./test.py
-f
insert/unsignedInt.py
python3 ./test.py
-f
insert/float.py
python3 ./test.py
-f
insert/bigint.py
python3 ./test.py
-f
insert/unsignedBigint.py
python3 ./test.py
-f
insert/bool.py
python3 ./test.py
-f
insert/double.py
python3 ./test.py
-f
insert/smallint.py
python3 ./test.py
-f
insert/unsignedSmallint.py
python3 ./test.py
-f
insert/tinyint.py
python3 ./test.py
-f
insert/unsignedTinyint.py
python3 ./test.py
-f
insert/date.py
python3 ./test.py
-f
insert/binary.py
python3 ./test.py
-f
insert/nchar.py
...
...
@@ -151,6 +155,7 @@ python3 ./test.py -f query/filterCombo.py
python3 ./test.py
-f
query/queryNormal.py
python3 ./test.py
-f
query/queryError.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/filterOtherTypes.py
python3 ./test.py
-f
query/querySort.py
...
...
tests/pytest/functions/function_avg.py
浏览文件 @
1b093a0d
...
...
@@ -34,11 +34,11 @@ class TDTestCase:
floatData
=
[]
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)) 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')"
)
for
i
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
"insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%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
))
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
))
intData
.
append
(
i
+
1
)
floatData
.
append
(
i
+
0.1
)
...
...
@@ -63,7 +63,15 @@ class TDTestCase:
tdSql
.
query
(
"select avg(col5) from test"
)
tdSql
.
checkData
(
0
,
0
,
np
.
average
(
floatData
))
tdSql
.
query
(
"select avg(col6) from test"
)
tdSql
.
checkData
(
0
,
0
,
np
.
average
(
floatData
))
tdSql
.
checkData
(
0
,
0
,
np
.
average
(
floatData
))
tdSql
.
query
(
"select avg(col11) from test"
)
tdSql
.
checkData
(
0
,
0
,
np
.
average
(
intData
))
tdSql
.
query
(
"select avg(col12) from test"
)
tdSql
.
checkData
(
0
,
0
,
np
.
average
(
intData
))
tdSql
.
query
(
"select avg(col13) from test"
)
tdSql
.
checkData
(
0
,
0
,
np
.
average
(
intData
))
tdSql
.
query
(
"select avg(col14) from test"
)
tdSql
.
checkData
(
0
,
0
,
np
.
average
(
intData
))
def
stop
(
self
):
tdSql
.
close
()
...
...
tests/pytest/functions/function_avg_restart.py
浏览文件 @
1b093a0d
...
...
@@ -34,11 +34,11 @@ class TDTestCase:
floatData
=
[]
#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)) 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')")
for
i
in
range
(
self
.
rowNum
):
#tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%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))
#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
))
intData
.
append
(
i
+
1
)
floatData
.
append
(
i
+
0.1
)
...
...
@@ -63,7 +63,15 @@ class TDTestCase:
tdSql
.
query
(
"select avg(col5) from test"
)
tdSql
.
checkData
(
0
,
0
,
np
.
average
(
floatData
))
tdSql
.
query
(
"select avg(col6) from test"
)
tdSql
.
checkData
(
0
,
0
,
np
.
average
(
floatData
))
tdSql
.
checkData
(
0
,
0
,
np
.
average
(
floatData
))
tdSql
.
query
(
"select avg(col11) from test"
)
tdSql
.
checkData
(
0
,
0
,
np
.
average
(
intData
))
tdSql
.
query
(
"select avg(col12) from test"
)
tdSql
.
checkData
(
0
,
0
,
np
.
average
(
intData
))
tdSql
.
query
(
"select avg(col13) from test"
)
tdSql
.
checkData
(
0
,
0
,
np
.
average
(
intData
))
tdSql
.
query
(
"select avg(col14) from test"
)
tdSql
.
checkData
(
0
,
0
,
np
.
average
(
intData
))
def
stop
(
self
):
tdSql
.
close
()
...
...
tests/pytest/functions/function_bottom.py
浏览文件 @
1b093a0d
...
...
@@ -31,11 +31,11 @@ class TDTestCase:
tdSql
.
prepare
()
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)) 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')"
)
for
i
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
"insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%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
))
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
))
# bottom verifacation
tdSql
.
error
(
"select bottom(ts, 10) from test"
)
...
...
@@ -84,6 +84,26 @@ class TDTestCase:
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
0.1
)
tdSql
.
checkData
(
1
,
1
,
1.1
)
tdSql
.
query
(
"select bottom(col11, 2) from test"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkData
(
1
,
1
,
2
)
tdSql
.
query
(
"select bottom(col12, 2) from test"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkData
(
1
,
1
,
2
)
tdSql
.
query
(
"select bottom(col13, 2) from test"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkData
(
1
,
1
,
2
)
tdSql
.
query
(
"select bottom(col14, 2) from test"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkData
(
1
,
1
,
2
)
#TD-2457 bottom + interval + order by
tdSql
.
error
(
'select top(col2,1) from test interval(1y) order by col2;'
)
...
...
tests/pytest/functions/function_bottom_restart.py
浏览文件 @
1b093a0d
...
...
@@ -31,11 +31,11 @@ class TDTestCase:
tdSql
.
execute
(
"use db"
)
#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)) 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')")
#for i in range(self.rowNum):
# tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%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))
# 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
))
# bottom verifacation
tdSql
.
error
(
"select bottom(ts, 10) from test"
)
...
...
@@ -75,6 +75,26 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkData
(
1
,
1
,
2
)
tdSql
.
query
(
"select bottom(col11, 2) from test"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkData
(
1
,
1
,
2
)
tdSql
.
query
(
"select bottom(col12, 2) from test"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkData
(
1
,
1
,
2
)
tdSql
.
query
(
"select bottom(col13, 2) from test"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkData
(
1
,
1
,
2
)
tdSql
.
query
(
"select bottom(col14, 2) from test"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkData
(
1
,
1
,
2
)
tdSql
.
query
(
"select bottom(col5, 2) from test"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
0.1
)
...
...
tests/pytest/functions/function_count.py
浏览文件 @
1b093a0d
...
...
@@ -31,11 +31,11 @@ class TDTestCase:
tdSql
.
prepare
()
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)) 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')"
)
for
i
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
"insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%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
))
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
))
# Count verifacation
tdSql
.
query
(
"select count(*) from test"
)
...
...
@@ -62,11 +62,20 @@ class TDTestCase:
tdSql
.
query
(
"select count(col9) from test"
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select count(col11) from test"
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select count(col12) from test"
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select count(col13) from test"
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select count(col14) from test"
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
execute
(
"alter table test add column col10 int"
)
tdSql
.
query
(
"select count(col10) from test"
)
tdSql
.
checkRows
(
0
)
tdSql
.
execute
(
"insert into test1 values(now, 1, 2, 3, 4, 1.1, 2.2, false, 'test', 'test' 1)"
)
tdSql
.
execute
(
"insert into test1 values(now, 1, 2, 3, 4, 1.1, 2.2, false, 'test', 'test'
, 1, 1, 1, 1,
1)"
)
tdSql
.
query
(
"select count(col10) from test"
)
tdSql
.
checkData
(
0
,
0
,
1
)
...
...
tests/pytest/functions/function_count_restart.py
浏览文件 @
1b093a0d
...
...
@@ -31,11 +31,11 @@ class TDTestCase:
tdSql
.
execute
(
"use db"
)
#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)) 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')")
#for i in range(self.rowNum):
# tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%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))
# 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
))
# Count verifacation
tdSql
.
query
(
"select count(*) from test"
)
...
...
@@ -62,6 +62,15 @@ class TDTestCase:
tdSql
.
query
(
"select count(col9) from test"
)
tdSql
.
checkData
(
0
,
0
,
11
)
tdSql
.
query
(
"select count(col11) from test"
)
tdSql
.
checkData
(
0
,
0
,
11
)
tdSql
.
query
(
"select count(col12) from test"
)
tdSql
.
checkData
(
0
,
0
,
11
)
tdSql
.
query
(
"select count(col13) from test"
)
tdSql
.
checkData
(
0
,
0
,
11
)
tdSql
.
query
(
"select count(col14) from test"
)
tdSql
.
checkData
(
0
,
0
,
11
)
#tdSql.execute("alter table test add column col10 int")
#tdSql.query("select count(col10) from test")
#tdSql.checkRows(0)
...
...
tests/pytest/functions/function_diff.py
浏览文件 @
1b093a0d
...
...
@@ -31,9 +31,9 @@ class TDTestCase:
tdSql
.
prepare
()
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)) 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
(
"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
))
# diff verifacation
tdSql
.
query
(
"select diff(col1) from test1"
)
...
...
@@ -55,8 +55,8 @@ class TDTestCase:
tdSql
.
checkRows
(
0
)
for
i
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
"insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%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
))
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
))
tdSql
.
error
(
"select diff(ts) from test"
)
tdSql
.
error
(
"select diff(ts) from test1"
)
...
...
@@ -72,7 +72,16 @@ class TDTestCase:
tdSql
.
error
(
"select diff(col8) from test1"
)
tdSql
.
error
(
"select diff(col9) from test"
)
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
.
checkRows
(
10
)
...
...
tests/pytest/functions/function_diff_restart.py
浏览文件 @
1b093a0d
...
...
@@ -31,7 +31,7 @@ class TDTestCase:
tdSql
.
execute
(
"use db"
)
#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)) 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("insert into test1 values(%d, 0, 0, 0, 0, 0.0, 0.0, False, ' ', ' ')" % (self.ts - 1))
...
...
@@ -55,8 +55,8 @@ class TDTestCase:
#tdSql.checkRows(0)
#for i in range(self.rowNum):
# tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%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))
# 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
))
tdSql
.
error
(
"select diff(ts) from test"
)
tdSql
.
error
(
"select diff(ts) from test1"
)
...
...
@@ -71,7 +71,14 @@ class TDTestCase:
tdSql
.
error
(
"select diff(col8) from test"
)
tdSql
.
error
(
"select diff(col8) from test1"
)
tdSql
.
error
(
"select diff(col9) from test"
)
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
.
checkRows
(
10
)
...
...
tests/pytest/functions/function_first.py
浏览文件 @
1b093a0d
...
...
@@ -31,7 +31,7 @@ class TDTestCase:
tdSql
.
prepare
()
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)) 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
(
"insert into test1(ts) values(%d)"
%
(
self
.
ts
-
1
))
...
...
@@ -52,6 +52,18 @@ class TDTestCase:
tdSql
.
query
(
"select first(col4) from test1"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select first(col11) from test1"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select first(col12) from test1"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select first(col13) from test1"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select first(col14) from test1"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select first(col5) from test1"
)
tdSql
.
checkRows
(
0
)
...
...
@@ -68,8 +80,8 @@ class TDTestCase:
tdSql
.
checkRows
(
0
)
for
i
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
"insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%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
))
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
))
tdSql
.
query
(
"select first(*) from test1"
)
tdSql
.
checkRows
(
1
)
...
...
@@ -91,6 +103,22 @@ class TDTestCase:
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
1
)
tdSql
.
query
(
"select first(col11) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
1
)
tdSql
.
query
(
"select first(col12) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
1
)
tdSql
.
query
(
"select first(col13) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
1
)
tdSql
.
query
(
"select first(col14) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
1
)
tdSql
.
query
(
"select first(col5) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
0.1
)
...
...
tests/pytest/functions/function_last.py
浏览文件 @
1b093a0d
...
...
@@ -31,7 +31,7 @@ class TDTestCase:
tdSql
.
prepare
()
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)) 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
(
"insert into test1(ts) values(%d)"
%
(
self
.
ts
-
1
))
...
...
@@ -52,6 +52,18 @@ class TDTestCase:
tdSql
.
query
(
"select last(col4) from test1"
)
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
.
checkRows
(
0
)
...
...
@@ -68,8 +80,8 @@ class TDTestCase:
tdSql
.
checkRows
(
0
)
for
i
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
"insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%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
))
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
))
tdSql
.
query
(
"select last(*) from test1"
)
tdSql
.
checkRows
(
1
)
...
...
@@ -91,6 +103,22 @@ class TDTestCase:
tdSql
.
checkRows
(
1
)
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
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
9.1
)
...
...
tests/pytest/functions/function_last_row.py
浏览文件 @
1b093a0d
...
...
@@ -31,7 +31,7 @@ class TDTestCase:
tdSql
.
prepare
()
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)) 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
(
"insert into test1(ts) values(%d)"
%
(
self
.
ts
-
1
))
...
...
@@ -56,6 +56,22 @@ class TDTestCase:
tdSql
.
checkRows
(
1
)
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
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
None
)
...
...
@@ -77,8 +93,8 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
0
,
None
)
for
i
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
"insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%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
))
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
))
tdSql
.
query
(
"select last_row(*) from test1"
)
tdSql
.
checkRows
(
1
)
...
...
@@ -100,6 +116,22 @@ class TDTestCase:
tdSql
.
checkRows
(
1
)
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
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
9.1
)
...
...
tests/pytest/functions/function_leastsquares.py
浏览文件 @
1b093a0d
...
...
@@ -31,11 +31,11 @@ class TDTestCase:
tdSql
.
prepare
()
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)) 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')"
)
for
i
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
"insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%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
))
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
))
# leastsquares verifacation
tdSql
.
error
(
"select leastsquares(ts, 1, 1) from test1"
)
...
...
@@ -48,6 +48,10 @@ class TDTestCase:
tdSql
.
error
(
"select leastsquares(col7, 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(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
.
query
(
"select leastsquares(col1, 1, 1) from test1"
)
tdSql
.
checkData
(
0
,
0
,
'{slop:1.000000, intercept:0.000000}'
)
...
...
@@ -61,6 +65,18 @@ class TDTestCase:
tdSql
.
query
(
"select leastsquares(col4, 1, 1) from test1"
)
tdSql
.
checkData
(
0
,
0
,
'{slop:1.000000, intercept:0.000000}'
)
tdSql
.
query
(
"select leastsquares(col11, 1, 1) from test1"
)
tdSql
.
checkData
(
0
,
0
,
'{slop:1.000000, intercept:0.000000}'
)
tdSql
.
query
(
"select leastsquares(col12, 1, 1) from test1"
)
tdSql
.
checkData
(
0
,
0
,
'{slop:1.000000, intercept:0.000000}'
)
tdSql
.
query
(
"select leastsquares(col13, 1, 1) from test1"
)
tdSql
.
checkData
(
0
,
0
,
'{slop:1.000000, intercept:0.000000}'
)
tdSql
.
query
(
"select leastsquares(col14, 1, 1) from test1"
)
tdSql
.
checkData
(
0
,
0
,
'{slop:1.000000, intercept:0.000000}'
)
tdSql
.
query
(
"select leastsquares(col5, 1, 1) from test1"
)
tdSql
.
checkData
(
0
,
0
,
'{slop:1.000000, intercept:-0.900000}'
)
...
...
tests/pytest/functions/function_leastsquares_restart.py
浏览文件 @
1b093a0d
...
...
@@ -54,6 +54,18 @@ class TDTestCase:
tdSql
.
query
(
"select leastsquares(col4, 1, 1) from test1"
)
tdSql
.
checkData
(
0
,
0
,
'{slop:1.000000, intercept:0.000000}'
)
tdSql
.
query
(
"select leastsquares(col11, 1, 1) from test1"
)
tdSql
.
checkData
(
0
,
0
,
'{slop:1.000000, intercept:0.000000}'
)
tdSql
.
query
(
"select leastsquares(col12, 1, 1) from test1"
)
tdSql
.
checkData
(
0
,
0
,
'{slop:1.000000, intercept:0.000000}'
)
tdSql
.
query
(
"select leastsquares(col13, 1, 1) from test1"
)
tdSql
.
checkData
(
0
,
0
,
'{slop:1.000000, intercept:0.000000}'
)
tdSql
.
query
(
"select leastsquares(col14, 1, 1) from test1"
)
tdSql
.
checkData
(
0
,
0
,
'{slop:1.000000, intercept:0.000000}'
)
tdSql
.
query
(
"select leastsquares(col5, 1, 1) from test1"
)
tdSql
.
checkData
(
0
,
0
,
'{slop:1.000000, intercept:-0.900000}'
)
...
...
tests/pytest/functions/function_max.py
浏览文件 @
1b093a0d
...
...
@@ -34,11 +34,11 @@ class TDTestCase:
floatData
=
[]
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)) 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')"
)
for
i
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
"insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%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
))
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
))
intData
.
append
(
i
+
1
)
floatData
.
append
(
i
+
0.1
)
...
...
@@ -63,6 +63,18 @@ class TDTestCase:
tdSql
.
query
(
"select max(col4) from test1"
)
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
.
checkData
(
0
,
0
,
np
.
max
(
floatData
))
...
...
tests/pytest/functions/function_max_restart.py
浏览文件 @
1b093a0d
...
...
@@ -34,7 +34,7 @@ class TDTestCase:
floatData
=
[]
#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)) 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')")
for
i
in
range
(
self
.
rowNum
):
intData
.
append
(
i
+
1
)
...
...
@@ -61,6 +61,18 @@ class TDTestCase:
tdSql
.
query
(
"select max(col4) from test1"
)
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
.
checkData
(
0
,
0
,
np
.
max
(
floatData
))
...
...
tests/pytest/functions/function_min.py
浏览文件 @
1b093a0d
...
...
@@ -34,11 +34,11 @@ class TDTestCase:
floatData
=
[]
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)) 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')"
)
for
i
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
"insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%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
))
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
))
intData
.
append
(
i
+
1
)
floatData
.
append
(
i
+
0.1
)
...
...
@@ -63,6 +63,18 @@ class TDTestCase:
tdSql
.
query
(
"select min(col4) from test1"
)
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
.
checkData
(
0
,
0
,
np
.
min
(
floatData
))
...
...
tests/pytest/functions/function_min_restart.py
浏览文件 @
1b093a0d
...
...
@@ -58,6 +58,18 @@ class TDTestCase:
tdSql
.
query
(
"select min(col4) from test1"
)
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
.
checkData
(
0
,
0
,
np
.
min
(
floatData
))
...
...
tests/pytest/functions/function_operations.py
浏览文件 @
1b093a0d
...
...
@@ -31,11 +31,11 @@ class TDTestCase:
tdSql
.
prepare
()
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)) 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')"
)
for
i
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
"insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%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
))
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
))
# min verifacation
tdSql
.
error
(
"select ts + col1 from test"
)
...
...
@@ -51,9 +51,9 @@ class TDTestCase:
tdSql
.
checkRows
(
10
)
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
.
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
.
query
(
"select col1 + col2 from test1"
)
...
...
@@ -64,7 +64,7 @@ class TDTestCase:
tdSql
.
checkRows
(
11
)
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
.
checkData
(
10
,
0
,
None
)
...
...
tests/pytest/functions/function_operations_restart.py
浏览文件 @
1b093a0d
...
...
@@ -44,9 +44,9 @@ class TDTestCase:
tdSql
.
checkRows
(
11
)
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
(
11
)
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
.
query
(
"select col1 + col2 from test1"
)
...
...
@@ -57,7 +57,7 @@ class TDTestCase:
tdSql
.
checkRows
(
11
)
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
.
checkData
(
10
,
0
,
None
)
...
...
tests/pytest/functions/function_percentile.py
浏览文件 @
1b093a0d
...
...
@@ -34,10 +34,10 @@ class TDTestCase:
floatData
=
[]
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))'''
)
col7 bool, col8 binary(20), col9 nchar(20)
, col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned
)'''
)
for
i
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
"insert into test values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%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
))
tdSql
.
execute
(
"insert into test 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
))
intData
.
append
(
i
+
1
)
floatData
.
append
(
i
+
0.1
)
...
...
@@ -103,6 +103,58 @@ class TDTestCase:
tdSql
.
query
(
"select apercentile(col4, 100) from test"
)
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"
)
print
(
"query result: %s"
%
tdSql
.
getData
(
0
,
0
))
print
(
"array result: %s"
%
np
.
percentile
(
floatData
,
0
))
...
...
tests/pytest/functions/function_percentile_restart.py
浏览文件 @
1b093a0d
...
...
@@ -99,6 +99,58 @@ class TDTestCase:
tdSql
.
query
(
"select apercentile(col4, 100) from test"
)
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"
)
print
(
"query result: %s"
%
tdSql
.
getData
(
0
,
0
))
print
(
"array result: %s"
%
np
.
percentile
(
floatData
,
0
))
...
...
tests/pytest/functions/function_spread.py
浏览文件 @
1b093a0d
...
...
@@ -31,9 +31,9 @@ class TDTestCase:
tdSql
.
prepare
()
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)) 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
(
"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
tdSql
.
query
(
"select spread(ts) from test1"
)
...
...
@@ -55,6 +55,22 @@ class TDTestCase:
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
0
)
tdSql
.
query
(
"select spread(col11) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
0
)
tdSql
.
query
(
"select spread(col12) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
0
)
tdSql
.
query
(
"select spread(col13) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
0
)
tdSql
.
query
(
"select spread(col14) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
0
)
tdSql
.
query
(
"select spread(col5) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
0
)
...
...
@@ -64,8 +80,8 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
0
,
0
)
for
i
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
"insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%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
))
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
))
tdSql
.
error
(
"select spread(col7) from test"
)
tdSql
.
error
(
"select spread(col7) from test1"
)
...
...
@@ -90,6 +106,22 @@ class TDTestCase:
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select spread(col11) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select spread(col12) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select spread(col13) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select spread(col14) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select spread(col5) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
9.1
)
...
...
tests/pytest/functions/function_spread_restart.py
浏览文件 @
1b093a0d
...
...
@@ -36,7 +36,7 @@ class TDTestCase:
tdSql
.
error
(
"select spread(col8) from test1"
)
tdSql
.
error
(
"select spread(col9) from test"
)
tdSql
.
error
(
"select spread(col9) from test1"
)
tdSql
.
query
(
"select spread(col1) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
10
)
...
...
@@ -53,6 +53,23 @@ class TDTestCase:
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select spread(col11) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select spread(col12) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select spread(col13) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select spread(col14) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select spread(col5) from test1"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
9.1
)
...
...
tests/pytest/functions/function_stddev.py
浏览文件 @
1b093a0d
...
...
@@ -34,11 +34,11 @@ class TDTestCase:
floatData
=
[]
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)) 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')"
)
for
i
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
"insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%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
))
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
))
intData
.
append
(
i
+
1
)
floatData
.
append
(
i
+
0.1
)
...
...
@@ -68,6 +68,18 @@ class TDTestCase:
tdSql
.
query
(
"select stddev(col4) from test1"
)
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
.
checkData
(
0
,
0
,
np
.
std
(
floatData
))
...
...
tests/pytest/functions/function_stddev_restart.py
浏览文件 @
1b093a0d
...
...
@@ -55,6 +55,18 @@ class TDTestCase:
tdSql
.
query
(
"select stddev(col4) from test1"
)
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
.
checkData
(
0
,
0
,
np
.
std
(
floatData
))
...
...
tests/pytest/functions/function_stddev_td2555.py
浏览文件 @
1b093a0d
...
...
@@ -32,25 +32,31 @@ class TDTestCase:
self
.
clist4
=
[]
self
.
clist5
=
[]
self
.
clist6
=
[]
self
.
clist11
=
[]
self
.
clist12
=
[]
self
.
clist13
=
[]
self
.
clist14
=
[]
def
getData
(
self
):
for
i
in
range
(
tdSql
.
queryRows
):
for
j
in
range
(
6
):
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
):
tdSql
.
prepare
()
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)) tags(cid int,gbid binary(20),loc nchar(20))'''
)
col7 bool, col8 binary(20), col9 nchar(20)
, col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned
) tags(cid int,gbid binary(20),loc nchar(20))'''
)
tdSql
.
execute
(
"create table test1 using test tags(1,'beijing','北京')"
)
tdSql
.
execute
(
"create table test2 using test tags(2,'shanghai','深圳')"
)
tdSql
.
execute
(
"create table test3 using test tags(2,'shenzhen','深圳')"
)
tdSql
.
execute
(
"create table test4 using test tags(1,'shanghai','上海')"
)
for
j
in
range
(
4
):
for
i
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
"insert into test%d values(now-%dh, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
%
(
j
+
1
,
i
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
i
*
0.1
,
i
*
1.5
,
i
%
2
,
i
+
1
,
i
+
1
))
tdSql
.
execute
(
"insert into test%d values(now-%dh, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d'
, %d, %d, %d, %d
)"
%
(
j
+
1
,
i
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
i
*
0.1
,
i
*
1.5
,
i
%
2
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
))
# stddev verifacation
tdSql
.
error
(
"select stddev(ts) from test"
)
...
...
@@ -70,6 +76,10 @@ class TDTestCase:
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
(
'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'
)
con_group_list
=
{
' cid = 2 and ts >=now - 1d and ts <now group by tbname'
:
2
,
...
...
@@ -82,6 +92,10 @@ class TDTestCase:
exec
(
'tdSql.query("select stddev(col{}) from test where {}")'
.
format
(
i
+
1
,
key
))
for
j
in
range
(
value
):
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
):
tdSql
.
close
()
...
...
tests/pytest/functions/function_sum.py
浏览文件 @
1b093a0d
...
...
@@ -34,11 +34,11 @@ class TDTestCase:
floatData
=
[]
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)) 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')"
)
for
i
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
"insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%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
))
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
))
intData
.
append
(
i
+
1
)
floatData
.
append
(
i
+
0.1
)
...
...
@@ -56,6 +56,14 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
0
,
np
.
sum
(
intData
))
tdSql
.
query
(
"select sum(col4) from test"
)
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
.
checkData
(
0
,
0
,
np
.
sum
(
floatData
))
tdSql
.
query
(
"select sum(col6) from test"
)
...
...
tests/pytest/functions/function_sum_restart.py
浏览文件 @
1b093a0d
...
...
@@ -51,6 +51,13 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
0
,
np
.
sum
(
intData
))
tdSql
.
query
(
"select sum(col4) from test"
)
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
.
query
(
"select sum(col5) from test"
)
tdSql
.
checkData
(
0
,
0
,
np
.
sum
(
floatData
))
tdSql
.
query
(
"select sum(col6) from test"
)
...
...
tests/pytest/functions/function_top.py
浏览文件 @
1b093a0d
...
...
@@ -34,11 +34,11 @@ class TDTestCase:
floatData
=
[]
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)) 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')"
)
for
i
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
"insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%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
))
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
))
intData
.
append
(
i
+
1
)
floatData
.
append
(
i
+
0.1
)
...
...
@@ -59,6 +59,14 @@ class TDTestCase:
tdSql
.
error
(
"select top(col7, 10) from test"
)
tdSql
.
error
(
"select top(col8, 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
.
checkRows
(
2
)
...
...
@@ -80,6 +88,26 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
1
,
9
)
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
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
8.1
)
...
...
tests/pytest/functions/function_top_restart.py
浏览文件 @
1b093a0d
...
...
@@ -75,6 +75,26 @@ class TDTestCase:
tdSql
.
checkData
(
0
,
1
,
9
)
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
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
1
,
8.1
)
...
...
tests/pytest/functions/function_twa.py
浏览文件 @
1b093a0d
...
...
@@ -34,11 +34,11 @@ class TDTestCase:
floatData
=
[]
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)) 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')"
)
for
i
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
"insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%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
))
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
))
intData
.
append
(
i
+
1
)
floatData
.
append
(
i
+
0.1
)
...
...
@@ -52,7 +52,15 @@ class TDTestCase:
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"
)
...
...
@@ -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
.
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
.
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
浏览文件 @
1b093a0d
...
...
@@ -34,11 +34,11 @@ class TDTestCase:
floatData
=
[]
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)) 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')"
)
for
i
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
"insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%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
))
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
))
intData
.
append
(
i
+
1
)
floatData
.
append
(
i
+
0.1
)
...
...
@@ -52,7 +52,15 @@ class TDTestCase:
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"
)
...
...
@@ -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
.
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
.
query
(
"select twa(col5) from test1 where ts > %d and ts < %d"
%
(
self
.
ts
,
self
.
ts
+
self
.
rowNum
))
...
...
tests/pytest/insert/basic_unsigned.py
浏览文件 @
1b093a0d
...
...
@@ -36,7 +36,7 @@ class TDTestCase:
(
i
,
i
))
tdLog
.
info
(
"insert earlier data"
)
tdSql
.
execute
(
'insert into tb values (now - 5m ,
10
)'
)
tdSql
.
execute
(
'insert into tb values (now - 5m ,
NULL
)'
)
tdSql
.
execute
(
'insert into tb values (now - 6m , 10)'
)
tdSql
.
execute
(
'insert into tb values (now - 7m , NULL)'
)
tdSql
.
execute
(
'insert into tb values (now - 8m , 254)'
)
...
...
tests/pytest/insert/unsignedBigint.py
0 → 100644
浏览文件 @
1b093a0d
# -*- coding: utf-8 -*-
import
sys
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
(),
logSql
)
def
run
(
self
):
tdSql
.
prepare
()
tdLog
.
info
(
'=============== step1'
)
tdLog
.
info
(
'create table tb (ts timestamp, speed bigint unsigned)'
)
tdSql
.
execute
(
'create table tb (ts timestamp, speed bigint unsigned)'
)
tdLog
.
info
(
"insert into tb values (now, NULL)"
)
tdSql
.
execute
(
"insert into tb values (now, NULL)"
)
tdLog
.
info
(
'select * from tb order by ts desc'
)
tdSql
.
query
(
'select * from tb order by ts desc'
)
tdLog
.
info
(
'tdSql.checkRow(1)'
)
tdSql
.
checkRows
(
1
)
tdLog
.
info
(
'tdSql.checkData(0, 1, null)'
)
tdSql
.
checkData
(
0
,
1
,
None
)
tdLog
.
info
(
'=============== step2'
)
tdLog
.
info
(
"insert into tb values (now+1m, -1) -x step2"
)
tdSql
.
error
(
"insert into tb values (now+1m, -1) "
)
tdLog
.
info
(
"insert into tb values (now+1m, NULL)"
)
tdSql
.
execute
(
"insert into tb values (now+1m, NULL)"
)
tdLog
.
info
(
'select * from tb order by ts desc'
)
tdSql
.
query
(
'select * from tb order by ts desc'
)
tdLog
.
info
(
'tdSql.checkRow(2)'
)
tdSql
.
checkRows
(
2
)
tdLog
.
info
(
'tdSql.checkData(0, 1, null)'
)
tdSql
.
checkData
(
0
,
1
,
None
)
tdLog
.
info
(
'=============== step3'
)
tdLog
.
info
(
"insert into tb values (now+2m, 18446744073709551614)"
)
tdSql
.
execute
(
"insert into tb values (now+2m, 18446744073709551614)"
)
tdLog
.
info
(
'select * from tb order by ts desc'
)
tdSql
.
query
(
'select * from tb order by ts desc'
)
tdLog
.
info
(
'tdSql.checkRow(3)'
)
tdSql
.
checkRows
(
3
)
tdLog
.
info
(
'tdSql.checkData(0, 1, 18446744073709551614)'
)
tdSql
.
checkData
(
0
,
1
,
18446744073709551614
)
tdLog
.
info
(
'=============== step4'
)
tdLog
.
info
(
"insert into tb values (now+3m, 18446744073709551615) -x step4"
)
tdSql
.
error
(
"insert into tb values (now+3m, 18446744073709551615)"
)
tdLog
.
info
(
"insert into tb values (now+3m, NULL)"
)
tdSql
.
execute
(
"insert into tb values (now+3m, NULL)"
)
tdLog
.
info
(
'select * from tb'
)
tdSql
.
query
(
'select * from tb'
)
tdLog
.
info
(
'tdSql.checkRow(4)'
)
tdSql
.
checkRows
(
4
)
tdLog
.
info
(
'tdSql.checkData(0, 1, null)'
)
tdSql
.
checkData
(
0
,
1
,
None
)
tdLog
.
info
(
'=============== step5'
)
tdLog
.
info
(
"insert into tb values (now+4m, a2)"
)
tdSql
.
error
(
"insert into tb values (now+4m, a2)"
)
tdLog
.
info
(
"insert into tb values (now-4m, -1)"
)
tdSql
.
error
(
"insert into tb values (now-4m, -1)"
)
tdLog
.
info
(
"insert into tb values (now+4m, 0)"
)
tdSql
.
execute
(
"insert into tb values (now+4m, 0)"
)
tdLog
.
info
(
'select * from tb order by ts desc'
)
tdSql
.
query
(
'select * from tb order by ts desc'
)
tdLog
.
info
(
'tdSql.checkRow(5)'
)
tdSql
.
checkRows
(
5
)
tdLog
.
info
(
'tdSql.checkData(0, 1, 0)'
)
tdSql
.
checkData
(
0
,
1
,
0
)
tdLog
.
info
(
'=============== step6'
)
tdLog
.
info
(
"insert into tb values (now+5m, 2a)"
)
tdSql
.
error
(
"insert into tb values (now+5m, 2a)"
)
tdLog
.
info
(
"insert into tb values (now+5m, 2)"
)
tdSql
.
execute
(
"insert into tb values (now+5m, 2)"
)
tdLog
.
info
(
'select * from tb order by ts desc'
)
tdSql
.
query
(
'select * from tb order by ts desc'
)
tdLog
.
info
(
'tdSql.checkRow(6)'
)
tdSql
.
checkRows
(
6
)
tdLog
.
info
(
'tdSql.checkData(0, 1, 2)'
)
tdSql
.
checkData
(
0
,
1
,
2
)
tdLog
.
info
(
'=============== step7'
)
tdLog
.
info
(
"insert into tb values (now+6m, 2a'1)"
)
tdSql
.
error
(
"insert into tb values (now+6m, 2a'1)"
)
tdLog
.
info
(
"insert into tb values (now+6m, 2)"
)
tdSql
.
execute
(
"insert into tb values (now+6m, 2)"
)
tdLog
.
info
(
'select * from tb order by ts desc'
)
tdSql
.
query
(
'select * from tb order by ts desc'
)
tdLog
.
info
(
'tdSql.checkRow(7)'
)
tdSql
.
checkRows
(
7
)
tdLog
.
info
(
'tdSql.checkData(0, 1, 2)'
)
tdSql
.
checkData
(
0
,
1
,
2
)
tdLog
.
info
(
'drop database db'
)
tdSql
.
execute
(
'drop database db'
)
tdLog
.
info
(
'show databases'
)
tdSql
.
query
(
'show databases'
)
tdLog
.
info
(
'tdSql.checkRow(0)'
)
tdSql
.
checkRows
(
0
)
# convert end
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/insert/unsignedInt.py
0 → 100644
浏览文件 @
1b093a0d
# -*- coding: utf-8 -*-
import
sys
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
(),
logSql
)
def
run
(
self
):
tdSql
.
prepare
()
tdLog
.
info
(
'=============== step1'
)
tdLog
.
info
(
'create table tb (ts timestamp, speed int unsigned)'
)
tdSql
.
execute
(
'create table tb (ts timestamp, speed int unsigned)'
)
tdLog
.
info
(
"insert into tb values (now, NULL)"
)
tdSql
.
execute
(
"insert into tb values (now, NULL)"
)
tdLog
.
info
(
'select * from tb order by ts desc'
)
tdSql
.
query
(
'select * from tb order by ts desc'
)
tdLog
.
info
(
'tdSql.checkRow(1)'
)
tdSql
.
checkRows
(
1
)
tdLog
.
info
(
'tdSql.checkData(0, 1, null)'
)
tdSql
.
checkData
(
0
,
1
,
None
)
tdLog
.
info
(
'=============== step2'
)
tdLog
.
info
(
"insert into tb values (now+1m, -1) -x step2"
)
tdSql
.
error
(
"insert into tb values (now+1m, -1) "
)
tdLog
.
info
(
"insert into tb values (now+1m, NULL)"
)
tdSql
.
execute
(
"insert into tb values (now+1m, NULL)"
)
tdLog
.
info
(
'select * from tb order by ts desc'
)
tdSql
.
query
(
'select * from tb order by ts desc'
)
tdLog
.
info
(
'tdSql.checkRow(2)'
)
tdSql
.
checkRows
(
2
)
tdLog
.
info
(
'tdSql.checkData(0, 1, null)'
)
tdSql
.
checkData
(
0
,
1
,
None
)
tdLog
.
info
(
'=============== step3'
)
tdLog
.
info
(
"insert into tb values (now+2m, 4294967294)"
)
tdSql
.
execute
(
"insert into tb values (now+2m, 4294967294)"
)
tdLog
.
info
(
'select * from tb order by ts desc'
)
tdSql
.
query
(
'select * from tb order by ts desc'
)
tdLog
.
info
(
'tdSql.checkRow(3)'
)
tdSql
.
checkRows
(
3
)
tdLog
.
info
(
'tdSql.checkData(0, 1, 4294967294)'
)
tdSql
.
checkData
(
0
,
1
,
4294967294
)
tdLog
.
info
(
'=============== step4'
)
tdLog
.
info
(
"insert into tb values (now+3m, 4294967295) -x step4"
)
tdSql
.
error
(
"insert into tb values (now+3m, 4294967295)"
)
tdLog
.
info
(
"insert into tb values (now+3m, NULL)"
)
tdSql
.
execute
(
"insert into tb values (now+3m, NULL)"
)
tdLog
.
info
(
'select * from tb'
)
tdSql
.
query
(
'select * from tb'
)
tdLog
.
info
(
'tdSql.checkRow(4)'
)
tdSql
.
checkRows
(
4
)
tdLog
.
info
(
'tdSql.checkData(0, 1, null)'
)
tdSql
.
checkData
(
0
,
1
,
None
)
tdLog
.
info
(
'=============== step5'
)
tdLog
.
info
(
"insert into tb values (now+4m, a2)"
)
tdSql
.
error
(
"insert into tb values (now+4m, a2)"
)
tdLog
.
info
(
"insert into tb values (now-4m, -1)"
)
tdSql
.
error
(
"insert into tb values (now-4m, -1)"
)
tdLog
.
info
(
"insert into tb values (now+4m, 0)"
)
tdSql
.
execute
(
"insert into tb values (now+4m, 0)"
)
tdLog
.
info
(
'select * from tb order by ts desc'
)
tdSql
.
query
(
'select * from tb order by ts desc'
)
tdLog
.
info
(
'tdSql.checkRow(5)'
)
tdSql
.
checkRows
(
5
)
tdLog
.
info
(
'tdSql.checkData(0, 1, 0)'
)
tdSql
.
checkData
(
0
,
1
,
0
)
tdLog
.
info
(
'=============== step6'
)
tdLog
.
info
(
"insert into tb values (now+5m, 2a)"
)
tdSql
.
error
(
"insert into tb values (now+5m, 2a)"
)
tdLog
.
info
(
"insert into tb values (now+5m, 2)"
)
tdSql
.
execute
(
"insert into tb values (now+5m, 2)"
)
tdLog
.
info
(
'select * from tb order by ts desc'
)
tdSql
.
query
(
'select * from tb order by ts desc'
)
tdLog
.
info
(
'tdSql.checkRow(6)'
)
tdSql
.
checkRows
(
6
)
tdLog
.
info
(
'tdSql.checkData(0, 1, 2)'
)
tdSql
.
checkData
(
0
,
1
,
2
)
tdLog
.
info
(
'=============== step7'
)
tdLog
.
info
(
"insert into tb values (now+6m, 2a'1)"
)
tdSql
.
error
(
"insert into tb values (now+6m, 2a'1)"
)
tdLog
.
info
(
"insert into tb values (now+6m, 2)"
)
tdSql
.
execute
(
"insert into tb values (now+6m, 2)"
)
tdLog
.
info
(
'select * from tb order by ts desc'
)
tdSql
.
query
(
'select * from tb order by ts desc'
)
tdLog
.
info
(
'tdSql.checkRow(7)'
)
tdSql
.
checkRows
(
7
)
tdLog
.
info
(
'tdSql.checkData(0, 1, 2)'
)
tdSql
.
checkData
(
0
,
1
,
2
)
tdLog
.
info
(
'drop database db'
)
tdSql
.
execute
(
'drop database db'
)
tdLog
.
info
(
'show databases'
)
tdSql
.
query
(
'show databases'
)
tdLog
.
info
(
'tdSql.checkRow(0)'
)
tdSql
.
checkRows
(
0
)
# convert end
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/insert/unsignedSmallint.py
0 → 100644
浏览文件 @
1b093a0d
# -*- coding: utf-8 -*-
import
sys
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
(),
logSql
)
def
run
(
self
):
tdSql
.
prepare
()
tdLog
.
info
(
'=============== step1'
)
tdLog
.
info
(
'create table tb (ts timestamp, speed smallint unsigned)'
)
tdSql
.
execute
(
'create table tb (ts timestamp, speed smallint unsigned)'
)
tdLog
.
info
(
"insert into tb values (now, NULL)"
)
tdSql
.
execute
(
"insert into tb values (now, NULL)"
)
tdLog
.
info
(
'select * from tb order by ts desc'
)
tdSql
.
query
(
'select * from tb order by ts desc'
)
tdLog
.
info
(
'tdSql.checkRow(1)'
)
tdSql
.
checkRows
(
1
)
tdLog
.
info
(
'tdSql.checkData(0, 1, null)'
)
tdSql
.
checkData
(
0
,
1
,
None
)
tdLog
.
info
(
'=============== step2'
)
tdLog
.
info
(
"insert into tb values (now+1m, -1) -x step2"
)
tdSql
.
error
(
"insert into tb values (now+1m, -1) "
)
tdLog
.
info
(
"insert into tb values (now+1m, NULL)"
)
tdSql
.
execute
(
"insert into tb values (now+1m, NULL)"
)
tdLog
.
info
(
'select * from tb order by ts desc'
)
tdSql
.
query
(
'select * from tb order by ts desc'
)
tdLog
.
info
(
'tdSql.checkRow(2)'
)
tdSql
.
checkRows
(
2
)
tdLog
.
info
(
'tdSql.checkData(0, 1, null)'
)
tdSql
.
checkData
(
0
,
1
,
None
)
tdLog
.
info
(
'=============== step3'
)
tdLog
.
info
(
"insert into tb values (now+2m, 65534)"
)
tdSql
.
execute
(
"insert into tb values (now+2m, 65534)"
)
tdLog
.
info
(
'select * from tb order by ts desc'
)
tdSql
.
query
(
'select * from tb order by ts desc'
)
tdLog
.
info
(
'tdSql.checkRow(3)'
)
tdSql
.
checkRows
(
3
)
tdLog
.
info
(
'tdSql.checkData(0, 1, 65534)'
)
tdSql
.
checkData
(
0
,
1
,
65534
)
tdLog
.
info
(
'=============== step4'
)
tdLog
.
info
(
"insert into tb values (now+3m, 65535) -x step4"
)
tdSql
.
error
(
"insert into tb values (now+3m, 65535)"
)
tdLog
.
info
(
"insert into tb values (now+3m, NULL)"
)
tdSql
.
execute
(
"insert into tb values (now+3m, NULL)"
)
tdLog
.
info
(
'select * from tb'
)
tdSql
.
query
(
'select * from tb'
)
tdLog
.
info
(
'tdSql.checkRow(4)'
)
tdSql
.
checkRows
(
4
)
tdLog
.
info
(
'tdSql.checkData(0, 1, null)'
)
tdSql
.
checkData
(
0
,
1
,
None
)
tdLog
.
info
(
'=============== step5'
)
tdLog
.
info
(
"insert into tb values (now+4m, a2)"
)
tdSql
.
error
(
"insert into tb values (now+4m, a2)"
)
tdLog
.
info
(
"insert into tb values (now-4m, -1)"
)
tdSql
.
error
(
"insert into tb values (now-4m, -1)"
)
tdLog
.
info
(
"insert into tb values (now+4m, 0)"
)
tdSql
.
execute
(
"insert into tb values (now+4m, 0)"
)
tdLog
.
info
(
'select * from tb order by ts desc'
)
tdSql
.
query
(
'select * from tb order by ts desc'
)
tdLog
.
info
(
'tdSql.checkRow(5)'
)
tdSql
.
checkRows
(
5
)
tdLog
.
info
(
'tdSql.checkData(0, 1, 0)'
)
tdSql
.
checkData
(
0
,
1
,
0
)
tdLog
.
info
(
'=============== step6'
)
tdLog
.
info
(
"insert into tb values (now+5m, 2a)"
)
tdSql
.
error
(
"insert into tb values (now+5m, 2a)"
)
tdLog
.
info
(
"insert into tb values (now+5m, 2)"
)
tdSql
.
execute
(
"insert into tb values (now+5m, 2)"
)
tdLog
.
info
(
'select * from tb order by ts desc'
)
tdSql
.
query
(
'select * from tb order by ts desc'
)
tdLog
.
info
(
'tdSql.checkRow(6)'
)
tdSql
.
checkRows
(
6
)
tdLog
.
info
(
'tdSql.checkData(0, 1, 2)'
)
tdSql
.
checkData
(
0
,
1
,
2
)
tdLog
.
info
(
'=============== step7'
)
tdLog
.
info
(
"insert into tb values (now+6m, 2a'1)"
)
tdSql
.
error
(
"insert into tb values (now+6m, 2a'1)"
)
tdLog
.
info
(
"insert into tb values (now+6m, 2)"
)
tdSql
.
execute
(
"insert into tb values (now+6m, 2)"
)
tdLog
.
info
(
'select * from tb order by ts desc'
)
tdSql
.
query
(
'select * from tb order by ts desc'
)
tdLog
.
info
(
'tdSql.checkRow(7)'
)
tdSql
.
checkRows
(
7
)
tdLog
.
info
(
'tdSql.checkData(0, 1, 2)'
)
tdSql
.
checkData
(
0
,
1
,
2
)
tdLog
.
info
(
'drop database db'
)
tdSql
.
execute
(
'drop database db'
)
tdLog
.
info
(
'show databases'
)
tdSql
.
query
(
'show databases'
)
tdLog
.
info
(
'tdSql.checkRow(0)'
)
tdSql
.
checkRows
(
0
)
# convert end
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/insert/unsig
e
nedTinyint.py
→
tests/pytest/insert/unsignedTinyint.py
浏览文件 @
1b093a0d
...
...
@@ -95,7 +95,7 @@ class TDTestCase:
tdSql
.
query
(
'show databases'
)
tdLog
.
info
(
'tdSql.checkRow(0)'
)
tdSql
.
checkRows
(
0
)
# convert end
def
stop
(
self
):
tdSql
.
close
()
...
...
tests/pytest/pytest_4.sh
浏览文件 @
1b093a0d
...
...
@@ -30,4 +30,10 @@ python3 ./test.py -f query/last_cache.py
python3 ./test.py
-f
query/last_row_cache.py
python3 ./test.py
-f
account/account_create.py
python3 ./test.py
-f
alter/alter_table.py
python3 ./test.py
-f
query/queryGroupbySort.py
\ No newline at end of file
python3 ./test.py
-f
query/queryGroupbySort.py
python3 ./test.py
-f
insert/unsignedInt.py
python3 ./test.py
-f
insert/unsignedBigint.py
python3 ./test.py
-f
insert/unsignedSmallint.py
python3 ./test.py
-f
insert/unsignedTinyint.py
python3 ./test.py
-f
query/filterAllUnsignedIntTypes.py
\ No newline at end of file
tests/pytest/query/filterAllUnsignedIntTypes.py
0 → 100644
浏览文件 @
1b093a0d
###################################################################
# 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
浏览文件 @
1b093a0d
...
...
@@ -25,7 +25,7 @@ class TDTestCase:
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
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
def
checkNullValue
(
self
,
result
):
...
...
tests/pytest/query/querySort.py
浏览文件 @
1b093a0d
...
...
@@ -73,19 +73,19 @@ class TDTestCase:
print
(
"======= step 1: create table and insert data ========="
)
tdLog
.
debug
(
''' 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,
tagcol6 double, tagcol7 bool, tagcol8 nchar(20), tagcol9 binary(20))'''
)
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)
, tagcol11 tinyint unsigned, tagcol12 smallint unsigned, tagcol13 int unsigned, tagcol14 bigint unsigned
)'''
)
tdSql
.
execute
(
''' 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,
tagcol6 double, tagcol7 bool, tagcol8 nchar(20), tagcol9 binary(20))'''
)
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)
, tagcol11 tinyint unsigned, tagcol12 smallint unsigned, tagcol13 int unsigned, tagcol14 bigint unsigned
)'''
)
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')"
%
(
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
))
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
))
for
j
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
"insert into st%d values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%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
))
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
,
i
+
1
,
i
+
1
,
i
+
1
))
print
(
"======= step 2: verify order for each column ========="
)
# sort for timestamp in asc order
...
...
tests/pytest/tag_lite/add.py
浏览文件 @
1b093a0d
...
...
@@ -141,6 +141,98 @@ class TDTestCase:
# 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
))
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: step2:
# TSIM:
...
...
@@ -235,6 +327,96 @@ class TDTestCase:
# 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
))
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: step3:
# TSIM:
...
...
@@ -353,6 +535,120 @@ class TDTestCase:
# 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
))
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: step4:
# TSIM:
...
...
@@ -408,12 +704,18 @@ class TDTestCase:
# TSIM: sql alter table $mt add tag tgcol4 smallint
tdLog
.
info
(
'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
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 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
tdLog
.
info
(
'reset query cache'
)
tdSql
.
execute
(
'reset query cache'
)
...
...
@@ -441,6 +743,11 @@ class TDTestCase:
# TSIM: if $data03 != 4 then
tdLog
.
info
(
'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: endi
# TSIM:
...
...
tests/pytest/tag_lite/delete.py
浏览文件 @
1b093a0d
...
...
@@ -869,6 +869,91 @@ class TDTestCase:
# 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
(
'=============== 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
))
# TSIM:
# TSIM: sleep 5000
# TSIM:
...
...
@@ -1556,7 +1641,7 @@ class TDTestCase:
# TSIM: print =============== step14
tdLog
.
info
(
'=============== step14'
)
# TSIM: $i = 14
i
=
14
i
=
20
# TSIM: $mt = $mtPrefix . $i
mt
=
"%s%d"
%
(
mtPrefix
,
i
)
# TSIM: $tb = $tbPrefix . $i
...
...
tests/pytest/tag_lite/unsignedBigint.py
0 → 100644
浏览文件 @
1b093a0d
此差异已折叠。
点击以展开。
tests/pytest/tag_lite/unsignedInt.py
0 → 100644
浏览文件 @
1b093a0d
此差异已折叠。
点击以展开。
tests/pytest/tag_lite/unsignedSmallint.py
0 → 100644
浏览文件 @
1b093a0d
此差异已折叠。
点击以展开。
tests/pytest/tag_lite/unsignedTinyint.py
0 → 100644
浏览文件 @
1b093a0d
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录