Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
eb13ade6
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看板
提交
eb13ade6
编写于
10月 01, 2021
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-6129<feature> add tag?'key' in where logic
上级
2b419e64
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
17 addition
and
2 deletion
+17
-2
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+1
-1
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+2
-1
src/inc/taoserror.h
src/inc/taoserror.h
+1
-0
src/query/src/qFilter.c
src/query/src/qFilter.c
+3
-0
src/util/src/terror.c
src/util/src/terror.c
+2
-0
tests/pytest/stable/json_tag.py
tests/pytest/stable/json_tag.py
+8
-0
未找到文件。
src/client/src/tscParseInsert.c
浏览文件 @
eb13ade6
...
...
@@ -1117,7 +1117,7 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql, char** boundC
char
tmp
[
128
]
=
{
0
};
sprintf
(
tmp
,
"tag value is too small, can not contain encoded json tag:%d|%d"
,
kvRowLen
(
row
),
pTagSchema
[
spd
.
boundedColumns
[
0
]].
bytes
);
tscDestroyBoundColumnInfo
(
&
spd
);
return
tsc
SQLSyntaxErr
Msg
(
pInsertParam
->
msg
,
tmp
,
NULL
);
return
tsc
InvalidOperation
Msg
(
pInsertParam
->
msg
,
tmp
,
NULL
);
}
}
tscDestroyBoundColumnInfo
(
&
spd
);
...
...
src/client/src/tscSQLParser.c
浏览文件 @
eb13ade6
...
...
@@ -4453,6 +4453,7 @@ static int32_t validateMatchExpr(tSqlExpr* pExpr, STableMeta* pTableMeta, int32_
const
char
*
msg1
=
"regular expression string should be less than %d characters"
;
const
char
*
msg2
=
"illegal column type for match/nmatch"
;
const
char
*
msg3
=
"invalid regular expression"
;
const
char
*
msg4
=
"json column type must encode by binary for match/nmatch"
;
tSqlExpr
*
pLeft
=
pExpr
->
pLeft
;
tSqlExpr
*
pRight
=
pExpr
->
pRight
;
...
...
@@ -4471,7 +4472,7 @@ static int32_t validateMatchExpr(tSqlExpr* pExpr, STableMeta* pTableMeta, int32_
}
if
(
pLeft
->
tokenId
==
TK_ARROW
&&
pSchema
[
index
].
type
==
TSDB_DATA_TYPE_JSON
&&
!
JSON_TYPE_BINARY
){
return
invalidOperationMsg
(
msgBuf
,
msg
2
);
return
invalidOperationMsg
(
msgBuf
,
msg
4
);
}
if
(
!
(
pRight
->
type
==
SQL_NODE_VALUE
&&
pRight
->
value
.
nType
==
TSDB_DATA_TYPE_BINARY
))
{
...
...
src/inc/taoserror.h
浏览文件 @
eb13ade6
...
...
@@ -290,6 +290,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_QRY_SYS_ERROR TAOS_DEF_ERROR_CODE(0, 0x070E) //"System error")
#define TSDB_CODE_QRY_JSON_KEY_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x070F) //"json tag key not exist")
#define TSDB_CODE_QRY_JSON_KEY_TYPE_ERROR TAOS_DEF_ERROR_CODE(0, 0x0710) //"json tag key type not match")
#define TSDB_CODE_QRY_JSON_KEY_NOT_STR_ERROR TAOS_DEF_ERROR_CODE(0, 0x0711) //"json tag key must be string in match/nmatch")
// grant
#define TSDB_CODE_GRANT_EXPIRED TAOS_DEF_ERROR_CODE(0, 0x0800) //"License expired")
...
...
src/query/src/qFilter.c
浏览文件 @
eb13ade6
...
...
@@ -3213,6 +3213,9 @@ int filterJsonTypeConvert(SFilterInfo* info) {
SFilterField
*
colLeft
=
FILTER_UNIT_LEFT_FIELD
(
info
,
&
info
->
units
[
i
]);
info
->
units
[
i
].
compare
.
type
=
FILTER_GET_COL_FIELD_TYPE
(
colLeft
);
if
((
info
->
units
[
i
].
compare
.
optr
==
TSDB_RELATION_MATCH
||
info
->
units
[
i
].
compare
.
optr
==
TSDB_RELATION_NMATCH
)
&&
info
->
units
[
i
].
compare
.
type
!=
TSDB_DATA_TYPE_BINARY
)
return
TSDB_CODE_QRY_JSON_KEY_NOT_STR_ERROR
;
// SFilterField *colRight = FILTER_UNIT_RIGHT_FIELD(info, &info->units[i]);
// tVariant* var = colRight->desc;
// if(!tVariantTypeMatch(var, info->units[i].compare.type))
...
...
src/util/src/terror.c
浏览文件 @
eb13ade6
...
...
@@ -296,6 +296,8 @@ TAOS_DEFINE_ERROR(TSDB_CODE_QRY_INVALID_TIME_CONDITION, "One valid time range
TAOS_DEFINE_ERROR
(
TSDB_CODE_QRY_SYS_ERROR
,
"System error"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_QRY_JSON_KEY_NOT_EXIST
,
"json tag key not exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_QRY_JSON_KEY_TYPE_ERROR
,
"json tag key type not match"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_QRY_JSON_KEY_NOT_STR_ERROR
,
"json tag key must be string in match/nmatch"
)
// grant
TAOS_DEFINE_ERROR
(
TSDB_CODE_GRANT_EXPIRED
,
"License expired"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_GRANT_DNODE_LIMITED
,
"DNode creation limited by licence"
)
...
...
tests/pytest/stable/json_tag.py
浏览文件 @
eb13ade6
...
...
@@ -154,7 +154,15 @@ class TDTestCase:
tdSql
.
query
(
"select * from db_json_tag_test.jsons1 where jtag->'location' in ('shanghai') and jtag->'class'=55"
)
tdSql
.
checkRows
(
1
)
# test where condition match
tdSql
.
query
(
"select * from db_json_tag_test.jsons1 where jtag->'location' match 'jin$'"
)
tdSql
.
checkRows
(
0
)
tdSql
.
query
(
"select * from db_json_tag_test.jsons1 where jtag->'location' match 'jin'"
)
tdSql
.
checkRows
(
2
)
tdSql
.
error
(
"select * from db_json_tag_test.jsons1 where jtag->'num' match '5'"
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录