Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
cf00cc38
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看板
提交
cf00cc38
编写于
5月 23, 2022
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:fix json error
上级
a3898d3a
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
3877 addition
and
3877 deletion
+3877
-3877
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+1
-0
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+3871
-3872
source/libs/scalar/test/scalar/scalarTests.cpp
source/libs/scalar/test/scalar/scalarTests.cpp
+1
-1
tests/system-test/2-query/json_tag.py
tests/system-test/2-query/json_tag.py
+4
-4
未找到文件。
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
cf00cc38
...
...
@@ -1117,6 +1117,7 @@ bool nodesIsComparisonOp(const SOperatorNode* pOp) {
bool
nodesIsJsonOp
(
const
SOperatorNode
*
pOp
)
{
switch
(
pOp
->
opType
)
{
case
OP_TYPE_JSON_GET_VALUE
:
case
OP_TYPE_JSON_CONTAINS
:
return
true
;
default:
break
;
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
cf00cc38
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "parInt.h"
...
...
@@ -726,8 +726,7 @@ static EDealRes translateUnaryOperator(STranslateContext* pCxt, SOperatorNode* p
static
EDealRes
translateArithmeticOperator
(
STranslateContext
*
pCxt
,
SOperatorNode
*
pOp
)
{
SDataType
ldt
=
((
SExprNode
*
)(
pOp
->
pLeft
))
->
resType
;
SDataType
rdt
=
((
SExprNode
*
)(
pOp
->
pRight
))
->
resType
;
if
(
TSDB_DATA_TYPE_JSON
==
ldt
.
type
||
TSDB_DATA_TYPE_BLOB
==
ldt
.
type
||
TSDB_DATA_TYPE_JSON
==
rdt
.
type
||
TSDB_DATA_TYPE_BLOB
==
rdt
.
type
)
{
if
(
TSDB_DATA_TYPE_BLOB
==
ldt
.
type
||
TSDB_DATA_TYPE_BLOB
==
rdt
.
type
)
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
((
SExprNode
*
)(
pOp
->
pRight
))
->
aliasName
);
}
if
((
TSDB_DATA_TYPE_TIMESTAMP
==
ldt
.
type
&&
TSDB_DATA_TYPE_TIMESTAMP
==
rdt
.
type
)
||
...
...
@@ -752,14 +751,14 @@ static EDealRes translateArithmeticOperator(STranslateContext* pCxt, SOperatorNo
static
EDealRes
translateComparisonOperator
(
STranslateContext
*
pCxt
,
SOperatorNode
*
pOp
)
{
SDataType
ldt
=
((
SExprNode
*
)(
pOp
->
pLeft
))
->
resType
;
SDataType
rdt
=
((
SExprNode
*
)(
pOp
->
pRight
))
->
resType
;
if
(
TSDB_DATA_TYPE_BLOB
==
ldt
.
type
||
TSDB_DATA_TYPE_JSON
==
r
dt
.
type
||
TSDB_DATA_TYPE_BLOB
==
rdt
.
type
)
{
if
(
TSDB_DATA_TYPE_BLOB
==
l
dt
.
type
||
TSDB_DATA_TYPE_BLOB
==
rdt
.
type
)
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
((
SExprNode
*
)(
pOp
->
pRight
))
->
aliasName
);
}
if
(
OP_TYPE_IN
==
pOp
->
opType
||
OP_TYPE_NOT_IN
==
pOp
->
opType
)
{
((
SExprNode
*
)
pOp
->
pRight
)
->
resType
=
((
SExprNode
*
)
pOp
->
pLeft
)
->
resType
;
}
if
(
nodesIsRegularOp
(
pOp
))
{
if
(
!
IS_ST
R_DATA_TYPE
(((
SExprNode
*
)(
pOp
->
pLeft
))
->
resType
.
type
))
{
if
(
!
IS_VA
R_DATA_TYPE
(((
SExprNode
*
)(
pOp
->
pLeft
))
->
resType
.
type
))
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
((
SExprNode
*
)(
pOp
->
pLeft
))
->
aliasName
);
}
if
(
QUERY_NODE_VALUE
!=
nodeType
(
pOp
->
pRight
)
||
!
IS_STR_DATA_TYPE
(((
SExprNode
*
)(
pOp
->
pRight
))
->
resType
.
type
))
{
...
...
source/libs/scalar/test/scalar/scalarTests.cpp
浏览文件 @
cf00cc38
...
...
@@ -1089,7 +1089,7 @@ void makeCalculate(void *json, void *key, int32_t rightType, void *rightData, do
}
else
if
(
opType
==
OP_TYPE_ADD
||
opType
==
OP_TYPE_SUB
||
opType
==
OP_TYPE_MULTI
||
opType
==
OP_TYPE_DIV
||
opType
==
OP_TYPE_MOD
||
opType
==
OP_TYPE_MINUS
){
printf
(
"1result:%f,except:%f
\n
"
,
*
((
double
*
)
colDataGetData
(
column
,
0
)),
exceptValue
);
ASSERT_TRUE
(
abs
(
*
((
double
*
)
colDataGetData
(
column
,
0
))
-
exceptValue
)
<
1e-15
);
ASSERT_TRUE
(
fabs
(
*
((
double
*
)
colDataGetData
(
column
,
0
))
-
exceptValue
)
<
DBL_EPSILON
);
}
else
if
(
opType
==
OP_TYPE_BIT_AND
||
opType
==
OP_TYPE_BIT_OR
){
printf
(
"2result:%ld,except:%f
\n
"
,
*
((
int64_t
*
)
colDataGetData
(
column
,
0
)),
exceptValue
);
ASSERT_EQ
(
*
((
int64_t
*
)
colDataGetData
(
column
,
0
)),
exceptValue
);
...
...
tests/system-test/2-query/json_tag.py
浏览文件 @
cf00cc38
...
...
@@ -130,17 +130,17 @@ class TDTestCase:
# test select json tag
tdSql
.
query
(
"select * from jsons1"
)
tdSql
.
checkRows
(
9
)
tdSql
.
checkRows
(
8
)
tdSql
.
query
(
"select jtag from jsons1"
)
tdSql
.
checkRows
(
13
)
tdSql
.
checkRows
(
7
)
# 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)
# test jtag is NULL
tdSql
.
query
(
"select jtag from jsons1_9"
)
tdSql
.
checkData
(
0
,
0
,
None
)
#
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"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录