Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e2505fce
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
e2505fce
编写于
6月 16, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
6月 16, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2304 from taosdata/feature/sangshuduo/TD-478
modify format by autopep8.
上级
71f82c80
838f9e50
变更
11
展开全部
隐藏空白更改
内联
并排
Showing
11 changed file
with
412 addition
and
318 deletion
+412
-318
tests/pytest/query/filterAllIntTypes.py
tests/pytest/query/filterAllIntTypes.py
+31
-19
tests/pytest/query/filterFloatAndDouble.py
tests/pytest/query/filterFloatAndDouble.py
+18
-18
tests/pytest/query/filterOtherTypes.py
tests/pytest/query/filterOtherTypes.py
+73
-68
tests/pytest/query/querySort.py
tests/pytest/query/querySort.py
+30
-26
tests/pytest/random-test/random-test.py
tests/pytest/random-test/random-test.py
+2
-0
tests/pytest/regressiontest.sh
tests/pytest/regressiontest.sh
+1
-1
tests/pytest/table/tablename-boundary.py
tests/pytest/table/tablename-boundary.py
+4
-1
tests/pytest/tag_lite/change.py
tests/pytest/tag_lite/change.py
+11
-5
tests/pytest/tag_lite/delete.py
tests/pytest/tag_lite/delete.py
+149
-113
tests/pytest/tag_lite/set.py
tests/pytest/tag_lite/set.py
+73
-53
tests/pytest/util/sql.py
tests/pytest/util/sql.py
+20
-14
未找到文件。
tests/pytest/query/filterAllIntTypes.py
浏览文件 @
e2505fce
...
@@ -22,12 +22,12 @@ class TDTestCase:
...
@@ -22,12 +22,12 @@ class TDTestCase:
def
init
(
self
,
conn
,
logSql
):
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
())
tdSql
.
init
(
conn
.
cursor
())
self
.
powers
=
[
7
,
15
,
31
,
63
]
self
.
powers
=
[
7
,
15
,
31
,
63
]
self
.
types
=
[
"tinyint"
,
"smallint"
,
"int"
,
"bigint"
]
self
.
types
=
[
"tinyint"
,
"smallint"
,
"int"
,
"bigint"
]
self
.
rowNum
=
10
self
.
rowNum
=
10
self
.
ts
=
1537146000000
self
.
ts
=
1537146000000
def
run
(
self
):
def
run
(
self
):
tdSql
.
prepare
()
tdSql
.
prepare
()
...
@@ -35,20 +35,30 @@ class TDTestCase:
...
@@ -35,20 +35,30 @@ class TDTestCase:
curType
=
self
.
types
[
i
]
curType
=
self
.
types
[
i
]
print
(
"======= Verify filter for %s type ========="
%
(
curType
))
print
(
"======= Verify filter for %s type ========="
%
(
curType
))
tdLog
.
debug
(
tdLog
.
debug
(
"create table st%s(ts timestamp, num %s) tags(id %s)"
%
(
curType
,
curType
,
curType
))
"create table st%s(ts timestamp, num %s) tags(id %s)"
%
(
curType
,
curType
,
curType
))
tdSql
.
execute
(
tdSql
.
execute
(
"create table st%s(ts timestamp, num %s) tags(id %s)"
%
(
curType
,
curType
,
curType
))
"create table st%s(ts timestamp, num %s) tags(id %s)"
%
(
curType
,
curType
,
curType
))
#create 10 tables, insert 10 rows for each table
for
j
in
range
(
self
.
rowNum
):
# create 10 tables, insert 10 rows for each table
tdSql
.
execute
(
"create table st%s%d using st%s tags(%d)"
%
(
curType
,
j
+
1
,
curType
,
j
+
1
))
for
j
in
range
(
self
.
rowNum
):
for
k
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
tdSql
.
execute
(
"insert into st%s%d values(%d, %d)"
%
(
curType
,
j
+
1
,
self
.
ts
+
k
+
1
,
j
*
10
+
k
+
1
))
"create table st%s%d using st%s tags(%d)"
%
(
curType
,
j
+
1
,
curType
,
j
+
1
))
tdSql
.
error
(
"insert into st%s10 values(%d, %d)"
%
(
curType
,
self
.
ts
+
11
,
pow
(
2
,
self
.
powers
[
i
])))
for
k
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
"insert into st%s10 values(%d, %d)"
%
(
curType
,
self
.
ts
+
12
,
pow
(
2
,
self
.
powers
[
i
])
-
1
))
tdSql
.
execute
(
tdSql
.
error
(
"insert into st%s10 values(%d, %d)"
%
(
curType
,
self
.
ts
+
13
,
pow
(
-
2
,
self
.
powers
[
i
])))
"insert into st%s%d values(%d, %d)"
%
tdSql
.
execute
(
"insert into st%s10 values(%d, %d)"
%
(
curType
,
self
.
ts
+
14
,
pow
(
-
2
,
self
.
powers
[
i
])
+
1
))
(
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
])))
tdSql
.
execute
(
"insert into st%s10 values(%d, %d)"
%
(
curType
,
self
.
ts
+
12
,
pow
(
2
,
self
.
powers
[
i
])
-
1
))
tdSql
.
error
(
"insert into st%s10 values(%d, %d)"
%
(
curType
,
self
.
ts
+
13
,
pow
(
-
2
,
self
.
powers
[
i
])))
tdSql
.
execute
(
"insert into st%s10 values(%d, %d)"
%
(
curType
,
self
.
ts
+
14
,
pow
(
-
2
,
self
.
powers
[
i
])
+
1
))
# > for int type on column
# > for int type on column
tdSql
.
query
(
"select * from st%s where num > 50"
%
curType
)
tdSql
.
query
(
"select * from st%s where num > 50"
%
curType
)
...
@@ -104,10 +114,12 @@ class TDTestCase:
...
@@ -104,10 +114,12 @@ class TDTestCase:
# != for int type on tag
# != for int type on tag
tdSql
.
query
(
"select * from st%s where id != 5"
%
curType
)
tdSql
.
query
(
"select * from st%s where id != 5"
%
curType
)
tdSql
.
checkRows
(
92
)
tdSql
.
checkRows
(
92
)
print
(
"======= Verify filter for %s type finished ========="
%
curType
)
print
(
"======= Verify filter for %s type finished ========="
%
curType
)
def
stop
(
self
):
def
stop
(
self
):
tdSql
.
close
()
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
...
...
tests/pytest/query/filterFloatAndDouble.py
浏览文件 @
e2505fce
...
@@ -21,28 +21,28 @@ from util.sql import *
...
@@ -21,28 +21,28 @@ from util.sql import *
class
TDTestCase
:
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
())
tdSql
.
init
(
conn
.
cursor
())
self
.
rowNum
=
10
self
.
rowNum
=
10
self
.
ts
=
1537146000000
self
.
ts
=
1537146000000
def
run
(
self
):
def
run
(
self
):
tdSql
.
prepare
()
tdSql
.
prepare
()
print
(
"======= Verify filter for float and double type ========="
)
print
(
"======= Verify filter for float and double type ========="
)
tdLog
.
debug
(
tdLog
.
debug
(
"create table st(ts timestamp, num float, speed double) tags(tagcol1 float, tagcol2 double)"
)
"create table st(ts timestamp, num float, speed double) tags(tagcol1 float, tagcol2 double)"
)
tdSql
.
execute
(
tdSql
.
execute
(
"create table st(ts timestamp, num float, speed double) tags(tagcol1 float, tagcol2 double)"
)
"create table st(ts timestamp, num float, speed double) tags(tagcol1 float, tagcol2 double)"
)
for
j
in
range
(
self
.
rowNum
):
for
j
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
tdSql
.
execute
(
"insert into st1 using st tags(1.1, 2.3) values(%d, %f, %f)"
%
(
"insert into st1 using st tags(1.1, 2.3) values(%d, %f, %f)"
%
(
self
.
ts
+
j
+
1
,
1.1
*
(
j
+
1
),
2.3
*
(
j
+
1
)))
self
.
ts
+
j
+
1
,
1.1
*
(
j
+
1
),
2.3
*
(
j
+
1
)))
# > for float type on column
# > for float type on column
tdSql
.
query
(
"select * from st where num > 5.5"
)
tdSql
.
query
(
"select * from st where num > 5.5"
)
tdSql
.
checkRows
(
5
)
tdSql
.
checkRows
(
5
)
# >= for float type on column
# >= for float type on column
tdSql
.
query
(
"select * from st where num >= 5.5"
)
tdSql
.
query
(
"select * from st where num >= 5.5"
)
tdSql
.
checkRows
(
6
)
tdSql
.
checkRows
(
6
)
...
@@ -70,11 +70,11 @@ class TDTestCase:
...
@@ -70,11 +70,11 @@ class TDTestCase:
# > for float type on tag
# > for float type on tag
tdSql
.
query
(
"select * from st where tagcol1 > 1.1"
)
tdSql
.
query
(
"select * from st where tagcol1 > 1.1"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
# >= for float type on tag
# >= for float type on tag
tdSql
.
query
(
"select * from st where tagcol1 >= 1.1"
)
tdSql
.
query
(
"select * from st where tagcol1 >= 1.1"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
# = for float type on tag
# = for float type on tag
tdSql
.
query
(
"select * from st where tagcol1 = 1.1"
)
tdSql
.
query
(
"select * from st where tagcol1 = 1.1"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
...
@@ -86,7 +86,7 @@ class TDTestCase:
...
@@ -86,7 +86,7 @@ class TDTestCase:
# != for float type on tag
# != for float type on tag
tdSql
.
query
(
"select * from st where tagcol1 != 1.1"
)
tdSql
.
query
(
"select * from st where tagcol1 != 1.1"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
# <= for float type on tag
# <= for float type on tag
tdSql
.
query
(
"select * from st where tagcol1 <= 1.1"
)
tdSql
.
query
(
"select * from st where tagcol1 <= 1.1"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
...
@@ -94,11 +94,11 @@ class TDTestCase:
...
@@ -94,11 +94,11 @@ class TDTestCase:
# < for float type on tag
# < for float type on tag
tdSql
.
query
(
"select * from st where tagcol1 < 1.1"
)
tdSql
.
query
(
"select * from st where tagcol1 < 1.1"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
# > for double type on column
# > for double type on column
tdSql
.
query
(
"select * from st where speed > 11.5"
)
tdSql
.
query
(
"select * from st where speed > 11.5"
)
tdSql
.
checkRows
(
5
)
tdSql
.
checkRows
(
5
)
# >= for double type on column
# >= for double type on column
tdSql
.
query
(
"select * from st where speed >= 11.5"
)
tdSql
.
query
(
"select * from st where speed >= 11.5"
)
tdSql
.
checkRows
(
6
)
tdSql
.
checkRows
(
6
)
...
@@ -126,11 +126,11 @@ class TDTestCase:
...
@@ -126,11 +126,11 @@ class TDTestCase:
# > for double type on tag
# > for double type on tag
tdSql
.
query
(
"select * from st where tagcol2 > 2.3"
)
tdSql
.
query
(
"select * from st where tagcol2 > 2.3"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
# >= for double type on tag
# >= for double type on tag
tdSql
.
query
(
"select * from st where tagcol2 >= 2.3"
)
tdSql
.
query
(
"select * from st where tagcol2 >= 2.3"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
# = for double type on tag
# = for double type on tag
tdSql
.
query
(
"select * from st where tagcol2 = 2.3"
)
tdSql
.
query
(
"select * from st where tagcol2 = 2.3"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
...
@@ -142,7 +142,7 @@ class TDTestCase:
...
@@ -142,7 +142,7 @@ class TDTestCase:
# != for double type on tag
# != for double type on tag
tdSql
.
query
(
"select * from st where tagcol2 != 2.3"
)
tdSql
.
query
(
"select * from st where tagcol2 != 2.3"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
# <= for double type on tag
# <= for double type on tag
tdSql
.
query
(
"select * from st where tagcol2 <= 2.3"
)
tdSql
.
query
(
"select * from st where tagcol2 <= 2.3"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
...
@@ -150,7 +150,7 @@ class TDTestCase:
...
@@ -150,7 +150,7 @@ class TDTestCase:
# < for double type on tag
# < for double type on tag
tdSql
.
query
(
"select * from st where tagcol2 < 2.3"
)
tdSql
.
query
(
"select * from st where tagcol2 < 2.3"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
def
stop
(
self
):
def
stop
(
self
):
tdSql
.
close
()
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
...
...
tests/pytest/query/filterOtherTypes.py
浏览文件 @
e2505fce
...
@@ -21,33 +21,39 @@ from util.sql import *
...
@@ -21,33 +21,39 @@ from util.sql import *
class
TDTestCase
:
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
())
tdSql
.
init
(
conn
.
cursor
())
self
.
ts
=
1537146000000
self
.
ts
=
1537146000000
def
run
(
self
):
def
run
(
self
):
tdSql
.
prepare
()
tdSql
.
prepare
()
print
(
"======= Verify filter for bool, nchar and binary type ========="
)
print
(
"======= Verify filter for bool, nchar and binary type ========="
)
tdLog
.
debug
(
tdLog
.
debug
(
"create table st(ts timestamp, tbcol1 bool, tbcol2 nchar(10), tbcol3 binary(20)) tags(tagcol1 bool, tagcol2 nchar(10), tagcol3 binary(10))"
)
"create table st(ts timestamp, tbcol1 bool, tbcol2 nchar(10), tbcol3 binary(20)) tags(tagcol1 bool, tagcol2 nchar(10), tagcol3 binary(10))"
)
tdSql
.
execute
(
tdSql
.
execute
(
"create table st(ts timestamp, tbcol1 bool, tbcol2 nchar(10), tbcol3 binary(20)) tags(tagcol1 bool, tagcol2 nchar(10), tagcol3 binary(10))"
)
"create table st(ts timestamp, tbcol1 bool, tbcol2 nchar(10), tbcol3 binary(20)) tags(tagcol1 bool, tagcol2 nchar(10), tagcol3 binary(10))"
)
tdSql
.
execute
(
"create table st1 using st tags(true, 'table1', '水表')"
)
tdSql
.
execute
(
"create table st1 using st tags(true, 'table1', '水表')"
)
for
i
in
range
(
1
,
6
):
for
i
in
range
(
1
,
6
):
tdSql
.
execute
(
"insert into st1 values(%d, %d, 'taosdata%d', '涛思数据%d')"
%
(
self
.
ts
+
i
,
i
%
2
,
i
,
i
))
tdSql
.
execute
(
"insert into st1 values(%d, %d, 'taosdata%d', '涛思数据%d')"
%
(
self
.
ts
+
i
,
i
%
2
,
i
,
i
))
tdSql
.
execute
(
"create table st2 using st tags(false, 'table2', '电表')"
)
tdSql
.
execute
(
"create table st2 using st tags(false, 'table2', '电表')"
)
for
i
in
range
(
6
,
11
):
for
i
in
range
(
6
,
11
):
tdSql
.
execute
(
"insert into st2 values(%d, %d, 'taosdata%d', '涛思数据%d')"
%
(
self
.
ts
+
i
,
i
%
2
,
i
,
i
))
tdSql
.
execute
(
"insert into st2 values(%d, %d, 'taosdata%d', '涛思数据%d')"
%
(
self
.
ts
+
i
,
i
%
2
,
i
,
i
))
# =============Verify stable columns====================
# =============Verify stable columns====================
# > for bool type on column
# > for bool type on column
tdSql
.
error
(
"select * from st where tbcol1 > false"
)
tdSql
.
error
(
"select * from st where tbcol1 > false"
)
# >= for bool type on column
# >= for bool type on column
tdSql
.
error
(
"select * from st where tbcol1 >= false"
)
tdSql
.
error
(
"select * from st where tbcol1 >= false"
)
# = for bool type on column
# = for bool type on column
tdSql
.
query
(
"select * from st where tbcol1 = false"
)
tdSql
.
query
(
"select * from st where tbcol1 = false"
)
...
@@ -77,18 +83,18 @@ class TDTestCase:
...
@@ -77,18 +83,18 @@ class TDTestCase:
tdSql
.
error
(
"select * from st where tbcol2 > 'taosdata'"
)
tdSql
.
error
(
"select * from st where tbcol2 > 'taosdata'"
)
# >= for nchar type on column
# >= for nchar type on column
tdSql
.
error
(
"select * from st where tbcol2 >= 'taosdata'"
)
tdSql
.
error
(
"select * from st where tbcol2 >= 'taosdata'"
)
# = for nchar type on column
# = for nchar type on column
tdSql
.
query
(
"select * from st where tbcol2 = 'taosdata1'"
)
tdSql
.
query
(
"select * from st where tbcol2 = 'taosdata1'"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
# <> for nchar type on column
# <> for nchar type on column
tdSql
.
query
(
"select * from st where tbcol2 <> 'taosdata1'"
)
tdSql
.
query
(
"select * from st where tbcol2 <> 'taosdata1'"
)
tdSql
.
checkRows
(
9
)
tdSql
.
checkRows
(
9
)
# != for nchar type on column
# != for nchar type on column
tdSql
.
query
(
"select * from st where tbcol2 != 'taosdata1'"
)
tdSql
.
query
(
"select * from st where tbcol2 != 'taosdata1'"
)
tdSql
.
checkRows
(
9
)
tdSql
.
checkRows
(
9
)
# > for nchar type on column
# > for nchar type on column
...
@@ -98,57 +104,57 @@ class TDTestCase:
...
@@ -98,57 +104,57 @@ class TDTestCase:
tdSql
.
error
(
"select * from st where tbcol2 <= 'taodata'"
)
tdSql
.
error
(
"select * from st where tbcol2 <= 'taodata'"
)
# % for nchar type on column case 1
# % for nchar type on column case 1
tdSql
.
query
(
"select * from st where tbcol2 like '%'"
)
tdSql
.
query
(
"select * from st where tbcol2 like '%'"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
# % for nchar type on column case 2
# % for nchar type on column case 2
tdSql
.
query
(
"select * from st where tbcol2 like 'a%'"
)
tdSql
.
query
(
"select * from st where tbcol2 like 'a%'"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
# % for nchar type on column case 3
# % for nchar type on column case 3
tdSql
.
query
(
"select * from st where tbcol2 like 't%_'"
)
tdSql
.
query
(
"select * from st where tbcol2 like 't%_'"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
# % for nchar type on column case 4
# % for nchar type on column case 4
tdSql
.
query
(
"select * from st where tbcol2 like '%1'"
)
tdSql
.
query
(
"select * from st where tbcol2 like '%1'"
)
# tdSql.checkRows(2)
# tdSql.checkRows(2)
# _ for nchar type on column case 1
# _ for nchar type on column case 1
tdSql
.
query
(
"select * from st where tbcol2 like '____________'"
)
tdSql
.
query
(
"select * from st where tbcol2 like '____________'"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
# _ for nchar type on column case 2
# _ for nchar type on column case 2
tdSql
.
query
(
"select * from st where tbcol2 like '__________'"
)
tdSql
.
query
(
"select * from st where tbcol2 like '__________'"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
# _ for nchar type on column case 3
# _ for nchar type on column case 3
tdSql
.
query
(
"select * from st where tbcol2 like '_________'"
)
tdSql
.
query
(
"select * from st where tbcol2 like '_________'"
)
tdSql
.
checkRows
(
9
)
tdSql
.
checkRows
(
9
)
# _ for nchar type on column case 4
# _ for nchar type on column case 4
tdSql
.
query
(
"select * from st where tbcol2 like 't________'"
)
tdSql
.
query
(
"select * from st where tbcol2 like 't________'"
)
tdSql
.
checkRows
(
9
)
tdSql
.
checkRows
(
9
)
# _ for nchar type on column case 5
# _ for nchar type on column case 5
tdSql
.
query
(
"select * from st where tbcol2 like '%________'"
)
tdSql
.
query
(
"select * from st where tbcol2 like '%________'"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
# > for binary type on column
# > for binary type on column
tdSql
.
error
(
"select * from st where tbcol3 > '涛思数据'"
)
tdSql
.
error
(
"select * from st where tbcol3 > '涛思数据'"
)
# >= for binary type on column
# >= for binary type on column
tdSql
.
error
(
"select * from st where tbcol3 >= '涛思数据'"
)
tdSql
.
error
(
"select * from st where tbcol3 >= '涛思数据'"
)
# = for binary type on column
# = for binary type on column
tdSql
.
query
(
"select * from st where tbcol3 = '涛思数据1'"
)
tdSql
.
query
(
"select * from st where tbcol3 = '涛思数据1'"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
# <> for binary type on column
# <> for binary type on column
tdSql
.
query
(
"select * from st where tbcol3 <> '涛思数据1'"
)
tdSql
.
query
(
"select * from st where tbcol3 <> '涛思数据1'"
)
tdSql
.
checkRows
(
9
)
tdSql
.
checkRows
(
9
)
# != for binary type on column
# != for binary type on column
tdSql
.
query
(
"select * from st where tbcol3 != '涛思数据1'"
)
tdSql
.
query
(
"select * from st where tbcol3 != '涛思数据1'"
)
tdSql
.
checkRows
(
9
)
tdSql
.
checkRows
(
9
)
# > for binary type on column
# > for binary type on column
...
@@ -158,39 +164,39 @@ class TDTestCase:
...
@@ -158,39 +164,39 @@ class TDTestCase:
tdSql
.
error
(
"select * from st where tbcol3 <= '涛思数据'"
)
tdSql
.
error
(
"select * from st where tbcol3 <= '涛思数据'"
)
# % for binary type on column case 1
# % for binary type on column case 1
tdSql
.
query
(
"select * from st where tbcol3 like '%'"
)
tdSql
.
query
(
"select * from st where tbcol3 like '%'"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
# % for binary type on column case 2
# % for binary type on column case 2
tdSql
.
query
(
"select * from st where tbcol3 like '陶%'"
)
tdSql
.
query
(
"select * from st where tbcol3 like '陶%'"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
# % for binary type on column case 3
# % for binary type on column case 3
tdSql
.
query
(
"select * from st where tbcol3 like '涛%_'"
)
tdSql
.
query
(
"select * from st where tbcol3 like '涛%_'"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
# % for binary type on column case 4
# % for binary type on column case 4
tdSql
.
query
(
"select * from st where tbcol3 like '%1'"
)
tdSql
.
query
(
"select * from st where tbcol3 like '%1'"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
# _ for binary type on column case 1
# _ for binary type on column case 1
tdSql
.
query
(
"select * from st where tbcol3 like '_______'"
)
tdSql
.
query
(
"select * from st where tbcol3 like '_______'"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
# _ for binary type on column case 2
# _ for binary type on column case 2
tdSql
.
query
(
"select * from st where tbcol3 like '______'"
)
tdSql
.
query
(
"select * from st where tbcol3 like '______'"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
# _ for binary type on column case 2
# _ for binary type on column case 2
tdSql
.
query
(
"select * from st where tbcol3 like '_____'"
)
tdSql
.
query
(
"select * from st where tbcol3 like '_____'"
)
tdSql
.
checkRows
(
9
)
tdSql
.
checkRows
(
9
)
# _ for binary type on column case 3
# _ for binary type on column case 3
tdSql
.
query
(
"select * from st where tbcol3 like '____'"
)
tdSql
.
query
(
"select * from st where tbcol3 like '____'"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
# _ for binary type on column case 4
# _ for binary type on column case 4
tdSql
.
query
(
"select * from st where tbcol3 like 't____'"
)
tdSql
.
query
(
"select * from st where tbcol3 like 't____'"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
# =============Verify stable tags====================
# =============Verify stable tags====================
...
@@ -198,7 +204,7 @@ class TDTestCase:
...
@@ -198,7 +204,7 @@ class TDTestCase:
tdSql
.
error
(
"select * from st where tagcol1 > false"
)
tdSql
.
error
(
"select * from st where tagcol1 > false"
)
# >= for bool type on tag
# >= for bool type on tag
tdSql
.
error
(
"select * from st where tagcol1 >= false"
)
tdSql
.
error
(
"select * from st where tagcol1 >= false"
)
# = for bool type on tag
# = for bool type on tag
tdSql
.
query
(
"select * from st where tagcol1 = false"
)
tdSql
.
query
(
"select * from st where tagcol1 = false"
)
...
@@ -228,18 +234,18 @@ class TDTestCase:
...
@@ -228,18 +234,18 @@ class TDTestCase:
tdSql
.
error
(
"select * from st where tagcol2 > 'table'"
)
tdSql
.
error
(
"select * from st where tagcol2 > 'table'"
)
# >= for nchar type on tag
# >= for nchar type on tag
tdSql
.
error
(
"select * from st where tagcol2 >= 'table'"
)
tdSql
.
error
(
"select * from st where tagcol2 >= 'table'"
)
# = for nchar type on tag
# = for nchar type on tag
tdSql
.
query
(
"select * from st where tagcol2 = 'table1'"
)
tdSql
.
query
(
"select * from st where tagcol2 = 'table1'"
)
tdSql
.
checkRows
(
5
)
tdSql
.
checkRows
(
5
)
# <> for nchar type on tag
# <> for nchar type on tag
tdSql
.
query
(
"select * from st where tagcol2 <> 'table1'"
)
tdSql
.
query
(
"select * from st where tagcol2 <> 'table1'"
)
tdSql
.
checkRows
(
5
)
tdSql
.
checkRows
(
5
)
# != for nchar type on tag
# != for nchar type on tag
tdSql
.
query
(
"select * from st where tagcol2 != 'table'"
)
tdSql
.
query
(
"select * from st where tagcol2 != 'table'"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
# > for nchar type on tag
# > for nchar type on tag
...
@@ -249,57 +255,57 @@ class TDTestCase:
...
@@ -249,57 +255,57 @@ class TDTestCase:
tdSql
.
error
(
"select * from st where tagcol2 <= 'table'"
)
tdSql
.
error
(
"select * from st where tagcol2 <= 'table'"
)
# % for nchar type on tag case 1
# % for nchar type on tag case 1
tdSql
.
query
(
"select * from st where tagcol2 like '%'"
)
tdSql
.
query
(
"select * from st where tagcol2 like '%'"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
# % for nchar type on tag case 2
# % for nchar type on tag case 2
tdSql
.
query
(
"select * from st where tagcol2 like 'a%'"
)
tdSql
.
query
(
"select * from st where tagcol2 like 'a%'"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
# % for nchar type on tag case 3
# % for nchar type on tag case 3
tdSql
.
query
(
"select * from st where tagcol2 like 't%_'"
)
tdSql
.
query
(
"select * from st where tagcol2 like 't%_'"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
# % for nchar type on tag case 4
# % for nchar type on tag case 4
tdSql
.
query
(
"select * from st where tagcol2 like '%1'"
)
tdSql
.
query
(
"select * from st where tagcol2 like '%1'"
)
tdSql
.
checkRows
(
5
)
tdSql
.
checkRows
(
5
)
# _ for nchar type on tag case 1
# _ for nchar type on tag case 1
tdSql
.
query
(
"select * from st where tagcol2 like '_______'"
)
tdSql
.
query
(
"select * from st where tagcol2 like '_______'"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
# _ for nchar type on tag case 2
# _ for nchar type on tag case 2
tdSql
.
query
(
"select * from st where tagcol2 like '______'"
)
tdSql
.
query
(
"select * from st where tagcol2 like '______'"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
# _ for nchar type on tag case 3
# _ for nchar type on tag case 3
tdSql
.
query
(
"select * from st where tagcol2 like 't_____'"
)
tdSql
.
query
(
"select * from st where tagcol2 like 't_____'"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
# _ for nchar type on tag case 4
# _ for nchar type on tag case 4
tdSql
.
query
(
"select * from st where tagcol2 like 's________'"
)
tdSql
.
query
(
"select * from st where tagcol2 like 's________'"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
# _ for nchar type on tag case 5
# _ for nchar type on tag case 5
tdSql
.
query
(
"select * from st where tagcol2 like '%__'"
)
tdSql
.
query
(
"select * from st where tagcol2 like '%__'"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
# > for binary type on tag
# > for binary type on tag
tdSql
.
error
(
"select * from st where tagcol3 > '表'"
)
tdSql
.
error
(
"select * from st where tagcol3 > '表'"
)
# >= for binary type on tag
# >= for binary type on tag
tdSql
.
error
(
"select * from st where tagcol3 >= '表'"
)
tdSql
.
error
(
"select * from st where tagcol3 >= '表'"
)
# = for binary type on tag
# = for binary type on tag
tdSql
.
query
(
"select * from st where tagcol3 = '水表'"
)
tdSql
.
query
(
"select * from st where tagcol3 = '水表'"
)
tdSql
.
checkRows
(
5
)
tdSql
.
checkRows
(
5
)
# <> for binary type on tag
# <> for binary type on tag
tdSql
.
query
(
"select * from st where tagcol3 <> '水表'"
)
tdSql
.
query
(
"select * from st where tagcol3 <> '水表'"
)
tdSql
.
checkRows
(
5
)
tdSql
.
checkRows
(
5
)
# != for binary type on tag
# != for binary type on tag
tdSql
.
query
(
"select * from st where tagcol3 != '水表'"
)
tdSql
.
query
(
"select * from st where tagcol3 != '水表'"
)
tdSql
.
checkRows
(
5
)
tdSql
.
checkRows
(
5
)
# > for binary type on tag
# > for binary type on tag
...
@@ -309,54 +315,53 @@ class TDTestCase:
...
@@ -309,54 +315,53 @@ class TDTestCase:
tdSql
.
error
(
"select * from st where tagcol3 <= '水表'"
)
tdSql
.
error
(
"select * from st where tagcol3 <= '水表'"
)
# % for binary type on tag case 1
# % for binary type on tag case 1
tdSql
.
query
(
"select * from st where tagcol3 like '%'"
)
tdSql
.
query
(
"select * from st where tagcol3 like '%'"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
# % for binary type on tag case 2
# % for binary type on tag case 2
tdSql
.
query
(
"select * from st where tagcol3 like '水%'"
)
tdSql
.
query
(
"select * from st where tagcol3 like '水%'"
)
tdSql
.
checkRows
(
5
)
tdSql
.
checkRows
(
5
)
# % for binary type on tag case 3
# % for binary type on tag case 3
tdSql
.
query
(
"select * from st where tagcol3 like '数%_'"
)
tdSql
.
query
(
"select * from st where tagcol3 like '数%_'"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
# % for binary type on tag case 4
# % for binary type on tag case 4
tdSql
.
query
(
"select * from st where tagcol3 like '%表'"
)
tdSql
.
query
(
"select * from st where tagcol3 like '%表'"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
# % for binary type on tag case 5
# % for binary type on tag case 5
tdSql
.
query
(
"select * from st where tagcol3 like '%据'"
)
tdSql
.
query
(
"select * from st where tagcol3 like '%据'"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
# _ for binary type on tag case 1
# _ for binary type on tag case 1
tdSql
.
query
(
"select * from st where tagcol3 like '__'"
)
tdSql
.
query
(
"select * from st where tagcol3 like '__'"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
# _ for binary type on tag case 2
# _ for binary type on tag case 2
tdSql
.
query
(
"select * from st where tagcol3 like '水_'"
)
tdSql
.
query
(
"select * from st where tagcol3 like '水_'"
)
tdSql
.
checkRows
(
5
)
tdSql
.
checkRows
(
5
)
# _ for binary type on tag case 2
# _ for binary type on tag case 2
tdSql
.
query
(
"select * from st where tagcol3 like '_表'"
)
tdSql
.
query
(
"select * from st where tagcol3 like '_表'"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
# _ for binary type on tag case 3
# _ for binary type on tag case 3
tdSql
.
query
(
"select * from st where tagcol3 like '___'"
)
tdSql
.
query
(
"select * from st where tagcol3 like '___'"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
# _ for binary type on tag case 4
# _ for binary type on tag case 4
tdSql
.
query
(
"select * from st where tagcol3 like '数_'"
)
tdSql
.
query
(
"select * from st where tagcol3 like '数_'"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
# _ for binary type on tag case 5
# _ for binary type on tag case 5
tdSql
.
query
(
"select * from st where tagcol3 like '_据'"
)
tdSql
.
query
(
"select * from st where tagcol3 like '_据'"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
def
stop
(
self
):
def
stop
(
self
):
tdSql
.
close
()
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/query/querySort.py
浏览文件 @
e2505fce
...
@@ -21,56 +21,60 @@ from util.sql import *
...
@@ -21,56 +21,60 @@ from util.sql import *
class
TDTestCase
:
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
())
tdSql
.
init
(
conn
.
cursor
())
self
.
rowNum
=
10
self
.
rowNum
=
10
self
.
ts
=
1537146000000
self
.
ts
=
1537146000000
def
run
(
self
):
def
run
(
self
):
tdSql
.
prepare
()
tdSql
.
prepare
()
print
(
"======= step 1: create table and insert data ========="
)
print
(
"======= step 1: create table and insert data ========="
)
tdLog
.
debug
(
tdLog
.
debug
(
''' create table st(ts timestamp, tbcol1 tinyint, tbcol2 smallint, tbcol3 int, tbcol4 bigint, tbcol5 float, tbcol6 double,
''' create table st(ts timestamp, tbcol1 tinyint, tbcol2 smallint, tbcol3 int, tbcol4 bigint, tbcol5 float, tbcol6 double,
tbcol7 bool, tbcol8 nchar(20), tbcol9 binary(20)) tags(tagcol1 tinyint, tagcol2 smallint, tagcol3 int, tagcol4 bigint, tagcol5 float,
tbcol7 bool, tbcol8 nchar(20), tbcol9 binary(20)) tags(tagcol1 tinyint, tagcol2 smallint, tagcol3 int, tagcol4 bigint, tagcol5 float,
tagcol6 double, tagcol7 bool, tagcol8 nchar(20), tagcol9 binary(20))'''
)
tagcol6 double, tagcol7 bool, tagcol8 nchar(20), tagcol9 binary(20))'''
)
tdSql
.
execute
(
tdSql
.
execute
(
''' create table st(ts timestamp, tbcol1 tinyint, tbcol2 smallint, tbcol3 int, tbcol4 bigint, tbcol5 float, tbcol6 double,
''' create table st(ts timestamp, tbcol1 tinyint, tbcol2 smallint, tbcol3 int, tbcol4 bigint, tbcol5 float, tbcol6 double,
tbcol7 bool, tbcol8 nchar(20), tbcol9 binary(20)) tags(tagcol1 tinyint, tagcol2 smallint, tagcol3 int, tagcol4 bigint, tagcol5 float,
tbcol7 bool, tbcol8 nchar(20), tbcol9 binary(20)) tags(tagcol1 tinyint, tagcol2 smallint, tagcol3 int, tagcol4 bigint, tagcol5 float,
tagcol6 double, tagcol7 bool, tagcol8 nchar(20), tagcol9 binary(20))'''
)
tagcol6 double, tagcol7 bool, tagcol8 nchar(20), tagcol9 binary(20))'''
)
for
i
in
range
(
self
.
rowNum
):
for
i
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
"create table st%d using st tags(%d, %d, %d, %d, %f, %f, %d, 'tag%d', '标签%d')"
%
(
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
,
1.1
*
(
i
+
1
),
tdSql
.
execute
(
"create table st%d using st tags(%d, %d, %d, %d, %f, %f, %d, 'tag%d', '标签%d')"
%
(
1.23
*
(
i
+
1
),
(
i
+
1
)
%
2
,
i
+
1
,
i
+
1
))
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
,
1.1
*
(
i
+
1
),
1.23
*
(
i
+
1
),
(
i
+
1
)
%
2
,
i
+
1
,
i
+
1
))
for
j
in
range
(
self
.
rowNum
):
for
j
in
range
(
self
.
rowNum
):
tdSql
.
execute
(
"insert into st%d values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
%
(
i
+
1
,
self
.
ts
+
10
*
(
i
+
1
)
+
j
+
1
,
tdSql
.
execute
(
"insert into st%d values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')"
%
(
j
+
1
,
j
+
1
,
j
+
1
,
j
+
1
,
1.1
*
(
j
+
1
),
1.23
*
(
j
+
1
),
(
j
+
1
)
%
2
,
j
+
1
,
j
+
1
))
i
+
1
,
self
.
ts
+
10
*
(
i
+
1
)
+
j
+
1
,
j
+
1
,
j
+
1
,
j
+
1
,
j
+
1
,
1.1
*
(
j
+
1
),
1.23
*
(
j
+
1
),
(
j
+
1
)
%
2
,
j
+
1
,
j
+
1
))
print
(
"======= step 2: verify order for each column ========="
)
print
(
"======= step 2: verify order for each column ========="
)
# sort for timestamp in asc order
# sort for timestamp in asc order
tdSql
.
query
(
"select * from st order by ts asc"
)
tdSql
.
query
(
"select * from st order by ts asc"
)
tdSql
.
checkColumnSorted
(
0
,
"asc"
)
tdSql
.
checkColumnSorted
(
0
,
"asc"
)
# sort for timestamp in desc order
# sort for timestamp in desc order
tdSql
.
query
(
"select * from st order by ts desc"
)
tdSql
.
query
(
"select * from st order by ts desc"
)
tdSql
.
checkColumnSorted
(
0
,
"desc"
)
tdSql
.
checkColumnSorted
(
0
,
"desc"
)
for
i
in
range
(
1
,
10
):
tdSql
.
error
(
"select * from st order by tbcol%d"
%
i
)
tdSql
.
error
(
"select * from st order by tbcol%d asc"
%
i
)
tdSql
.
error
(
"select * from st order by tbcol%d desc"
%
i
)
for
i
in
range
(
1
,
10
):
tdSql
.
query
(
tdSql
.
error
(
"select * from st order by tbcol%d"
%
i
)
"select avg(tbcol1) from st group by tagcol%d order by tagcol%d"
%
tdSql
.
error
(
"select * from st order by tbcol%d asc"
%
i
)
(
i
,
i
))
tdSql
.
error
(
"select * from st order by tbcol%d desc"
%
i
)
tdSql
.
query
(
"select avg(tbcol1) from st group by tagcol%d order by tagcol%d"
%
(
i
,
i
))
tdSql
.
checkColumnSorted
(
1
,
""
)
tdSql
.
checkColumnSorted
(
1
,
""
)
tdSql
.
query
(
"select avg(tbcol1) from st group by tagcol%d order by tagcol%d asc"
%
(
i
,
i
))
tdSql
.
query
(
"select avg(tbcol1) from st group by tagcol%d order by tagcol%d asc"
%
(
i
,
i
))
tdSql
.
checkColumnSorted
(
1
,
"asc"
)
tdSql
.
checkColumnSorted
(
1
,
"asc"
)
tdSql
.
query
(
"select avg(tbcol1) from st group by tagcol%d order by tagcol%d desc"
%
(
i
,
i
))
tdSql
.
query
(
tdSql
.
checkColumnSorted
(
1
,
"desc"
)
"select avg(tbcol1) from st group by tagcol%d order by tagcol%d desc"
%
(
i
,
i
))
tdSql
.
checkColumnSorted
(
1
,
"desc"
)
def
stop
(
self
):
def
stop
(
self
):
tdSql
.
close
()
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
...
...
tests/pytest/random-test/random-test.py
浏览文件 @
e2505fce
...
@@ -97,6 +97,8 @@ class Test:
...
@@ -97,6 +97,8 @@ class Test:
"create table %s using %s tags (1, '表1')"
%
"create table %s using %s tags (1, '表1')"
%
(
current_tb
,
self
.
last_stb
))
(
current_tb
,
self
.
last_stb
))
self
.
last_tb
=
current_tb
self
.
last_tb
=
current_tb
self
.
written
=
0
tdSql
.
execute
(
tdSql
.
execute
(
"insert into %s values (now, 27, '我是nchar字符串')"
%
"insert into %s values (now, 27, '我是nchar字符串')"
%
self
.
last_tb
)
self
.
last_tb
)
...
...
tests/pytest/regressiontest.sh
浏览文件 @
e2505fce
...
@@ -48,7 +48,7 @@ python3 ./test.py -f tag_lite/float.py
...
@@ -48,7 +48,7 @@ python3 ./test.py -f tag_lite/float.py
python3 ./test.py
-f
tag_lite/int_binary.py
python3 ./test.py
-f
tag_lite/int_binary.py
python3 ./test.py
-f
tag_lite/int_float.py
python3 ./test.py
-f
tag_lite/int_float.py
python3 ./test.py
-f
tag_lite/int.py
python3 ./test.py
-f
tag_lite/int.py
#
python3 ./test.py -f tag_lite/set.py
python3 ./test.py
-f
tag_lite/set.py
python3 ./test.py
-f
tag_lite/smallint.py
python3 ./test.py
-f
tag_lite/smallint.py
python3 ./test.py
-f
tag_lite/tinyint.py
python3 ./test.py
-f
tag_lite/tinyint.py
...
...
tests/pytest/table/tablename-boundary.py
浏览文件 @
e2505fce
...
@@ -18,7 +18,10 @@ class TDTestCase:
...
@@ -18,7 +18,10 @@ class TDTestCase:
tdSql
.
prepare
()
tdSql
.
prepare
()
getTableNameLen
=
"grep -w '#define TSDB_TABLE_NAME_LEN' ../../src/inc/taosdef.h|awk '{print $3}'"
getTableNameLen
=
"grep -w '#define TSDB_TABLE_NAME_LEN' ../../src/inc/taosdef.h|awk '{print $3}'"
tableNameMaxLen
=
int
(
subprocess
.
check_output
(
getTableNameLen
,
shell
=
True
))
-
1
tableNameMaxLen
=
int
(
subprocess
.
check_output
(
getTableNameLen
,
shell
=
True
))
-
1
tdLog
.
info
(
"table name max length is %d"
%
tableNameMaxLen
)
tdLog
.
info
(
"table name max length is %d"
%
tableNameMaxLen
)
chars
=
string
.
ascii_uppercase
+
string
.
ascii_lowercase
chars
=
string
.
ascii_uppercase
+
string
.
ascii_lowercase
tb_name
=
''
.
join
(
random
.
choices
(
chars
,
k
=
tableNameMaxLen
))
tb_name
=
''
.
join
(
random
.
choices
(
chars
,
k
=
tableNameMaxLen
))
...
...
tests/pytest/tag_lite/change.py
浏览文件 @
e2505fce
...
@@ -93,9 +93,13 @@ class TDTestCase:
...
@@ -93,9 +93,13 @@ class TDTestCase:
tdSql
.
error
(
"alter table ta_ch_mt2 change tag tgcol1 tgcol2"
)
tdSql
.
error
(
"alter table ta_ch_mt2 change tag tgcol1 tgcol2"
)
# TSIM: return -1
# TSIM: return -1
# TSIM: step22:
# TSIM: step22:
# TSIM: sql alter table $mt change tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20
# TSIM: sql alter table $mt change tag tgcol1
tdLog
.
info
(
"alter table ta_ch_mt2 change tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20"
)
# xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x
tdSql
.
error
(
"alter table ta_ch_mt2 change tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20"
)
# step20
tdLog
.
info
(
"alter table ta_ch_mt2 change tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20"
)
tdSql
.
error
(
"alter table ta_ch_mt2 change tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20"
)
# TSIM: return -1
# TSIM: return -1
# TSIM: step20:
# TSIM: step20:
# TSIM:
# TSIM:
...
@@ -267,8 +271,10 @@ class TDTestCase:
...
@@ -267,8 +271,10 @@ class TDTestCase:
tdSql
.
execute
(
tdSql
.
execute
(
'create table ta_ch_mt6 (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20))'
)
'create table ta_ch_mt6 (ts timestamp, tbcol int) TAGS(tgcol1 binary(10), tgcol2 int, tgcol3 smallint, tgcol4 binary(11), tgcol5 double, tgcol6 binary(20))'
)
# TSIM: sql create table $tb using $mt tags( '1', 2, 3, '4', 5, '6' )
# TSIM: sql create table $tb using $mt tags( '1', 2, 3, '4', 5, '6' )
tdLog
.
info
(
"create table tb6 using ta_ch_mt6 tags( '1', 2, 3, '4', 5, '6' )"
)
tdLog
.
info
(
tdSql
.
execute
(
"create table tb6 using ta_ch_mt6 tags( '1', 2, 3, '4', 5, '6' )"
)
"create table tb6 using ta_ch_mt6 tags( '1', 2, 3, '4', 5, '6' )"
)
tdSql
.
execute
(
"create table tb6 using ta_ch_mt6 tags( '1', 2, 3, '4', 5, '6' )"
)
# TSIM: sql insert into $tb values(now, 1)
# TSIM: sql insert into $tb values(now, 1)
tdLog
.
info
(
"insert into tb6 values(now, 1)"
)
tdLog
.
info
(
"insert into tb6 values(now, 1)"
)
tdSql
.
execute
(
"insert into tb6 values(now, 1)"
)
tdSql
.
execute
(
"insert into tb6 values(now, 1)"
)
...
...
tests/pytest/tag_lite/delete.py
浏览文件 @
e2505fce
此差异已折叠。
点击以展开。
tests/pytest/tag_lite/set.py
浏览文件 @
e2505fce
...
@@ -178,13 +178,13 @@ class TDTestCase:
...
@@ -178,13 +178,13 @@ class TDTestCase:
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data23 != false then
# TSIM: if $data23 != false then
tdLog
.
info
(
'tdSql.checkData(2, 3,
false
)'
)
tdLog
.
info
(
'tdSql.checkData(2, 3,
"TAG"
)'
)
tdSql
.
checkData
(
2
,
3
,
false
)
tdSql
.
checkData
(
2
,
3
,
"TAG"
)
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data33 != 4 then
# TSIM: if $data33 != 4 then
tdLog
.
info
(
'tdSql.checkData(3, 3,
4
)'
)
tdLog
.
info
(
'tdSql.checkData(3, 3,
"TAG"
)'
)
tdSql
.
checkData
(
3
,
3
,
4
)
tdSql
.
checkData
(
3
,
3
,
"TAG"
)
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM:
# TSIM:
...
@@ -458,8 +458,8 @@ class TDTestCase:
...
@@ -458,8 +458,8 @@ class TDTestCase:
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data03 != 2 then
# TSIM: if $data03 != 2 then
tdLog
.
info
(
'tdSql.checkData(0, 3,
2
)'
)
tdLog
.
info
(
'tdSql.checkData(0, 3,
"2"
)'
)
tdSql
.
checkData
(
0
,
3
,
2
)
tdSql
.
checkData
(
0
,
3
,
"2"
)
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM:
# TSIM:
...
@@ -495,8 +495,8 @@ class TDTestCase:
...
@@ -495,8 +495,8 @@ class TDTestCase:
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data03 != 4 then
# TSIM: if $data03 != 4 then
tdLog
.
info
(
'tdSql.checkData(0, 3,
4
)'
)
tdLog
.
info
(
'tdSql.checkData(0, 3,
"4"
)'
)
tdSql
.
checkData
(
0
,
3
,
4
)
tdSql
.
checkData
(
0
,
3
,
"4"
)
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM:
# TSIM:
...
@@ -521,8 +521,8 @@ class TDTestCase:
...
@@ -521,8 +521,8 @@ class TDTestCase:
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data03 != 4 then
# TSIM: if $data03 != 4 then
tdLog
.
info
(
'tdSql.checkData(0, 3,
4
)'
)
tdLog
.
info
(
'tdSql.checkData(0, 3,
"4"
)'
)
tdSql
.
checkData
(
0
,
3
,
4
)
tdSql
.
checkData
(
0
,
3
,
"4"
)
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM:
# TSIM:
...
@@ -567,8 +567,8 @@ class TDTestCase:
...
@@ -567,8 +567,8 @@ class TDTestCase:
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data02 != 1 then
# TSIM: if $data02 != 1 then
tdLog
.
info
(
'tdSql.checkData(0, 2,
1
)'
)
tdLog
.
info
(
'tdSql.checkData(0, 2,
"1"
)'
)
tdSql
.
checkData
(
0
,
2
,
1
)
tdSql
.
checkData
(
0
,
2
,
"1"
)
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data03 != 2 then
# TSIM: if $data03 != 2 then
...
@@ -582,8 +582,8 @@ class TDTestCase:
...
@@ -582,8 +582,8 @@ class TDTestCase:
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data05 != 4 then
# TSIM: if $data05 != 4 then
tdLog
.
info
(
'tdSql.checkData(0, 5,
4
)'
)
tdLog
.
info
(
'tdSql.checkData(0, 5,
"4"
)'
)
tdSql
.
checkData
(
0
,
5
,
4
)
tdSql
.
checkData
(
0
,
5
,
"4"
)
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data06 != 5.000000000 then
# TSIM: if $data06 != 5.000000000 then
...
@@ -592,8 +592,8 @@ class TDTestCase:
...
@@ -592,8 +592,8 @@ class TDTestCase:
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data07 != 6 then
# TSIM: if $data07 != 6 then
tdLog
.
info
(
'tdSql.checkData(0, 7,
6
)'
)
tdLog
.
info
(
'tdSql.checkData(0, 7,
"6"
)'
)
tdSql
.
checkData
(
0
,
7
,
6
)
tdSql
.
checkData
(
0
,
7
,
"6"
)
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM:
# TSIM:
...
@@ -636,8 +636,8 @@ class TDTestCase:
...
@@ -636,8 +636,8 @@ class TDTestCase:
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data02 != 7 then
# TSIM: if $data02 != 7 then
tdLog
.
info
(
'tdSql.checkData(0, 2,
7
)'
)
tdLog
.
info
(
'tdSql.checkData(0, 2,
"7"
)'
)
tdSql
.
checkData
(
0
,
2
,
7
)
tdSql
.
checkData
(
0
,
2
,
"7"
)
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data03 != 8 then
# TSIM: if $data03 != 8 then
...
@@ -646,8 +646,8 @@ class TDTestCase:
...
@@ -646,8 +646,8 @@ class TDTestCase:
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data04 != 9 then
# TSIM: if $data04 != 9 then
tdLog
.
info
(
'tdSql.checkData(0, 4,
9
)'
)
tdLog
.
info
(
'tdSql.checkData(0, 4,
"9"
)'
)
tdSql
.
checkData
(
0
,
4
,
9
)
tdSql
.
checkData
(
0
,
4
,
"9"
)
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data05 != 10.000000000 then
# TSIM: if $data05 != 10.000000000 then
...
@@ -656,13 +656,17 @@ class TDTestCase:
...
@@ -656,13 +656,17 @@ class TDTestCase:
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data06 != 11 then
# TSIM: if $data06 != 11 then
tdLog
.
info
(
'tdSql.checkData(0, 6,
11
)'
)
tdLog
.
info
(
'tdSql.checkData(0, 6,
"11"
)'
)
tdSql
.
checkData
(
0
,
6
,
11
)
tdSql
.
checkData
(
0
,
6
,
"11"
)
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data07 != NULL then
# TSIM: if $data07 != NULL then
tdLog
.
info
(
'tdSql.checkData(0, 7, NULL)'
)
tdLog
.
info
(
'tdSql.checkData(0, 7, NULL)'
)
tdSql
.
checkData
(
0
,
7
,
None
)
try
:
tdSql
.
checkData
(
0
,
7
,
None
)
except
Exception
as
e
:
tdLog
.
info
(
repr
(
e
))
tdLog
.
info
(
"out of range"
)
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM:
# TSIM:
...
@@ -682,8 +686,8 @@ class TDTestCase:
...
@@ -682,8 +686,8 @@ class TDTestCase:
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data02 != 7 then
# TSIM: if $data02 != 7 then
tdLog
.
info
(
'tdSql.checkData(0, 2,
7
)'
)
tdLog
.
info
(
'tdSql.checkData(0, 2,
"7"
)'
)
tdSql
.
checkData
(
0
,
2
,
7
)
tdSql
.
checkData
(
0
,
2
,
"7"
)
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data03 != 8 then
# TSIM: if $data03 != 8 then
...
@@ -692,8 +696,8 @@ class TDTestCase:
...
@@ -692,8 +696,8 @@ class TDTestCase:
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data04 != 9 then
# TSIM: if $data04 != 9 then
tdLog
.
info
(
'tdSql.checkData(0, 4,
9
)'
)
tdLog
.
info
(
'tdSql.checkData(0, 4,
"9"
)'
)
tdSql
.
checkData
(
0
,
4
,
9
)
tdSql
.
checkData
(
0
,
4
,
"9"
)
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data05 != 10.000000000 then
# TSIM: if $data05 != 10.000000000 then
...
@@ -702,13 +706,17 @@ class TDTestCase:
...
@@ -702,13 +706,17 @@ class TDTestCase:
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data06 != 11 then
# TSIM: if $data06 != 11 then
tdLog
.
info
(
'tdSql.checkData(0, 6,
11
)'
)
tdLog
.
info
(
'tdSql.checkData(0, 6,
"11"
)'
)
tdSql
.
checkData
(
0
,
6
,
11
)
tdSql
.
checkData
(
0
,
6
,
"11"
)
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data07 != NULL then
# TSIM: if $data07 != NULL then
tdLog
.
info
(
'tdSql.checkData(0, 7, NULL)'
)
tdLog
.
info
(
'tdSql.checkData(0, 7, NULL)'
)
tdSql
.
checkData
(
0
,
7
,
None
)
try
:
tdSql
.
checkData
(
0
,
7
,
None
)
except
Exception
as
e
:
tdLog
.
info
(
repr
(
e
))
tdLog
.
info
(
"out of range"
)
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM:
# TSIM:
...
@@ -728,8 +736,8 @@ class TDTestCase:
...
@@ -728,8 +736,8 @@ class TDTestCase:
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data02 != 7 then
# TSIM: if $data02 != 7 then
tdLog
.
info
(
'tdSql.checkData(0, 2,
7
)'
)
tdLog
.
info
(
'tdSql.checkData(0, 2,
"7"
)'
)
tdSql
.
checkData
(
0
,
2
,
7
)
tdSql
.
checkData
(
0
,
2
,
"7"
)
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data03 != 8 then
# TSIM: if $data03 != 8 then
...
@@ -738,8 +746,8 @@ class TDTestCase:
...
@@ -738,8 +746,8 @@ class TDTestCase:
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data04 != 9 then
# TSIM: if $data04 != 9 then
tdLog
.
info
(
'tdSql.checkData(0, 4,
9
)'
)
tdLog
.
info
(
'tdSql.checkData(0, 4,
"9"
)'
)
tdSql
.
checkData
(
0
,
4
,
9
)
tdSql
.
checkData
(
0
,
4
,
"9"
)
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data05 != 10.000000000 then
# TSIM: if $data05 != 10.000000000 then
...
@@ -748,13 +756,17 @@ class TDTestCase:
...
@@ -748,13 +756,17 @@ class TDTestCase:
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data06 != 11 then
# TSIM: if $data06 != 11 then
tdLog
.
info
(
'tdSql.checkData(0, 6,
11
)'
)
tdLog
.
info
(
'tdSql.checkData(0, 6,
"11"
)'
)
tdSql
.
checkData
(
0
,
6
,
11
)
tdSql
.
checkData
(
0
,
6
,
"11"
)
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data07 != NULL then
# TSIM: if $data07 != NULL then
tdLog
.
info
(
'tdSql.checkData(0, 7, NULL)'
)
tdLog
.
info
(
'tdSql.checkData(0, 7, NULL)'
)
tdSql
.
checkData
(
0
,
7
,
None
)
try
:
tdSql
.
checkData
(
0
,
7
,
None
)
except
Exception
as
e
:
tdLog
.
info
(
repr
(
e
))
tdLog
.
info
(
"out of range"
)
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM:
# TSIM:
...
@@ -774,8 +786,8 @@ class TDTestCase:
...
@@ -774,8 +786,8 @@ class TDTestCase:
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data02 != 7 then
# TSIM: if $data02 != 7 then
tdLog
.
info
(
'tdSql.checkData(0, 2,
7
)'
)
tdLog
.
info
(
'tdSql.checkData(0, 2,
"7"
)'
)
tdSql
.
checkData
(
0
,
2
,
7
)
tdSql
.
checkData
(
0
,
2
,
"7"
)
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data03 != 8 then
# TSIM: if $data03 != 8 then
...
@@ -784,8 +796,8 @@ class TDTestCase:
...
@@ -784,8 +796,8 @@ class TDTestCase:
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data04 != 9 then
# TSIM: if $data04 != 9 then
tdLog
.
info
(
'tdSql.checkData(0, 4,
9
)'
)
tdLog
.
info
(
'tdSql.checkData(0, 4,
"9"
)'
)
tdSql
.
checkData
(
0
,
4
,
9
)
tdSql
.
checkData
(
0
,
4
,
"9"
)
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data05 != 10.000000000 then
# TSIM: if $data05 != 10.000000000 then
...
@@ -794,13 +806,17 @@ class TDTestCase:
...
@@ -794,13 +806,17 @@ class TDTestCase:
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data06 != 11 then
# TSIM: if $data06 != 11 then
tdLog
.
info
(
'tdSql.checkData(0, 6,
11
)'
)
tdLog
.
info
(
'tdSql.checkData(0, 6,
"11"
)'
)
tdSql
.
checkData
(
0
,
6
,
11
)
tdSql
.
checkData
(
0
,
6
,
"11"
)
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data07 != NULL then
# TSIM: if $data07 != NULL then
tdLog
.
info
(
'tdSql.checkData(0, 7, NULL)'
)
tdLog
.
info
(
'tdSql.checkData(0, 7, NULL)'
)
tdSql
.
checkData
(
0
,
7
,
None
)
try
:
tdSql
.
checkData
(
0
,
7
,
None
)
except
Exception
as
e
:
tdLog
.
info
(
repr
(
e
))
tdLog
.
info
(
"out of range"
)
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM:
# TSIM:
...
@@ -820,8 +836,8 @@ class TDTestCase:
...
@@ -820,8 +836,8 @@ class TDTestCase:
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data02 != 7 then
# TSIM: if $data02 != 7 then
tdLog
.
info
(
'tdSql.checkData(0, 2,
7
)'
)
tdLog
.
info
(
'tdSql.checkData(0, 2,
"7"
)'
)
tdSql
.
checkData
(
0
,
2
,
7
)
tdSql
.
checkData
(
0
,
2
,
"7"
)
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data03 != 8 then
# TSIM: if $data03 != 8 then
...
@@ -830,8 +846,8 @@ class TDTestCase:
...
@@ -830,8 +846,8 @@ class TDTestCase:
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data04 != 9 then
# TSIM: if $data04 != 9 then
tdLog
.
info
(
'tdSql.checkData(0, 4,
9
)'
)
tdLog
.
info
(
'tdSql.checkData(0, 4,
"9"
)'
)
tdSql
.
checkData
(
0
,
4
,
9
)
tdSql
.
checkData
(
0
,
4
,
"9"
)
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data05 != 10.000000000 then
# TSIM: if $data05 != 10.000000000 then
...
@@ -840,21 +856,25 @@ class TDTestCase:
...
@@ -840,21 +856,25 @@ class TDTestCase:
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data06 != 11 then
# TSIM: if $data06 != 11 then
tdLog
.
info
(
'tdSql.checkData(0, 6,
11
)'
)
tdLog
.
info
(
'tdSql.checkData(0, 6,
"11"
)'
)
tdSql
.
checkData
(
0
,
6
,
11
)
tdSql
.
checkData
(
0
,
6
,
"11"
)
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM: if $data07 != NULL then
# TSIM: if $data07 != NULL then
tdLog
.
info
(
'tdSql.checkData(0, 7, NULL)'
)
tdLog
.
info
(
'tdSql.checkData(0, 7, NULL)'
)
tdSql
.
checkData
(
0
,
7
,
None
)
try
:
tdSql
.
checkData
(
0
,
7
,
None
)
except
Exception
as
e
:
tdLog
.
info
(
repr
(
e
))
tdLog
.
info
(
"out of range"
)
# TSIM: return -1
# TSIM: return -1
# TSIM: endi
# TSIM: endi
# TSIM:
# TSIM:
# TSIM: print =============== clear
# TSIM: print =============== clear
tdLog
.
info
(
'=============== clear'
)
tdLog
.
info
(
'=============== clear'
)
# TSIM: sql drop database $db
# TSIM: sql drop database $db
tdLog
.
info
(
'
sql drop database $
db'
)
tdLog
.
info
(
'
drop database
db'
)
tdSql
.
execute
(
'
sql drop database $
db'
)
tdSql
.
execute
(
'
drop database
db'
)
# TSIM: sql show databases
# TSIM: sql show databases
tdLog
.
info
(
'show databases'
)
tdLog
.
info
(
'show databases'
)
tdSql
.
query
(
'show databases'
)
tdSql
.
query
(
'show databases'
)
...
...
tests/pytest/util/sql.py
浏览文件 @
e2505fce
...
@@ -205,31 +205,37 @@ class TDSql:
...
@@ -205,31 +205,37 @@ class TDSql:
if
col
<
0
:
if
col
<
0
:
tdLog
.
exit
(
tdLog
.
exit
(
"%s failed: sql:%s, col:%d is smaller than zero"
%
"%s failed: sql:%s, col:%d is smaller than zero"
%
(
callerFilename
,
self
.
sql
,
col
))
(
callerFilename
,
self
.
sql
,
col
))
if
col
>
self
.
queryCols
:
if
col
>
self
.
queryCols
:
tdLog
.
exit
(
tdLog
.
exit
(
"%s failed: sql:%s, col:%d is larger than queryCols:%d"
%
"%s failed: sql:%s, col:%d is larger than queryCols:%d"
%
(
callerFilename
,
self
.
sql
,
col
,
self
.
queryCols
))
(
callerFilename
,
self
.
sql
,
col
,
self
.
queryCols
))
matrix
=
np
.
array
(
self
.
queryResult
)
matrix
=
np
.
array
(
self
.
queryResult
)
list
=
matrix
[:,
0
]
list
=
matrix
[:,
0
]
if
order
==
""
or
order
.
upper
()
==
"ASC"
:
if
order
==
""
or
order
.
upper
()
==
"ASC"
:
if
all
(
sorted
(
list
)
==
list
):
if
all
(
sorted
(
list
)
==
list
):
tdLog
.
info
(
"sql:%s, column :%d is sorted in accending order as expected"
%
tdLog
.
info
(
"sql:%s, column :%d is sorted in accending order as expected"
%
(
self
.
sql
,
col
))
(
self
.
sql
,
col
))
else
:
else
:
tdLog
.
exit
(
"%s failed: sql:%s, col:%d is not sorted in accesnind order"
%
tdLog
.
exit
(
"%s failed: sql:%s, col:%d is not sorted in accesnind order"
%
(
callerFilename
,
self
.
sql
,
col
))
(
callerFilename
,
self
.
sql
,
col
))
elif
order
.
upper
()
==
"DESC"
:
elif
order
.
upper
()
==
"DESC"
:
if
all
(
sorted
(
list
,
reverse
=
True
)
==
list
):
if
all
(
sorted
(
list
,
reverse
=
True
)
==
list
):
tdLog
.
info
(
"sql:%s, column :%d is sorted in decending order as expected"
%
tdLog
.
info
(
"sql:%s, column :%d is sorted in decending order as expected"
%
(
self
.
sql
,
col
))
(
self
.
sql
,
col
))
else
:
else
:
tdLog
.
exit
(
"%s failed: sql:%s, col:%d is not sorted in decending order"
%
tdLog
.
exit
(
(
callerFilename
,
self
.
sql
,
col
))
"%s failed: sql:%s, col:%d is not sorted in decending order"
%
(
callerFilename
,
self
.
sql
,
col
))
else
:
else
:
tdLog
.
exit
(
"%s failed: sql:%s, the order provided for col:%d is not correct"
%
tdLog
.
exit
(
(
callerFilename
,
self
.
sql
,
col
))
"%s failed: sql:%s, the order provided for col:%d is not correct"
%
(
callerFilename
,
self
.
sql
,
col
))
tdSql
=
TDSql
()
tdSql
=
TDSql
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录