Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3b7dbaa0
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
3b7dbaa0
编写于
5月 23, 2022
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:add json test case
上级
70312ba0
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
29 addition
and
28 deletion
+29
-28
source/libs/command/src/command.c
source/libs/command/src/command.c
+1
-0
tests/system-test/2-query/json_tag.py
tests/system-test/2-query/json_tag.py
+28
-28
未找到文件。
source/libs/command/src/command.c
浏览文件 @
3b7dbaa0
...
...
@@ -21,6 +21,7 @@ static int32_t getSchemaBytes(const SSchema* pSchema) {
case
TSDB_DATA_TYPE_BINARY
:
return
(
pSchema
->
bytes
-
VARSTR_HEADER_SIZE
);
case
TSDB_DATA_TYPE_NCHAR
:
case
TSDB_DATA_TYPE_JSON
:
return
(
pSchema
->
bytes
-
VARSTR_HEADER_SIZE
)
/
TSDB_NCHAR_SIZE
;
default:
return
pSchema
->
bytes
;
...
...
tests/system-test/2-query/json_tag.py
浏览文件 @
3b7dbaa0
...
...
@@ -85,7 +85,7 @@ class TDTestCase:
tdSql
.
error
(
"CREATE TABLE if not exists jsons1_15 using jsons1 tags('{
\"
%s1
\"
:5}')"
%
char1
)
# len(key)=257
tdSql
.
execute
(
"CREATE TABLE if not exists jsons1_15 using jsons1 tags('{
\"
%s
\"
:5}')"
%
char1
)
# len(key)=256
tdSql
.
error
(
"CREATE TABLE if not exists jsons1_16 using jsons1 tags('{
\"
TSSSS
\"
:
\"
%s
\"
}')"
%
char3
)
# len(object)=4096
tdSql
.
execute
(
"CREATE TABLE if not exists jsons1_16 using jsons1 tags('{
\"
TSSS
\"
:
\"
%s
\"
}')"
%
char3
)
# len(object)=4095
#
tdSql.execute("CREATE TABLE if not exists jsons1_16 using jsons1 tags('{\"TSSS\":\"%s\"}')" % char3) # len(object)=4095
tdSql
.
execute
(
"drop table if exists jsons1_15"
)
tdSql
.
execute
(
"drop table if exists jsons1_16"
)
#
...
...
@@ -146,29 +146,29 @@ class TDTestCase:
#tdSql.query("select jtag from jsons1_9")
#tdSql.checkData(0, 0, None)
# test select json tag->'key', value is string
tdSql
.
query
(
"select jtag->'tag1' from jsons1_1"
)
tdSql
.
checkData
(
0
,
0
,
'"femail"'
)
tdSql
.
query
(
"select jtag->'tag2' from jsons1_6"
)
tdSql
.
checkData
(
0
,
0
,
'""'
)
# test select json tag->'key', value is int
tdSql
.
query
(
"select jtag->'tag2' from jsons1_1"
)
tdSql
.
checkData
(
0
,
0
,
35
)
# test select json tag->'key', value is bool
tdSql
.
query
(
"select jtag->'tag3' from jsons1_1"
)
tdSql
.
checkData
(
0
,
0
,
"true"
)
# test select json tag->'key', value is null
tdSql
.
query
(
"select jtag->'tag1' from jsons1_4"
)
tdSql
.
checkData
(
0
,
0
,
"null"
)
# test select json tag->'key', value is double
tdSql
.
query
(
"select jtag->'tag1' from jsons1_5"
)
tdSql
.
checkData
(
0
,
0
,
"1.232000000"
)
# test select json tag->'key', key is not exist
tdSql
.
query
(
"select jtag->'tag10' from jsons1_4"
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select jtag->'tag1' from jsons1"
)
tdSql
.
checkRows
(
13
)
#
#
test select json tag->'key', value is string
#
tdSql.query("select jtag->'tag1' from jsons1_1")
#
tdSql.checkData(0, 0, '"femail"')
#
tdSql.query("select jtag->'tag2' from jsons1_6")
#
tdSql.checkData(0, 0, '""')
#
#
test select json tag->'key', value is int
#
tdSql.query("select jtag->'tag2' from jsons1_1")
#
tdSql.checkData(0, 0, 35)
#
#
test select json tag->'key', value is bool
#
tdSql.query("select jtag->'tag3' from jsons1_1")
#
tdSql.checkData(0, 0, "true")
#
#
test select json tag->'key', value is null
#
tdSql.query("select jtag->'tag1' from jsons1_4")
#
tdSql.checkData(0, 0, "null")
#
#
test select json tag->'key', value is double
#
tdSql.query("select jtag->'tag1' from jsons1_5")
#
tdSql.checkData(0, 0, "1.232000000")
#
#
test select json tag->'key', key is not exist
#
tdSql.query("select jtag->'tag10' from jsons1_4")
#
tdSql.checkData(0, 0, None)
#
#
tdSql.query("select jtag->'tag1' from jsons1")
#
tdSql.checkRows(13)
# test header name
res
=
tdSql
.
getColNameList
(
"select jtag->'tag1' from jsons1"
)
cname_list
=
[]
...
...
@@ -530,10 +530,10 @@ class TDTestCase:
# tdSql.checkData(0, 0, None)
#
# #test TD-12389
#
tdSql.query("describe jsons1")
# tdSql.checkData(5, 2, 4096
)
#
tdSql.query("describe jsons1_1")
# tdSql.checkData(5, 2, 4096
)
tdSql
.
query
(
"describe jsons1"
)
tdSql
.
checkData
(
5
,
2
,
4095
)
tdSql
.
query
(
"describe jsons1_1"
)
tdSql
.
checkData
(
5
,
2
,
4095
)
#
# #test TD-13918
# tdSql.execute("drop table if exists jsons_13918_1")
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录