Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
028dba3c
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
028dba3c
编写于
7月 16, 2022
作者:
C
cpwu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix case
上级
acc27d46
变更
9
展开全部
隐藏空白更改
内联
并排
Showing
9 changed file
with
868 addition
and
838 deletion
+868
-838
tests/pytest/util/sql.py
tests/pytest/util/sql.py
+24
-4
tests/system-test/2-query/arccos.py
tests/system-test/2-query/arccos.py
+0
-1
tests/system-test/2-query/arcsin.py
tests/system-test/2-query/arcsin.py
+200
-201
tests/system-test/2-query/arctan.py
tests/system-test/2-query/arctan.py
+203
-204
tests/system-test/2-query/avg.py
tests/system-test/2-query/avg.py
+172
-174
tests/system-test/2-query/between.py
tests/system-test/2-query/between.py
+100
-95
tests/system-test/2-query/bottom.py
tests/system-test/2-query/bottom.py
+3
-3
tests/system-test/2-query/cast.py
tests/system-test/2-query/cast.py
+154
-150
tests/system-test/fulltest.sh
tests/system-test/fulltest.sh
+12
-6
未找到文件。
tests/pytest/util/sql.py
浏览文件 @
028dba3c
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
import
sys
import
sys
import
os
import
os
from
tabnanny
import
check
import
time
import
time
import
datetime
import
datetime
import
inspect
import
inspect
...
@@ -301,13 +302,32 @@ class TDSql:
...
@@ -301,13 +302,32 @@ class TDSql:
args
=
(
caller
.
filename
,
caller
.
lineno
,
self
.
sql
,
col_name_list
,
expect_col_name_list
)
args
=
(
caller
.
filename
,
caller
.
lineno
,
self
.
sql
,
col_name_list
,
expect_col_name_list
)
tdLog
.
exit
(
"%s(%d) failed: sql:%s, col_name_list:%s != expect_col_name_list:%s"
%
args
)
tdLog
.
exit
(
"%s(%d) failed: sql:%s, col_name_list:%s != expect_col_name_list:%s"
%
args
)
def
__check_equal
(
self
,
elm
,
expect_elm
):
if
not
type
(
elm
)
in
(
list
,
tuple
)
and
elm
==
expect_elm
:
return
True
if
type
(
elm
)
in
(
list
,
tuple
)
and
type
(
expect_elm
)
in
(
list
,
tuple
):
if
len
(
elm
)
!=
len
(
expect_elm
):
return
False
if
len
(
elm
)
==
0
:
return
True
for
i
in
range
(
len
(
elm
)):
flag
=
self
.
__check_equal
(
elm
[
i
],
expect_elm
[
i
])
if
not
flag
:
return
False
return
True
return
False
def
checkEqual
(
self
,
elm
,
expect_elm
):
def
checkEqual
(
self
,
elm
,
expect_elm
):
if
elm
==
expect_elm
:
if
elm
==
expect_elm
:
tdLog
.
info
(
"sql:%s, elm:%s == expect_elm:%s"
%
(
self
.
sql
,
elm
,
expect_elm
))
tdLog
.
info
(
"sql:%s, elm:%s == expect_elm:%s"
%
(
self
.
sql
,
elm
,
expect_elm
))
else
:
return
caller
=
inspect
.
getframeinfo
(
inspect
.
stack
()[
1
][
0
])
if
self
.
__check_equal
(
elm
,
expect_elm
):
args
=
(
caller
.
filename
,
caller
.
lineno
,
self
.
sql
,
elm
,
expect_elm
)
tdLog
.
info
(
"sql:%s, elm:%s == expect_elm:%s"
%
(
self
.
sql
,
elm
,
expect_elm
))
tdLog
.
exit
(
"%s(%d) failed: sql:%s, elm:%s != expect_elm:%s"
%
args
)
return
caller
=
inspect
.
getframeinfo
(
inspect
.
stack
()[
1
][
0
])
args
=
(
caller
.
filename
,
caller
.
lineno
,
self
.
sql
,
elm
,
expect_elm
)
tdLog
.
exit
(
"%s(%d) failed: sql:%s, elm:%s != expect_elm:%s"
%
args
)
def
checkNotEqual
(
self
,
elm
,
expect_elm
):
def
checkNotEqual
(
self
,
elm
,
expect_elm
):
if
elm
!=
expect_elm
:
if
elm
!=
expect_elm
:
...
...
tests/system-test/2-query/arccos.py
浏览文件 @
028dba3c
...
@@ -15,7 +15,6 @@ class TDTestCase:
...
@@ -15,7 +15,6 @@ class TDTestCase:
def
init
(
self
,
conn
,
powSql
):
def
init
(
self
,
conn
,
powSql
):
tdLog
.
debug
(
f
"start to excute
{
__file__
}
"
)
tdLog
.
debug
(
f
"start to excute
{
__file__
}
"
)
tdSql
.
init
(
conn
.
cursor
())
tdSql
.
init
(
conn
.
cursor
())
self
.
PI
=
3.1415926
def
prepare_datas
(
self
,
dbname
=
"db"
):
def
prepare_datas
(
self
,
dbname
=
"db"
):
tdSql
.
execute
(
tdSql
.
execute
(
...
...
tests/system-test/2-query/arcsin.py
浏览文件 @
028dba3c
此差异已折叠。
点击以展开。
tests/system-test/2-query/arctan.py
浏览文件 @
028dba3c
此差异已折叠。
点击以展开。
tests/system-test/2-query/avg.py
浏览文件 @
028dba3c
此差异已折叠。
点击以展开。
tests/system-test/2-query/between.py
浏览文件 @
028dba3c
...
@@ -13,190 +13,195 @@ class TDTestCase:
...
@@ -13,190 +13,195 @@ class TDTestCase:
tdLog
.
debug
(
f
"start to excute
{
__file__
}
"
)
tdLog
.
debug
(
f
"start to excute
{
__file__
}
"
)
tdSql
.
init
(
conn
.
cursor
())
tdSql
.
init
(
conn
.
cursor
())
def
run
(
self
):
# sourcery skip: extract-duplicate-method
def
run
(
self
):
dbname
=
"db"
stb
=
f
"
{
dbname
}
.stb1"
rows
=
10
tdSql
.
prepare
()
tdSql
.
prepare
()
tdLog
.
printNoPrefix
(
"==========step1:create table"
)
tdLog
.
printNoPrefix
(
"==========step1:create table"
)
tdSql
.
execute
(
tdSql
.
execute
(
'''create table if not exists supt
f
'''create table if not exists
{
stb
}
(ts timestamp, c1 int, c2 float, c3 bigint, c4 double, c5 smallint, c6 tinyint)
(ts timestamp, c1 int, c2 float, c3 bigint, c4 double, c5 smallint, c6 tinyint)
tags(location binary(64), type int, isused bool , family nchar(64))'''
tags(location binary(64), type int, isused bool , family nchar(64))'''
)
)
tdSql
.
execute
(
"create table t1 using supt
tags('beijing', 1, 1, 'nchar1')"
)
tdSql
.
execute
(
f
"create table
{
dbname
}
.t1 using
{
stb
}
tags('beijing', 1, 1, 'nchar1')"
)
tdSql
.
execute
(
"create table t2 using supt
tags('shanghai', 2, 0, 'nchar2')"
)
tdSql
.
execute
(
f
"create table
{
dbname
}
.t2 using
{
stb
}
tags('shanghai', 2, 0, 'nchar2')"
)
tdLog
.
printNoPrefix
(
"==========step2:insert data"
)
tdLog
.
printNoPrefix
(
"==========step2:insert data"
)
for
i
in
range
(
10
):
for
i
in
range
(
rows
):
tdSql
.
execute
(
tdSql
.
execute
(
f
"insert into t1 values (now()+
{
i
}
m,
{
32767
+
i
}
,
{
20.0
+
i
/
10
}
,
{
2
**
31
+
i
}
,
{
3.4
*
10
**
38
+
i
/
10
}
,
{
127
+
i
}
,
{
i
}
)"
f
"insert into
{
dbname
}
.
t1 values (now()+
{
i
}
m,
{
32767
+
i
}
,
{
20.0
+
i
/
10
}
,
{
2
**
31
+
i
}
,
{
3.4
*
10
**
38
+
i
/
10
}
,
{
127
+
i
}
,
{
i
}
)"
)
)
tdSql
.
execute
(
tdSql
.
execute
(
f
"insert into t2 values (now()-
{
i
}
m,
{
-
32767
-
i
}
,
{
20.0
-
i
/
10
}
,
{
-
i
-
2
**
31
}
,
{
-
i
/
10
-
3.4
*
10
**
38
}
,
{
-
127
-
i
}
,
{
-
i
}
)"
f
"insert into
{
dbname
}
.
t2 values (now()-
{
i
}
m,
{
-
32767
-
i
}
,
{
20.0
-
i
/
10
}
,
{
-
i
-
2
**
31
}
,
{
-
i
/
10
-
3.4
*
10
**
38
}
,
{
-
127
-
i
}
,
{
-
i
}
)"
)
)
tdSql
.
execute
(
tdSql
.
execute
(
f
"insert into t1 values (now()+11m,
{
2
**
31
-
1
}
,
{
pow
(
10
,
37
)
*
34
}
,
{
pow
(
2
,
63
)
-
1
}
,
{
1.7
*
10
**
308
}
, 32767, 127)"
f
"insert into
{
dbname
}
.
t1 values (now()+11m,
{
2
**
31
-
1
}
,
{
pow
(
10
,
37
)
*
34
}
,
{
pow
(
2
,
63
)
-
1
}
,
{
1.7
*
10
**
308
}
, 32767, 127)"
)
)
tdSql
.
execute
(
tdSql
.
execute
(
f
"insert into t2 values (now()-11m,
{
1
-
2
**
31
}
,
{
-
3.4
*
10
**
38
}
,
{
1
-
2
**
63
}
,
{
-
1.7
*
10
**
308
}
, -32767, -127)"
f
"insert into
{
dbname
}
.
t2 values (now()-11m,
{
1
-
2
**
31
}
,
{
-
3.4
*
10
**
38
}
,
{
1
-
2
**
63
}
,
{
-
1.7
*
10
**
308
}
, -32767, -127)"
)
)
tdSql
.
execute
(
tdSql
.
execute
(
f
"insert into t2 values (now()-12m, null ,
{
-
3.4
*
10
**
38
}
, null ,
{
-
1.7
*
10
**
308
}
, null , null)"
f
"insert into
{
dbname
}
.
t2 values (now()-12m, null ,
{
-
3.4
*
10
**
38
}
, null ,
{
-
1.7
*
10
**
308
}
, null , null)"
)
)
tdLog
.
printNoPrefix
(
"==========step3:query timestamp type"
)
tdLog
.
printNoPrefix
(
"==========step3:query timestamp type"
)
tdSql
.
query
(
"select * from
t1 where ts between now()-1m and now()+10m"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where ts between now()-1m and now()+10m"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
rows
)
tdSql
.
query
(
"select * from
t1 where ts between '2021-01-01 00:00:00.000' and '2121-01-01 00:00:00.000'"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where ts between '2021-01-01 00:00:00.000' and '2121-01-01 00:00:00.000'"
)
# tdSql.checkRows(11)
# tdSql.checkRows(11)
tdSql
.
query
(
"select * from
t1 where ts between '1969-01-01 00:00:00.000' and '1969-12-31 23:59:59.999'"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where ts between '1969-01-01 00:00:00.000' and '1969-12-31 23:59:59.999'"
)
# tdSql.checkRows(0)
# tdSql.checkRows(0)
tdSql
.
query
(
"select * from
t1 where ts between -2793600 and 31507199"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where ts between -2793600 and 31507199"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select * from
t1 where ts between 1609430400000 and 4765104000000"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where ts between 1609430400000 and 4765104000000"
)
tdSql
.
checkRows
(
1
1
)
tdSql
.
checkRows
(
rows
+
1
)
tdLog
.
printNoPrefix
(
"==========step4:query int type"
)
tdLog
.
printNoPrefix
(
"==========step4:query int type"
)
tdSql
.
query
(
"select * from
t1 where c1 between 32767 and 32776"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c1 between 32767 and 32776"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
rows
)
tdSql
.
query
(
"select * from
t1 where c1 between 32766.9 and 32776.1"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c1 between 32766.9 and 32776.1"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
rows
)
tdSql
.
query
(
"select * from
t1 where c1 between 32776 and 32767"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c1 between 32776 and 32767"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select * from
t1 where c1 between 'a' and 'e'"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c1 between 'a' and 'e'"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
# tdSql.query("select * from t1 where c1 between 0x64 and 0x69")
# tdSql.query("select * from
{dbname}.
t1 where c1 between 0x64 and 0x69")
# tdSql.checkRows(6)
# tdSql.checkRows(6)
tdSql
.
query
(
"select * from
t1 where c1 not between 100 and 106"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c1 not between 100 and 106"
)
tdSql
.
checkRows
(
1
1
)
tdSql
.
checkRows
(
rows
+
1
)
tdSql
.
query
(
f
"select * from t1 where c1 between
{
2
**
31
-
2
}
and
{
2
**
31
+
1
}
"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c1 between
{
2
**
31
-
2
}
and
{
2
**
31
+
1
}
"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
f
"select * from t2 where c1 between null and
{
1
-
2
**
31
}
"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t2 where c1 between null and
{
1
-
2
**
31
}
"
)
# tdSql.checkRows(3)
# tdSql.checkRows(3)
tdSql
.
query
(
f
"select * from t2 where c1 between
{
-
2
**
31
}
and
{
1
-
2
**
31
}
"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t2 where c1 between
{
-
2
**
31
}
and
{
1
-
2
**
31
}
"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdLog
.
printNoPrefix
(
"==========step5:query float type"
)
tdLog
.
printNoPrefix
(
"==========step5:query float type"
)
tdSql
.
query
(
"select * from
t1 where c2 between 20.0 and 21.0"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c2 between 20.0 and 21.0"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
10
)
tdSql
.
query
(
f
"select * from t1 where c2 between
{
-
3.4
*
10
**
38
-
1
}
and
{
3.4
*
10
**
38
+
1
}
"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c2 between
{
-
3.4
*
10
**
38
-
1
}
and
{
3.4
*
10
**
38
+
1
}
"
)
tdSql
.
checkRows
(
1
1
)
tdSql
.
checkRows
(
rows
+
1
)
tdSql
.
query
(
"select * from
t1 where c2 between 21.0 and 20.0"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c2 between 21.0 and 20.0"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select * from
t1 where c2 between 'DC3' and 'SYN'"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c2 between 'DC3' and 'SYN'"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select * from
t1 where c2 not between 0.1 and 0.2"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c2 not between 0.1 and 0.2"
)
tdSql
.
checkRows
(
1
1
)
tdSql
.
checkRows
(
rows
+
1
)
tdSql
.
query
(
f
"select * from t1 where c2 between
{
pow
(
10
,
38
)
*
3.4
}
and
{
pow
(
10
,
38
)
*
3.4
+
1
}
"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c2 between
{
pow
(
10
,
38
)
*
3.4
}
and
{
pow
(
10
,
38
)
*
3.4
+
1
}
"
)
# tdSql.checkRows(1)
# tdSql.checkRows(1)
tdSql
.
query
(
f
"select * from t2 where c2 between
{
-
3.4
*
10
**
38
-
1
}
and
{
-
3.4
*
10
**
38
}
"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t2 where c2 between
{
-
3.4
*
10
**
38
-
1
}
and
{
-
3.4
*
10
**
38
}
"
)
# tdSql.checkRows(2)
# tdSql.checkRows(2)
tdSql
.
query
(
f
"select * from t2 where c2 between null and
{
-
3.4
*
10
**
38
}
"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t2 where c2 between null and
{
-
3.4
*
10
**
38
}
"
)
# tdSql.checkRows(3)
# tdSql.checkRows(3)
tdLog
.
printNoPrefix
(
"==========step6:query bigint type"
)
tdLog
.
printNoPrefix
(
"==========step6:query bigint type"
)
tdSql
.
query
(
f
"select * from t1 where c3 between
{
2
**
31
}
and
{
2
**
31
+
10
}
"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c3 between
{
2
**
31
}
and
{
2
**
31
+
10
}
"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
rows
)
tdSql
.
query
(
f
"select * from t1 where c3 between
{
-
2
**
63
}
and
{
2
**
63
}
"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c3 between
{
-
2
**
63
}
and
{
2
**
63
}
"
)
tdSql
.
checkRows
(
1
1
)
tdSql
.
checkRows
(
rows
+
1
)
tdSql
.
query
(
f
"select * from t1 where c3 between
{
2
**
31
+
10
}
and
{
2
**
31
}
"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c3 between
{
2
**
31
+
10
}
and
{
2
**
31
}
"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select * from
t1 where c3 between 'a' and 'z'"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c3 between 'a' and 'z'"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select * from
t1 where c3 not between 1 and 2"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c3 not between 1 and 2"
)
# tdSql.checkRows(0)
# tdSql.checkRows(0)
tdSql
.
query
(
f
"select * from t1 where c3 between
{
2
**
63
-
2
}
and
{
2
**
63
-
1
}
"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c3 between
{
2
**
63
-
2
}
and
{
2
**
63
-
1
}
"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
f
"select * from t2 where c3 between
{
-
2
**
63
}
and
{
1
-
2
**
63
}
"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t2 where c3 between
{
-
2
**
63
}
and
{
1
-
2
**
63
}
"
)
# tdSql.checkRows(3)
# tdSql.checkRows(3)
tdSql
.
query
(
f
"select * from t2 where c3 between null and
{
1
-
2
**
63
}
"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t2 where c3 between null and
{
1
-
2
**
63
}
"
)
# tdSql.checkRows(2)
# tdSql.checkRows(2)
tdLog
.
printNoPrefix
(
"==========step7:query double type"
)
tdLog
.
printNoPrefix
(
"==========step7:query double type"
)
tdSql
.
query
(
f
"select * from t1 where c4 between
{
3.4
*
10
**
38
}
and
{
3.4
*
10
**
38
+
10
}
"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c4 between
{
3.4
*
10
**
38
}
and
{
3.4
*
10
**
38
+
10
}
"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
rows
)
tdSql
.
query
(
f
"select * from t1 where c4 between
{
1.7
*
10
**
308
+
1
}
and
{
1.7
*
10
**
308
+
2
}
"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c4 between
{
1.7
*
10
**
308
+
1
}
and
{
1.7
*
10
**
308
+
2
}
"
)
# 因为精度原因,在超出bigint边界后,数值不能进行准确的判断
# 因为精度原因,在超出bigint边界后,数值不能进行准确的判断
# tdSql.checkRows(0)
# tdSql.checkRows(0)
tdSql
.
query
(
f
"select * from t1 where c4 between
{
3.4
*
10
**
38
+
10
}
and
{
3.4
*
10
**
38
}
"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c4 between
{
3.4
*
10
**
38
+
10
}
and
{
3.4
*
10
**
38
}
"
)
# tdSql.checkRows(0)
# tdSql.checkRows(0)
tdSql
.
query
(
"select * from
t1 where c4 between 'a' and 'z'"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c4 between 'a' and 'z'"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select * from
t1 where c4 not between 1 and 2"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c4 not between 1 and 2"
)
# tdSql.checkRows(0)
# tdSql.checkRows(0)
tdSql
.
query
(
f
"select * from t1 where c4 between
{
1.7
*
10
**
308
}
and
{
1.7
*
10
**
308
+
1
}
"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c4 between
{
1.7
*
10
**
308
}
and
{
1.7
*
10
**
308
+
1
}
"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
f
"select * from t2 where c4 between
{
-
1.7
*
10
**
308
-
1
}
and
{
-
1.7
*
10
**
308
}
"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t2 where c4 between
{
-
1.7
*
10
**
308
-
1
}
and
{
-
1.7
*
10
**
308
}
"
)
# tdSql.checkRows(3)
# tdSql.checkRows(3)
tdSql
.
query
(
f
"select * from t2 where c4 between null and
{
-
1.7
*
10
**
308
}
"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t2 where c4 between null and
{
-
1.7
*
10
**
308
}
"
)
# tdSql.checkRows(3)
# tdSql.checkRows(3)
tdLog
.
printNoPrefix
(
"==========step8:query smallint type"
)
tdLog
.
printNoPrefix
(
"==========step8:query smallint type"
)
tdSql
.
query
(
"select * from
t1 where c5 between 127 and 136"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c5 between 127 and 136"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
rows
)
tdSql
.
query
(
"select * from
t1 where c5 between 126.9 and 135.9"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c5 between 126.9 and 135.9"
)
tdSql
.
checkRows
(
9
)
tdSql
.
checkRows
(
rows
-
1
)
tdSql
.
query
(
"select * from
t1 where c5 between 136 and 127"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c5 between 136 and 127"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select * from
t1 where c5 between '~' and '^'"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c5 between '~' and '^'"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select * from
t1 where c5 not between 1 and 2"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c5 not between 1 and 2"
)
# tdSql.checkRows(0)
# tdSql.checkRows(0)
tdSql
.
query
(
"select * from
t1 where c5 between 32767 and 32768"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c5 between 32767 and 32768"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select * from
t2 where c5 between -32768 and -32767"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t2 where c5 between -32768 and -32767"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select * from
t2 where c5 between null and -32767"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t2 where c5 between null and -32767"
)
# tdSql.checkRows(1)
# tdSql.checkRows(1)
tdLog
.
printNoPrefix
(
"==========step9:query tinyint type"
)
tdLog
.
printNoPrefix
(
"==========step9:query tinyint type"
)
tdSql
.
query
(
"select * from
t1 where c6 between 0 and 9"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c6 between 0 and 9"
)
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
rows
)
tdSql
.
query
(
"select * from
t1 where c6 between -1.1 and 8.9"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c6 between -1.1 and 8.9"
)
tdSql
.
checkRows
(
9
)
tdSql
.
checkRows
(
rows
-
1
)
tdSql
.
query
(
"select * from
t1 where c6 between 9 and 0"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c6 between 9 and 0"
)
tdSql
.
checkRows
(
0
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select * from
t1 where c6 between 'NUL' and 'HT'"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c6 between 'NUL' and 'HT'"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select * from
t1 where c6 not between 1 and 2"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c6 not between 1 and 2"
)
# tdSql.checkRows(1)
# tdSql.checkRows(1)
tdSql
.
query
(
"select * from
t1 where c6 between 127 and 128"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c6 between 127 and 128"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select * from
t2 where c6 between -128 and -127"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t2 where c6 between -128 and -127"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select * from
t2 where c6 between null and -127"
)
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t2 where c6 between null and -127"
)
# tdSql.checkRows(3)
# tdSql.checkRows(3)
tdLog
.
printNoPrefix
(
"==========step10:invalid query type"
)
tdLog
.
printNoPrefix
(
"==========step10:invalid query type"
)
# TODO tag is not finished
# TODO tag is not finished
# tdSql.query("select * from supt where location between 'beijing' and 'shanghai'")
tdSql
.
query
(
f
"select * from
{
stb
}
where location between 'beijing' and 'shanghai'"
)
# tdSql.checkRows(23)
tdSql
.
checkRows
(
rows
*
2
+
3
)
# # 非0值均解析为1,因此"between 负值 and o"解析为"between 1 and 0"
# 非0值均解析为1,因此"between 负值 and o"解析为"between 1 and 0"
# tdSql.query("select * from supt where isused between 0 and 1")
tdSql
.
query
(
f
"select * from
{
stb
}
where isused between 0 and 1"
)
# tdSql.checkRows(23)
tdSql
.
checkRows
(
rows
*
2
+
3
)
# tdSql.query("select * from supt where isused between -1 and 0")
tdSql
.
query
(
f
"select * from
{
stb
}
where isused between -1 and 0"
)
# tdSql.checkRows(0)
tdSql
.
checkRows
(
rows
+
2
)
# tdSql.error("select * from supt where isused between false and true")
tdSql
.
query
(
f
"select * from
{
stb
}
where isused between false and true"
)
# tdSql.query("select * from supt where family between '拖拉机' and '自行车'")
tdSql
.
checkRows
(
rows
*
2
+
3
)
# tdSql.checkRows(23)
tdSql
.
query
(
f
"select * from
{
stb
}
where family between '拖拉机' and '自行车'"
)
tdSql
.
checkRows
(
0
)
tdLog
.
printNoPrefix
(
"==========step11:query HEX/OCT/BIN type"
)
tdLog
.
printNoPrefix
(
"==========step11:query HEX/OCT/BIN type"
)
tdSql
.
error
(
"select * from
t1 where c6 between 0x7f and 0x80"
)
# check filter HEX
tdSql
.
error
(
f
"select * from
{
dbname
}
.
t1 where c6 between 0x7f and 0x80"
)
# check filter HEX
tdSql
.
error
(
"select * from
t1 where c6 between 0b1 and 0b11111"
)
# check filter BIN
tdSql
.
error
(
f
"select * from
{
dbname
}
.
t1 where c6 between 0b1 and 0b11111"
)
# check filter BIN
tdSql
.
error
(
"select * from
t1 where c6 between 0b1 and 0x80"
)
tdSql
.
error
(
f
"select * from
{
dbname
}
.
t1 where c6 between 0b1 and 0x80"
)
tdSql
.
error
(
"select * from
t1 where c6=0b1"
)
tdSql
.
error
(
f
"select * from
{
dbname
}
.
t1 where c6=0b1"
)
tdSql
.
error
(
"select * from
t1 where c6=0x1"
)
tdSql
.
error
(
f
"select * from
{
dbname
}
.
t1 where c6=0x1"
)
# 八进制数据会按照十进制数据进行判定
# 八进制数据会按照十进制数据进行判定
tdSql
.
query
(
"select * from
t1 where c6 between 01 and 0200"
)
# check filter OCT
tdSql
.
query
(
f
"select * from
{
dbname
}
.
t1 where c6 between 01 and 0200"
)
# check filter OCT
tdSql
.
checkRows
(
10
)
tdSql
.
checkRows
(
rows
)
def
stop
(
self
):
def
stop
(
self
):
tdSql
.
close
()
tdSql
.
close
()
...
...
tests/system-test/2-query/bottom.py
浏览文件 @
028dba3c
...
@@ -26,7 +26,7 @@ class TDTestCase:
...
@@ -26,7 +26,7 @@ class TDTestCase:
tdSql
.
init
(
conn
.
cursor
())
tdSql
.
init
(
conn
.
cursor
())
self
.
dbname
=
'db_test'
self
.
dbname
=
'db_test'
self
.
setsql
=
TDSetSql
()
self
.
setsql
=
TDSetSql
()
self
.
ntbname
=
'
ntb'
self
.
ntbname
=
f
'
{
self
.
dbname
}
.
ntb'
self
.
rowNum
=
10
self
.
rowNum
=
10
self
.
tbnum
=
20
self
.
tbnum
=
20
self
.
ts
=
1537146000000
self
.
ts
=
1537146000000
...
@@ -96,7 +96,7 @@ class TDTestCase:
...
@@ -96,7 +96,7 @@ class TDTestCase:
self
.
bottom_check_data
(
self
.
ntbname
,
'normal_table'
)
self
.
bottom_check_data
(
self
.
ntbname
,
'normal_table'
)
tdSql
.
execute
(
f
'drop database
{
self
.
dbname
}
'
)
tdSql
.
execute
(
f
'drop database
{
self
.
dbname
}
'
)
def
bottom_check_stb
(
self
):
def
bottom_check_stb
(
self
):
stbname
=
tdCom
.
getLongName
(
5
,
"letters"
)
stbname
=
f
'
{
self
.
dbname
}
.
{
tdCom
.
getLongName
(
5
,
"letters"
)
}
'
tag_dict
=
{
tag_dict
=
{
't0'
:
'int'
't0'
:
'int'
}
}
...
@@ -109,7 +109,7 @@ class TDTestCase:
...
@@ -109,7 +109,7 @@ class TDTestCase:
for
i
in
range
(
self
.
tbnum
):
for
i
in
range
(
self
.
tbnum
):
tdSql
.
execute
(
f
"create table
{
stbname
}
_
{
i
}
using
{
stbname
}
tags(
{
tag_values
[
0
]
}
)"
)
tdSql
.
execute
(
f
"create table
{
stbname
}
_
{
i
}
using
{
stbname
}
tags(
{
tag_values
[
0
]
}
)"
)
self
.
insert_data
(
self
.
column_dict
,
f
'
{
stbname
}
_
{
i
}
'
,
self
.
rowNum
)
self
.
insert_data
(
self
.
column_dict
,
f
'
{
stbname
}
_
{
i
}
'
,
self
.
rowNum
)
tdSql
.
query
(
'show
tables'
)
tdSql
.
query
(
f
'show
{
self
.
dbname
}
.
tables'
)
vgroup_list
=
[]
vgroup_list
=
[]
for
i
in
range
(
len
(
tdSql
.
queryResult
)):
for
i
in
range
(
len
(
tdSql
.
queryResult
)):
vgroup_list
.
append
(
tdSql
.
queryResult
[
i
][
6
])
vgroup_list
.
append
(
tdSql
.
queryResult
[
i
][
6
])
...
...
tests/system-test/2-query/cast.py
浏览文件 @
028dba3c
此差异已折叠。
点击以展开。
tests/system-test/fulltest.sh
浏览文件 @
028dba3c
...
@@ -37,10 +37,21 @@ python3 ./test.py -f 2-query/apercentile.py
...
@@ -37,10 +37,21 @@ python3 ./test.py -f 2-query/apercentile.py
python3 ./test.py
-f
2-query/apercentile.py
-R
python3 ./test.py
-f
2-query/apercentile.py
-R
python3 ./test.py
-f
2-query/arccos.py
python3 ./test.py
-f
2-query/arccos.py
python3 ./test.py
-f
2-query/arccos.py
-R
python3 ./test.py
-f
2-query/arccos.py
-R
python3 ./test.py
-f
2-query/arcsin.py
python3 ./test.py
-f
2-query/arcsin.py
-R
python3 ./test.py
-f
2-query/arctan.py
python3 ./test.py
-f
2-query/arctan.py
-R
python3 ./test.py
-f
2-query/avg.py
python3 ./test.py
-f
2-query/avg.py
-R
python3 ./test.py
-f
2-query/between.py
python3 ./test.py
-f
2-query/between.py
-R
python3 ./test.py
-f
2-query/bottom.py
python3 ./test.py
-f
2-query/bottom.py
-R
python3 ./test.py
-f
2-query/cast.py
python3 ./test.py
-f
2-query/cast.py
-R
python3 ./test.py
-f
2-query/between.py
python3 ./test.py
-f
2-query/distinct.py
python3 ./test.py
-f
2-query/distinct.py
python3 ./test.py
-f
2-query/varchar.py
python3 ./test.py
-f
2-query/varchar.py
python3 ./test.py
-f
2-query/ltrim.py
python3 ./test.py
-f
2-query/ltrim.py
...
@@ -51,7 +62,6 @@ python3 ./test.py -f 2-query/upper.py
...
@@ -51,7 +62,6 @@ python3 ./test.py -f 2-query/upper.py
python3 ./test.py
-f
2-query/lower.py
python3 ./test.py
-f
2-query/lower.py
python3 ./test.py
-f
2-query/join.py
python3 ./test.py
-f
2-query/join.py
python3 ./test.py
-f
2-query/join2.py
python3 ./test.py
-f
2-query/join2.py
python3 ./test.py
-f
2-query/cast.py
python3 ./test.py
-f
2-query/substr.py
python3 ./test.py
-f
2-query/substr.py
python3 ./test.py
-f
2-query/union.py
python3 ./test.py
-f
2-query/union.py
python3 ./test.py
-f
2-query/union1.py
python3 ./test.py
-f
2-query/union1.py
...
@@ -83,7 +93,6 @@ python3 ./test.py -f 2-query/Timediff.py
...
@@ -83,7 +93,6 @@ python3 ./test.py -f 2-query/Timediff.py
python3 ./test.py
-f
2-query/json_tag.py
python3 ./test.py
-f
2-query/json_tag.py
python3 ./test.py
-f
2-query/top.py
python3 ./test.py
-f
2-query/top.py
python3 ./test.py
-f
2-query/bottom.py
python3 ./test.py
-f
2-query/percentile.py
python3 ./test.py
-f
2-query/percentile.py
python3 ./test.py
-f
2-query/ceil.py
python3 ./test.py
-f
2-query/ceil.py
python3 ./test.py
-f
2-query/floor.py
python3 ./test.py
-f
2-query/floor.py
...
@@ -94,15 +103,12 @@ python3 ./test.py -f 2-query/sqrt.py
...
@@ -94,15 +103,12 @@ python3 ./test.py -f 2-query/sqrt.py
python3 ./test.py
-f
2-query/sin.py
python3 ./test.py
-f
2-query/sin.py
python3 ./test.py
-f
2-query/cos.py
python3 ./test.py
-f
2-query/cos.py
python3 ./test.py
-f
2-query/tan.py
python3 ./test.py
-f
2-query/tan.py
python3 ./test.py
-f
2-query/arcsin.py
python3 ./test.py
-f
2-query/arctan.py
python3 ./test.py
-f
2-query/query_cols_tags_and_or.py
python3 ./test.py
-f
2-query/query_cols_tags_and_or.py
# python3 ./test.py -f 2-query/nestedQuery.py
# python3 ./test.py -f 2-query/nestedQuery.py
# TD-15983 subquery output duplicate name column.
# TD-15983 subquery output duplicate name column.
# Please Xiangyang Guo modify the following script
# Please Xiangyang Guo modify the following script
# python3 ./test.py -f 2-query/nestedQuery_str.py
# python3 ./test.py -f 2-query/nestedQuery_str.py
python3 ./test.py
-f
2-query/avg.py
python3 ./test.py
-f
2-query/elapsed.py
python3 ./test.py
-f
2-query/elapsed.py
python3 ./test.py
-f
2-query/csum.py
python3 ./test.py
-f
2-query/csum.py
python3 ./test.py
-f
2-query/mavg.py
python3 ./test.py
-f
2-query/mavg.py
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录