Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
493dda04
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看板
未验证
提交
493dda04
编写于
6月 25, 2022
作者:
H
Hui Li
提交者:
GitHub
6月 25, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #14242 from taosdata/test/TD-16484
'test: refine query cases'
上级
13d5db3e
1ba41e03
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
102 addition
and
0 deletion
+102
-0
tests/system-test/2-query/json_tag.py
tests/system-test/2-query/json_tag.py
+102
-0
未找到文件。
tests/system-test/2-query/json_tag.py
浏览文件 @
493dda04
...
...
@@ -11,12 +11,14 @@
# -*- coding: utf-8 -*-
import
imp
import
sys
import
taos
from
util.log
import
tdLog
from
util.cases
import
tdCases
from
util.sql
import
tdSql
import
json
import
os
class
TDTestCase
:
...
...
@@ -29,6 +31,9 @@ class TDTestCase:
return
def
init
(
self
,
conn
,
logSql
):
self
.
testcasePath
=
os
.
path
.
split
(
__file__
)[
0
]
self
.
testcaseFilename
=
os
.
path
.
split
(
__file__
)[
-
1
]
os
.
system
(
"rm -rf %s/%s.sql"
%
(
self
.
testcasePath
,
self
.
testcaseFilename
))
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
...
...
@@ -557,6 +562,103 @@ class TDTestCase:
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select round(dataint) from jsons1 where jtag->'tag1'>1"
)
tdSql
.
checkRows
(
3
)
#math function
tdSql
.
query
(
"select sin(dataint) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select cos(dataint) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select tan(dataint) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select asin(dataint) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select acos(dataint) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select atan(dataint) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select ceil(dataint) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select floor(dataint) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select round(dataint) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select abs(dataint) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select pow(dataint,5) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select log(dataint,10) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select sqrt(dataint) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select HISTOGRAM(dataint,'user_input','[1, 33, 555, 7777]',1) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select csum(dataint) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select mavg(dataint,1) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select statecount(dataint,'GE',10) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select stateduration(dataint,'GE',0) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select sample(dataint,3) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select HYPERLOGLOG(dataint) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select twa(dataint) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
1
)
# function not ready
# tdSql.query("select tail(dataint,1) from jsons1 where jtag->'tag1'>1;")
# tdSql.checkRows(3)
# tdSql.query("select unique(dataint) from jsons1 where jtag->'tag1'>1;")
# tdSql.checkRows(3)
# tdSql.query("select mode(dataint) from jsons1 where jtag->'tag1'>1;")
# tdSql.checkRows(3)
# tdSql.query("select irate(dataint) from jsons1 where jtag->'tag1'>1;")
# tdSql.checkRows(1)
#str function
tdSql
.
query
(
"select upper(dataStr) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select ltrim(dataStr) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select lower(dataStr) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select rtrim(dataStr) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select LENGTH(dataStr) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select CHAR_LENGTH(dataStr) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select SUBSTR(dataStr,5) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select CONCAT(dataStr,dataStrBin) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select CONCAT_ws('adad!@!@%$^$%$^$%^a',dataStr,dataStrBin) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select CAST(dataStr as bigint) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
#time function
tdSql
.
query
(
"select now() from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select today() from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select TIMEZONE() from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select TO_ISO8601(ts) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select TO_UNIXTIMESTAMP(datastr) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select TIMETRUNCATE(ts,1u) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select TIMEDIFF(ts,_c0) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select TIMEDIFF(ts,1u) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select ELAPSED(ts,1h) from jsons1 where jtag->'tag1'>1;"
)
tdSql
.
checkRows
(
1
)
#
# #test TD-12077
tdSql
.
execute
(
"insert into jsons1_16 using jsons1 tags('{
\"
tag1
\"
:
\"
收到货
\"
,
\"
tag2
\"
:
\"\"
,
\"
tag3
\"
:-2.111}') values(1591062628000, 2, NULL, '你就会', 'dws')"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录