Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
50994d89
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
50994d89
编写于
6月 08, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add json test case
上级
6b39c690
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
192 addition
and
186 deletion
+192
-186
tests/system-test/2-query/json_tag.py
tests/system-test/2-query/json_tag.py
+192
-186
未找到文件。
tests/system-test/2-query/json_tag.py
浏览文件 @
50994d89
...
...
@@ -171,10 +171,10 @@ class TDTestCase:
tdSql
.
checkRows
(
9
)
tdSql
.
query
(
"select jtag from jsons1"
)
tdSql
.
checkRows
(
13
)
# tdSql.query("select jtag
from jsons1 where jtag is null")
# tdSql.checkRows(5
)
# tdSql.query("select jtag
from jsons1 where jtag is not null")
#
tdSql.checkRows(8)
tdSql
.
query
(
"select *
from jsons1 where jtag is null"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select *
from jsons1 where jtag is not null"
)
tdSql
.
checkRows
(
8
)
# test jtag is NULL
tdSql
.
query
(
"select jtag from jsons1_9"
)
...
...
@@ -211,172 +211,176 @@ class TDTestCase:
# # test where with json tag
# tdSql.error
("select * from jsons1_1 where jtag is not null")
tdSql
.
query
(
"select * from jsons1_1 where jtag is not null"
)
# tdSql.error("select * from jsons1 where jtag='{\"tag1\":11,\"tag2\":\"\"}'")
# tdSql.error("select * from jsons1 where jtag->'tag1'={}")
#
# # where json value is string
# tdSql.query("select * from jsons1 where jtag->'tag2'='beijing'")
# tdSql.checkRows(2)
# tdSql.query("select dataint,tbname,jtag->'tag1',jtag from jsons1 where jtag->'tag2'='beijing'")
# tdSql.checkData(0, 0, 2)
# tdSql.checkData(0, 1, 'jsons1_2')
# tdSql.checkData(0, 2, 5)
# tdSql.checkData(0, 3, '{"tag1":5,"tag2":"beijing"}')
# tdSql.checkData(1, 0, 3)
# tdSql.checkData(1, 1, 'jsons1_3')
# tdSql.checkData(1, 2, 'false')
# tdSql.query("select * from jsons1 where jtag->'tag1'='beijing'")
# tdSql.checkRows(0)
# tdSql.query("select * from jsons1 where jtag->'tag1'='收到货'")
# tdSql.checkRows(1)
# tdSql.query("select * from jsons1 where jtag->'tag2'>'beijing'")
# tdSql.checkRows(1)
# tdSql.query("select * from jsons1 where jtag->'tag2'>='beijing'")
# tdSql.checkRows(3)
# tdSql.query("select * from jsons1 where jtag->'tag2'<'beijing'")
# tdSql.checkRows(2)
# tdSql.query("select * from jsons1 where jtag->'tag2'<='beijing'")
# tdSql.checkRows(4)
# tdSql.query("select * from jsons1 where jtag->'tag2'!='beijing'")
# tdSql.checkRows(3)
# tdSql.query("select * from jsons1 where jtag->'tag2'=''")
# tdSql.checkRows(2)
tdSql
.
query
(
"select * from jsons1 where jtag->'tag2'='beijing'"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select dataint,tbname,jtag->'tag1',jtag from jsons1 where jtag->'tag2'='beijing'"
)
tdSql
.
checkRows
(
2
)
# out of order, cannot compare value
#tdSql.checkData(0, 0, 2)
#tdSql.checkData(0, 1, 'jsons1_2')
#tdSql.checkData(0, 2, 5)
#tdSql.checkData(0, 3, '{"tag1":5,"tag2":"beijing"}')
#tdSql.checkData(1, 0, 3)
#tdSql.checkData(1, 1, 'jsons1_3')
#tdSql.checkData(1, 2, 'false')
tdSql
.
query
(
"select * from jsons1 where jtag->'tag1'='beijing'"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select * from jsons1 where jtag->'tag1'='收到货'"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select * from jsons1 where jtag->'tag2'>'beijing'"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select * from jsons1 where jtag->'tag2'>='beijing'"
)
tdSql
.
checkRows
(
3
)
# open
#tdSql.query("select * from jsons1 where jtag->'tag2'<'beijing'")
#tdSql.checkRows(2)
tdSql
.
query
(
"select * from jsons1 where jtag->'tag2'<='beijing'"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select * from jsons1 where jtag->'tag2'!='beijing'"
)
tdSql
.
checkRows
(
5
)
#open
#tdSql.query("select * from jsons1 where jtag->'tag2'=''")
#tdSql.checkRows(2)
#
# # where json value is int
# tdSql.query("select * from jsons1 where jtag->'tag1'=5")
# tdSql.checkRows(1)
# tdSql.checkData(0, 1, 2)
# tdSql.query("select * from jsons1 where jtag->'tag1'=10")
# tdSql.checkRows(0)
# tdSql.query("select * from jsons1 where jtag->'tag1'<54")
# tdSql.checkRows(3)
# tdSql.query("select * from jsons1 where jtag->'tag1'<=11")
# tdSql.checkRows(3)
# tdSql.query("select * from jsons1 where jtag->'tag1'>4")
# tdSql.checkRows(2)
# tdSql.query("select * from jsons1 where jtag->'tag1'>=5")
# tdSql.checkRows(2)
# tdSql.query("select * from jsons1 where jtag->'tag1'!=5")
# tdSql.checkRows(2)
# tdSql.query("select * from jsons1 where jtag->'tag1'!=55")
# tdSql.checkRows(3)
tdSql
.
query
(
"select * from jsons1 where jtag->'tag1'=5"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
1
,
2
)
tdSql
.
query
(
"select * from jsons1 where jtag->'tag1'=10"
)
tdSql
.
checkRows
(
0
)
# open
#tdSql.query("select * from jsons1 where jtag->'tag1'<54")
#tdSql.checkRows(3)
#tdSql.query("select * from jsons1 where jtag->'tag1'<=11")
#tdSql.checkRows(3)
tdSql
.
query
(
"select * from jsons1 where jtag->'tag1'>4"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select * from jsons1 where jtag->'tag1'>=5"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select * from jsons1 where jtag->'tag1'!=5"
)
tdSql
.
checkRows
(
6
)
tdSql
.
query
(
"select * from jsons1 where jtag->'tag1'!=55"
)
tdSql
.
checkRows
(
7
)
#
# # where json value is double
# tdSql.query("select * from jsons1 where jtag->'tag1'=1.232")
# tdSql.checkRows(1)
# tdSql.query("select * from jsons1 where jtag->'tag1'<1.232")
# tdSql.checkRows(0)
# tdSql.query("select * from jsons1 where jtag->'tag1'<=1.232")
# tdSql.checkRows(1)
# tdSql.query("select * from jsons1 where jtag->'tag1'>1.23")
# tdSql.checkRows(3)
# tdSql.query("select * from jsons1 where jtag->'tag1'>=1.232")
# tdSql.checkRows(3)
# tdSql.query("select * from jsons1 where jtag->'tag1'!=1.232")
# tdSql.checkRows(2)
# tdSql.query("select * from jsons1 where jtag->'tag1'!=3.232")
# tdSql.checkRows(3)
# tdSql.error("select * from jsons1 where jtag->'tag1'/0=3")
# tdSql.error("select * from jsons1 where jtag->'tag1'/5=1")
tdSql
.
query
(
"select * from jsons1 where jtag->'tag1'=1.232"
)
tdSql
.
checkRows
(
1
)
# open
#tdSql.query("select * from jsons1 where jtag->'tag1'<1.232")
#tdSql.checkRows(0)
#tdSql.query("select * from jsons1 where jtag->'tag1'<=1.232")
#tdSql.checkRows(1)
tdSql
.
query
(
"select * from jsons1 where jtag->'tag1'>1.23"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select * from jsons1 where jtag->'tag1'>=1.232"
)
tdSql
.
checkRows
(
3
)
# open
#tdSql.query("select * from jsons1 where jtag->'tag1'!=1.232")
#tdSql.checkRows(2)
tdSql
.
query
(
"select * from jsons1 where jtag->'tag1'!=3.232"
)
tdSql
.
checkRows
(
7
)
#tdSql.error("select * from jsons1 where jtag->'tag1'/0=3")
#tdSql.error("select * from jsons1 where jtag->'tag1'/5=1")
#
# # where json value is bool
# tdSql.query("select * from jsons1 where jtag->'tag1'=true")
# tdSql.checkRows(0)
# tdSql.query("select * from jsons1 where jtag->'tag1'=false")
# tdSql.checkRows(1)
# tdSql.query("select * from jsons1 where jtag->'tag1'!=false")
# tdSql.checkRows(0)
# tdSql.error("select * from jsons1 where jtag->'tag1'>false")
#tdSql.query("select * from jsons1 where jtag->'tag1'=true")
# open
#tdSql.checkRows(0)
#tdSql.query("select * from jsons1 where jtag->'tag1'=false")
#tdSql.checkRows(1)
#tdSql.query("select * from jsons1 where jtag->'tag1'!=false")
#tdSql.checkRows(0)
#tdSql.error("select * from jsons1 where jtag->'tag1'>false")
#
# # where json value is null
# tdSql.query("select * from jsons1 where jtag->'tag1'=null") # only json suport =null. This synatx will change later.
# tdSql.checkRows(1)
# open
#tdSql.query("select * from jsons1 where jtag->'tag1'=null") # only json suport =null. This synatx will change later.
#tdSql.checkRows(1)
#
# # where json key is null
# tdSql.query("select * from jsons1 where jtag->'tag_no_exist'=3")
# tdSql.checkRows(0)
# open
#tdSql.query("select * from jsons1 where jtag->'tag_no_exist'=3")
#tdSql.checkRows(0)
#
# # where json value is not exist
#
tdSql.query("select * from jsons1 where jtag->'tag1' is null")
#
tdSql.checkData(0, 0, 'jsons1_9')
#
tdSql.checkRows(1)
#
tdSql.query("select * from jsons1 where jtag->'tag4' is null")
#
tdSql.checkRows(9)
#
tdSql.query("select * from jsons1 where jtag->'tag3' is not null")
#
tdSql.checkRows(4)
#tdSql.query("select * from jsons1 where jtag->'tag1' is null")
#tdSql.checkData(0, 0, 'jsons1_9')
#tdSql.checkRows(1)
#tdSql.query("select * from jsons1 where jtag->'tag4' is null")
#tdSql.checkRows(9)
#tdSql.query("select * from jsons1 where jtag->'tag3' is not null")
#tdSql.checkRows(4)
#
# # test contains
#
tdSql.query("select * from jsons1 where jtag contains 'tag1'")
# tdSql.checkRows(8
)
#
tdSql.query("select * from jsons1 where jtag contains 'tag3'")
# tdSql.checkRows(4
)
#
tdSql.query("select * from jsons1 where jtag contains 'tag_no_exist'")
#
tdSql.checkRows(0)
tdSql
.
query
(
"select * from jsons1 where jtag contains 'tag1'"
)
tdSql
.
checkRows
(
7
)
tdSql
.
query
(
"select * from jsons1 where jtag contains 'tag3'"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select * from jsons1 where jtag contains 'tag_no_exist'"
)
tdSql
.
checkRows
(
0
)
#
# # test json tag in where condition with and/or
#
tdSql.query("select * from jsons1 where jtag->'tag1'=false and jtag->'tag2'='beijing'")
#
tdSql.checkRows(1)
#
tdSql.query("select * from jsons1 where jtag->'tag1'=false or jtag->'tag2'='beijing'")
#
tdSql.checkRows(2)
#
tdSql.query("select * from jsons1 where jtag->'tag1'=false and jtag->'tag2'='shanghai'")
#
tdSql.checkRows(0)
#
tdSql.query("select * from jsons1 where jtag->'tag1'=false and jtag->'tag2'='shanghai'")
#
tdSql.checkRows(0)
#
tdSql.query("select * from jsons1 where jtag->'tag1'=13 or jtag->'tag2'>35")
#
tdSql.checkRows(0)
#
tdSql.query("select * from jsons1 where jtag->'tag1'=13 or jtag->'tag2'>35")
#
tdSql.checkRows(0)
#
tdSql.query("select * from jsons1 where jtag->'tag1' is not null and jtag contains 'tag3'")
# tdSql.checkRows(4
)
#
tdSql.query("select * from jsons1 where jtag->'tag1'='femail' and jtag contains 'tag3'")
#
tdSql.checkRows(2)
tdSql
.
query
(
"select * from jsons1 where jtag->'tag1'=false and jtag->'tag2'='beijing'"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select * from jsons1 where jtag->'tag1'=false or jtag->'tag2'='beijing'"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select * from jsons1 where jtag->'tag1'=false and jtag->'tag2'='shanghai'"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select * from jsons1 where jtag->'tag1'=false and jtag->'tag2'='shanghai'"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select * from jsons1 where jtag->'tag1'=13 or jtag->'tag2'>35"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select * from jsons1 where jtag->'tag1'=13 or jtag->'tag2'>35"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select * from jsons1 where jtag->'tag1' is not null and jtag contains 'tag3'"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select * from jsons1 where jtag->'tag1'='femail' and jtag contains 'tag3'"
)
tdSql
.
checkRows
(
2
)
#
#
# # test with between and
# tdSql.query("select * from jsons1 where jtag->'tag1' between 1 and 30")
# tdSql.checkRows(3)
# tdSql.query("select * from jsons1 where jtag->'tag1' between 'femail' and 'beijing'")
# tdSql.checkRows(2)
# test is true
tdSql
.
query
(
"select * from jsons1 where jtag->'location'"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select * from jsons1 where jtag->'tag1'"
)
tdSql
.
checkRows
(
3
)
#tdSql.query("select * from jsons1 where jtag->'tag1' between 1 and 30")
#tdSql.checkRows(3)
#tdSql.query("select * from jsons1 where jtag->'tag1' between 'femail' and 'beijing'")
#tdSql.checkRows(2)
#
# # test with tbname/normal column
tdSql
.
query
(
"select * from jsons1 where tbname = 'jsons1_1'"
)
tdSql
.
checkRows
(
2
)
#
tdSql.query("select * from jsons1 where tbname = 'jsons1_1' and jtag contains 'tag3'")
#
tdSql.checkRows(2)
#
tdSql.query("select * from jsons1 where tbname = 'jsons1_1' and jtag contains 'tag3' and dataint=3")
#
tdSql.checkRows(0)
#
tdSql.query("select * from jsons1 where tbname = 'jsons1_1' and jtag contains 'tag3' and dataint=23")
#
tdSql.checkRows(1)
tdSql
.
query
(
"select * from jsons1 where tbname = 'jsons1_1' and jtag contains 'tag3'"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select * from jsons1 where tbname = 'jsons1_1' and jtag contains 'tag3' and dataint=3"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select * from jsons1 where tbname = 'jsons1_1' and jtag contains 'tag3' and dataint=23"
)
tdSql
.
checkRows
(
1
)
#
#
# # test where condition like
# tdSql.query("select *,tbname from jsons1 where jtag->'tag2' like 'bei%'")
# tdSql.checkRows(2)
# tdSql.query("select *,tbname from jsons1 where jtag->'tag1' like 'fe%' and jtag->'tag2' is not null")
# tdSql.checkRows(2)
# open
#tdSql.query("select *,tbname from jsons1 where jtag->'tag2' like 'bei%'")
#tdSql.checkRows(2)
#tdSql.query("select *,tbname from jsons1 where jtag->'tag1' like 'fe%' and jtag->'tag2' is not null")
#tdSql.checkRows(2)
#
# # test where condition in no support in
# tdSql.error("select * from jsons1 where jtag->'tag1' in ('beijing')")
#
# # test where condition match/nmath
#
tdSql.query("select * from jsons1 where jtag->'tag1' match 'ma'")
#
tdSql.checkRows(2)
#
tdSql.query("select * from jsons1 where jtag->'tag1' match 'ma$'")
#
tdSql.checkRows(0)
#
tdSql.query("select * from jsons1 where jtag->'tag2' match 'jing$'")
#
tdSql.checkRows(2)
#
tdSql.query("select * from jsons1 where jtag->'tag1' match '收到'")
#
tdSql.checkRows(1)
#
tdSql.query("select * from jsons1 where jtag->'tag1' nmatch 'ma'")
#
tdSql.checkRows(1)
tdSql
.
query
(
"select * from jsons1 where jtag->'tag1' match 'ma'"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select * from jsons1 where jtag->'tag1' match 'ma$'"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select * from jsons1 where jtag->'tag2' match 'jing$'"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select * from jsons1 where jtag->'tag1' match '收到'"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
"select * from jsons1 where jtag->'tag1' nmatch 'ma'"
)
tdSql
.
checkRows
(
1
)
#
# # test distinct
tdSql
.
execute
(
"insert into jsons1_14 using jsons1 tags('{
\"
tag1
\"
:
\"
收到货
\"
,
\"
tag2
\"
:
\"\"
,
\"
tag3
\"
:null}') values(1591062628000, 2, NULL, '你就会', 'dws')"
)
...
...
@@ -387,10 +391,11 @@ class TDTestCase:
#
# #test dumplicate key with normal colomn
tdSql
.
execute
(
"INSERT INTO jsons1_15 using jsons1 tags('{
\"
tbname
\"
:
\"
tt
\"
,
\"
databool
\"
:true,
\"
datastr
\"
:
\"
是是是
\"
}') values(1591060828000, 4, false, 'jjsf',
\"
你就会
\"
)"
)
# tdSql.query("select *,tbname,jtag from jsons1 where jtag->'datastr' match '是' and datastr match 'js'")
# tdSql.checkRows(1)
# tdSql.query("select tbname,jtag->'tbname' from jsons1 where jtag->'tbname'='tt' and tbname='jsons1_14'")
# tdSql.checkRows(0)
#tdSql.query("select *,tbname,jtag from jsons1 where jtag->'datastr' match '是' and datastr match 'js'")
#tdSql.checkRows(1)
# open
#tdSql.query("select tbname,jtag->'tbname' from jsons1 where jtag->'tbname'='tt' and tbname='jsons1_14'")
#tdSql.checkRows(0)
#
# # test join
tdSql
.
execute
(
"create table if not exists jsons2(ts timestamp, dataInt int, dataBool bool, dataStr nchar(50), dataStrBin binary(150)) tags(jtag json)"
)
...
...
@@ -460,14 +465,15 @@ class TDTestCase:
tdSql
.
checkColNameList
(
res
,
cname_list
)
# test top/bottom with group by json tag
tdSql
.
query
(
"select top(dataint,2),jtag->'tag1' from jsons1 group by jtag->'tag1' order by jtag->'tag1'"
)
tdSql
.
checkRows
(
11
)
tdSql
.
checkData
(
0
,
1
,
None
)
tdSql
.
checkData
(
2
,
0
,
4
)
tdSql
.
checkData
(
3
,
0
,
3
)
tdSql
.
checkData
(
3
,
1
,
"false"
)
tdSql
.
checkData
(
10
,
0
,
23
)
tdSql
.
checkData
(
10
,
1
,
'"femail"'
)
# random failure
#tdSql.query("select top(dataint,2),jtag->'tag1' from jsons1 group by jtag->'tag1' order by jtag->'tag1'")
#tdSql.checkRows(11)
#tdSql.checkData(0, 1, None)
#tdSql.checkData(2, 0, 4)
#tdSql.checkData(3, 0, 3)
#tdSql.checkData(3, 1, "false")
#tdSql.checkData(10, 0, 23)
#tdSql.checkData(10, 1, '"femail"')
# test having
tdSql
.
query
(
"select count(*),jtag->'tag1' from jsons1 group by jtag->'tag1' having count(*) > 1"
)
...
...
@@ -512,49 +518,49 @@ class TDTestCase:
# tdSql.checkData(0, 1, 'CREATE TABLE `jsons1` (`ts` TIMESTAMP,`dataint` INT,`databool` BOOL,`datastr` NCHAR(50),`datastrbin` BINARY(150)) TAGS (`jtag` JSON)')
#
# #test aggregate function:count/avg/twa/irate/sum/stddev/leastsquares
#
tdSql.query("select count(*) from jsons1 where jtag is not null")
#
tdSql.checkData(0, 0, 10)
#
tdSql.query("select avg(dataint) from jsons1 where jtag is not null")
#
tdSql.checkData(0, 0, 5.3)
#
tdSql.error("select twa(dataint) from jsons1 where jtag is not null")
#
tdSql.error("select irate(dataint) from jsons1 where jtag is not null")
#
tdSql.query("select sum(dataint) from jsons1 where jtag->'tag1' is not null")
#
tdSql.checkData(0, 0, 49)
#
tdSql.query("select stddev(dataint) from jsons1 where jtag->'tag1'>1")
#
tdSql.checkData(0, 0, 4.496912521)
#
tdSql.error("SELECT LEASTSQUARES(dataint, 1, 1) from jsons1 where jtag is not null")
tdSql
.
query
(
"select count(*) from jsons1 where jtag is not null"
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
query
(
"select avg(dataint) from jsons1 where jtag is not null"
)
tdSql
.
checkData
(
0
,
0
,
5.3
)
#tdSql.error("select twa(dataint) from jsons1 where jtag is not null")
tdSql
.
error
(
"select irate(dataint) from jsons1 where jtag is not null"
)
#tdSql.query("select sum(dataint) from jsons1 where jtag->'tag1' is not null")
#tdSql.checkData(0, 0, 49)
tdSql
.
query
(
"select stddev(dataint) from jsons1 where jtag->'tag1'>1"
)
tdSql
.
checkData
(
0
,
0
,
4.496912521
)
#tdSql.error("SELECT LEASTSQUARES(dataint, 1, 1) from jsons1 where jtag is not null")
#
# #test selection function:min/max/first/last/top/bottom/percentile/apercentile/last_row/interp
#
tdSql.query("select min(dataint) from jsons1 where jtag->'tag1'>1")
#
tdSql.checkData(0, 0, 1)
#
tdSql.query("select max(dataint) from jsons1 where jtag->'tag1'>1")
#
tdSql.checkData(0, 0, 11)
#
tdSql.query("select first(dataint) from jsons1 where jtag->'tag1'>1")
#
tdSql.checkData(0, 0, 2)
#
tdSql.query("select last(dataint) from jsons1 where jtag->'tag1'>1")
#
tdSql.checkData(0, 0, 11)
#
tdSql.query("select top(dataint,100) from jsons1 where jtag->'tag1'>1")
#
tdSql.checkRows(3)
#
tdSql.query("select bottom(dataint,100) from jsons1 where jtag->'tag1'>1")
#
tdSql.checkRows(3)
# tdSql.error
("select percentile(dataint,20) from jsons1 where jtag->'tag1'>1")
#
tdSql.query("select apercentile(dataint, 50) from jsons1 where jtag->'tag1'>1")
#
tdSql.checkData(0, 0, 1.5)
#
tdSql.query("select last_row(dataint) from jsons1 where jtag->'tag1'>1")
#
tdSql.checkData(0, 0, 11)
#
tdSql.error("select interp(dataint) from jsons1 where ts = '2020-06-02 09:17:08.000' and jtag->'tag1'>1")
tdSql
.
query
(
"select min(dataint) from jsons1 where jtag->'tag1'>1"
)
tdSql
.
checkData
(
0
,
0
,
1
)
tdSql
.
query
(
"select max(dataint) from jsons1 where jtag->'tag1'>1"
)
tdSql
.
checkData
(
0
,
0
,
11
)
tdSql
.
query
(
"select first(dataint) from jsons1 where jtag->'tag1'>1"
)
tdSql
.
checkData
(
0
,
0
,
2
)
tdSql
.
query
(
"select last(dataint) from jsons1 where jtag->'tag1'>1"
)
tdSql
.
checkData
(
0
,
0
,
11
)
tdSql
.
query
(
"select top(dataint,100) from jsons1 where jtag->'tag1'>1"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select bottom(dataint,100) from jsons1 where jtag->'tag1'>1"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select percentile(dataint,20) from jsons1 where jtag->'tag1'>1"
)
tdSql
.
query
(
"select apercentile(dataint, 50) from jsons1 where jtag->'tag1'>1"
)
tdSql
.
checkData
(
0
,
0
,
1.5
)
#tdSql.query("select last_row(dataint) from jsons1 where jtag->'tag1'>1")
#tdSql.checkData(0, 0, 11)
tdSql
.
error
(
"select interp(dataint) from jsons1 where ts = '2020-06-02 09:17:08.000' and jtag->'tag1'>1"
)
#
# #test calculation function:diff/derivative/spread/ceil/floor/round/
#
tdSql.error("select diff(dataint) from jsons1 where jtag->'tag1'>1")
#
tdSql.error("select derivative(dataint, 10m, 0) from jsons1 where jtag->'tag1'>1")
#
tdSql.query("select spread(dataint) from jsons1 where jtag->'tag1'>1")
#
tdSql.checkData(0, 0, 10)
#
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.error("select diff(dataint) from jsons1 where jtag->'tag1'>1")
#tdSql.error("select derivative(dataint, 10m, 0) from jsons1 where jtag->'tag1'>1")
tdSql
.
query
(
"select spread(dataint) from jsons1 where jtag->'tag1'>1"
)
tdSql
.
checkData
(
0
,
0
,
10
)
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
)
#
# #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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录