Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
002db5b0
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
002db5b0
编写于
10月 26, 2022
作者:
W
wenzhouwww@live.cn
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[test]enh cast , log ,pow function about coverage
上级
b2affd12
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
131 addition
and
0 deletion
+131
-0
tests/system-test/2-query/cast.py
tests/system-test/2-query/cast.py
+70
-0
tests/system-test/2-query/log.py
tests/system-test/2-query/log.py
+31
-0
tests/system-test/2-query/pow.py
tests/system-test/2-query/pow.py
+30
-0
未找到文件。
tests/system-test/2-query/cast.py
浏览文件 @
002db5b0
...
...
@@ -653,6 +653,76 @@ class TDTestCase:
tdSql.query(f"
select
cast
(
c9
as
timestamp
)
as
b
from
{
self
.
dbname
}
.
ct4
")
tdSql.query(f"
select
cast
(
c9
as
binary
(
64
)
)
as
b
from
{
self
.
dbname
}
.
ct4
")
# enh of cast function about coverage
tdSql.query(f"
select
cast
(
c1
as
int
)
as
b
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
cast
(
c1
as
bool
)
as
b
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
cast
(
c1
as
tinyint
)
as
b
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
cast
(
c1
as
smallint
)
as
b
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
cast
(
c1
as
float
)
as
b
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
cast
(
c1
as
double
)
as
b
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
cast
(
c1
as
tinyint
unsigned
)
as
b
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
cast
(
c1
as
smallint
unsigned
)
as
b
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
cast
(
c1
as
int
unsigned
)
as
b
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
cast
(
c2
as
int
)
as
b
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
cast
(
c3
as
bool
)
as
b
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
cast
(
c4
as
tinyint
)
as
b
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
cast
(
c5
as
smallint
)
as
b
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
cast
(
c6
as
float
)
as
b
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
cast
(
c7
as
double
)
as
b
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
cast
(
c8
as
tinyint
unsigned
)
as
b
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
cast
(
c8
as
timestamp
)
as
b
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
cast
(
c9
as
timestamp
)
as
b
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
cast
(
c9
as
binary
(
64
)
)
as
b
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
cast
(
abs
(
c2
)
as
int
)
as
b
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
cast
(
c3
as
bool
)
as
b
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
cast
(
floor
(
c4
)
as
tinyint
)
as
b
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
cast
(
c5
+
2
as
smallint
)
as
b
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
cast
(
2
as
float
)
as
b
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
cast
(
c7
as
double
)
as
b
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
cast
(
'123'
as
tinyint
unsigned
)
as
b
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
max
(
cast
(
abs
(
c2
)
as
int
))
as
b
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
log
(
cast
(
c3
as
int
),
2
)
as
b
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
abs
(
cast
(
floor
(
c4
)
as
tinyint
))
as
b
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
last
(
cast
(
c5
+
2
as
smallint
))
as
b
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
mavg
(
cast
(
2
as
float
),
3
)
as
b
from
{
self
.
dbname
}
.
stb1
partition
by
tbname
")
tdSql.query(f"
select
cast
(
c7
as
double
)
as
b
from
{
self
.
dbname
}
.
stb1
partition
by
tbname
order
by
tbname
")
tdSql.query(f"
select
cast
(
'123'
as
tinyint
unsigned
)
as
b
from
{
self
.
dbname
}
.
stb1
partition
by
tbname
")
# uion with cast and common cols
'''
desc stb1
field | type | length | note |
=================================================================================
ts | TIMESTAMP | 8 | |
c1 | INT | 4 | |
c2 | BIGINT | 8 | |
c3 | SMALLINT | 2 | |
c4 | TINYINT | 1 | |
c5 | FLOAT | 4 | |
c6 | DOUBLE | 8 | |
c7 | BOOL | 1 | |
c8 | VARCHAR | 16 | |
c9 | NCHAR | 32 | |
c10 | TIMESTAMP | 8 | |
t1 | INT | 4 | TAG |
'''
tdSql.query(f"
select
cast
(
c2
as
int
)
as
b
from
{
self
.
dbname
}
.
stb1
union
all
select
c1
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
cast
(
c3
as
bool
)
as
b
from
{
self
.
dbname
}
.
stb1
union
all
select
c7
from
{
self
.
dbname
}
.
ct1
")
tdSql.query(f"
select
cast
(
c4
as
tinyint
)
as
b
from
{
self
.
dbname
}
.
stb1
union
all
select
c4
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
cast
(
c5
as
smallint
)
as
b
from
{
self
.
dbname
}
.
stb1
union
all
select
cast
(
c5
as
smallint
)
as
b
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
cast
(
c6
as
float
)
as
b
from
{
self
.
dbname
}
.
stb1
union
all
select
c5
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
cast
(
c7
as
double
)
as
b
from
{
self
.
dbname
}
.
stb1
union
all
select
123
from
{
self
.
dbname
}
.
stb1
")
tdSql.query(f"
select
cast
(
c8
as
tinyint
unsigned
)
as
b
from
{
self
.
dbname
}
.
stb1
union
all
select
last
(
cast
(
c8
as
tinyint
unsigned
))
from
{
self
.
dbname
}
.
stb1
")
def run(self):
tdSql.prepare()
...
...
tests/system-test/2-query/log.py
浏览文件 @
002db5b0
...
...
@@ -229,6 +229,36 @@ class TDTestCase:
tdSql
.
query
(
f
"select log(c6 ,2) from
{
dbname
}
.ct3"
)
tdSql
.
checkRows
(
0
)
# log used for different param types
tdSql
.
query
(
f
"select log(c1,c2) from
{
dbname
}
.ct1;"
)
tdSql
.
query
(
f
"select log(c1,c2) from
{
dbname
}
.stb1 partition by tbname order by tbname;"
)
tdSql
.
query
(
f
"select log(c1,2) from
{
dbname
}
.ct1;"
)
tdSql
.
query
(
f
"select log(c1,2) from
{
dbname
}
.stb1 partition by tbname order by tbname;"
)
tdSql
.
query
(
f
"select log(2,c2) from
{
dbname
}
.ct1;"
)
tdSql
.
query
(
f
"select log(2,c2) from
{
dbname
}
.stb1 partition by tbname order by tbname;"
)
tdSql
.
query
(
f
"select log(2,1) from
{
dbname
}
.ct1;"
)
tdSql
.
query
(
f
"select log(2,2) from
{
dbname
}
.stb1 partition by tbname order by tbname;"
)
tdSql
.
query
(
f
"select log(2,floor(1)) from
{
dbname
}
.ct1;"
)
tdSql
.
query
(
f
"select log(2,floor(2)) from
{
dbname
}
.stb1 partition by tbname order by tbname;"
)
tdSql
.
query
(
f
"select log(abs(2),floor(1)) from
{
dbname
}
.ct1;"
)
tdSql
.
query
(
f
"select log(abs(2),floor(2)) from
{
dbname
}
.stb1 partition by tbname order by tbname;"
)
tdSql
.
query
(
f
"select log(abs(c2),c1) from
{
dbname
}
.ct1;"
)
tdSql
.
query
(
f
"select log(abs(c2),c1) from
{
dbname
}
.stb1 partition by tbname order by tbname;"
)
tdSql
.
query
(
f
"select log(c2,abs(c1)) from
{
dbname
}
.ct1;"
)
tdSql
.
query
(
f
"select log(c2,abs(c1)) from
{
dbname
}
.stb1 partition by tbname order by tbname;"
)
tdSql
.
query
(
f
"select log(abs(c2),2) from
{
dbname
}
.ct1;"
)
tdSql
.
query
(
f
"select log(abs(c2),2) from
{
dbname
}
.stb1 partition by tbname order by tbname;"
)
# # used for regular table
tdSql
.
query
(
f
"select log(c1 ,2) from
{
dbname
}
.t1"
)
...
...
@@ -291,6 +321,7 @@ class TDTestCase:
tdSql
.
query
(
f
"select log(c1, 2) from
{
dbname
}
.stb1"
)
tdSql
.
checkRows
(
25
)
# used for not exists table
tdSql
.
error
(
f
"select log(c1, 2) from
{
dbname
}
.stbbb1"
)
...
...
tests/system-test/2-query/pow.py
浏览文件 @
002db5b0
...
...
@@ -216,6 +216,36 @@ class TDTestCase:
tdSql
.
checkRows
(
0
)
# pow used for different param types
tdSql
.
query
(
f
"select pow(c1,c2) from
{
dbname
}
.ct1;"
)
tdSql
.
query
(
f
"select pow(c1,c2) from
{
dbname
}
.stb1 partition by tbname order by tbname;"
)
tdSql
.
query
(
f
"select pow(c1,2) from
{
dbname
}
.ct1;"
)
tdSql
.
query
(
f
"select pow(c1,2) from
{
dbname
}
.stb1 partition by tbname order by tbname;"
)
tdSql
.
query
(
f
"select pow(2,c2) from
{
dbname
}
.ct1;"
)
tdSql
.
query
(
f
"select pow(2,c2) from
{
dbname
}
.stb1 partition by tbname order by tbname;"
)
tdSql
.
query
(
f
"select pow(2,1) from
{
dbname
}
.ct1;"
)
tdSql
.
query
(
f
"select pow(2,2) from
{
dbname
}
.stb1 partition by tbname order by tbname;"
)
tdSql
.
query
(
f
"select pow(2,floor(1)) from
{
dbname
}
.ct1;"
)
tdSql
.
query
(
f
"select pow(2,floor(2)) from
{
dbname
}
.stb1 partition by tbname order by tbname;"
)
tdSql
.
query
(
f
"select pow(abs(2),floor(1)) from
{
dbname
}
.ct1;"
)
tdSql
.
query
(
f
"select pow(abs(2),floor(2)) from
{
dbname
}
.stb1 partition by tbname order by tbname;"
)
tdSql
.
query
(
f
"select pow(abs(c2),c1) from
{
dbname
}
.ct1;"
)
tdSql
.
query
(
f
"select pow(abs(c2),c1) from
{
dbname
}
.stb1 partition by tbname order by tbname;"
)
tdSql
.
query
(
f
"select pow(c2,abs(c1)) from
{
dbname
}
.ct1;"
)
tdSql
.
query
(
f
"select pow(c2,abs(c1)) from
{
dbname
}
.stb1 partition by tbname order by tbname;"
)
tdSql
.
query
(
f
"select pow(abs(c2),2) from
{
dbname
}
.ct1;"
)
tdSql
.
query
(
f
"select pow(abs(c2),2) from
{
dbname
}
.stb1 partition by tbname order by tbname;"
)
# # used for regular table
tdSql
.
query
(
f
"select pow(c1 ,2) from
{
dbname
}
.t1"
)
tdSql
.
checkData
(
0
,
0
,
None
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录