Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5a8172d6
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
5a8172d6
编写于
10月 11, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
10月 11, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #17298 from taosdata/fix/glzhao_coverity
fix: fix coverity issues
上级
e058d28f
e5c3ff71
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
125 addition
and
86 deletion
+125
-86
docs/examples/c/tmq_example.c
docs/examples/c/tmq_example.c
+40
-8
source/common/src/tdataformat.c
source/common/src/tdataformat.c
+4
-4
source/common/src/ttszip.c
source/common/src/ttszip.c
+6
-3
source/libs/scalar/src/filter.c
source/libs/scalar/src/filter.c
+1
-1
source/libs/scalar/src/scalar.c
source/libs/scalar/src/scalar.c
+5
-1
source/libs/scalar/src/sclfunc.c
source/libs/scalar/src/sclfunc.c
+1
-1
source/libs/scalar/src/sclvector.c
source/libs/scalar/src/sclvector.c
+68
-68
未找到文件。
docs/examples/c/tmq_example.c
浏览文件 @
5a8172d6
...
@@ -184,22 +184,54 @@ void tmq_commit_cb_print(tmq_t* tmq, int32_t code, void* param) {
...
@@ -184,22 +184,54 @@ void tmq_commit_cb_print(tmq_t* tmq, int32_t code, void* param) {
tmq_t
*
build_consumer
()
{
tmq_t
*
build_consumer
()
{
tmq_conf_res_t
code
;
tmq_conf_res_t
code
;
tmq_conf_t
*
conf
=
tmq_conf_new
();
tmq_conf_t
*
conf
=
tmq_conf_new
();
code
=
tmq_conf_set
(
conf
,
"enable.auto.commit"
,
"true"
);
code
=
tmq_conf_set
(
conf
,
"enable.auto.commit"
,
"true"
);
if
(
TMQ_CONF_OK
!=
code
)
return
NULL
;
if
(
TMQ_CONF_OK
!=
code
)
{
tmq_conf_destroy
(
conf
);
return
NULL
;
}
code
=
tmq_conf_set
(
conf
,
"auto.commit.interval.ms"
,
"1000"
);
code
=
tmq_conf_set
(
conf
,
"auto.commit.interval.ms"
,
"1000"
);
if
(
TMQ_CONF_OK
!=
code
)
return
NULL
;
if
(
TMQ_CONF_OK
!=
code
)
{
tmq_conf_destroy
(
conf
);
return
NULL
;
}
code
=
tmq_conf_set
(
conf
,
"group.id"
,
"cgrpName"
);
code
=
tmq_conf_set
(
conf
,
"group.id"
,
"cgrpName"
);
if
(
TMQ_CONF_OK
!=
code
)
return
NULL
;
if
(
TMQ_CONF_OK
!=
code
)
{
tmq_conf_destroy
(
conf
);
return
NULL
;
}
code
=
tmq_conf_set
(
conf
,
"client.id"
,
"user defined name"
);
code
=
tmq_conf_set
(
conf
,
"client.id"
,
"user defined name"
);
if
(
TMQ_CONF_OK
!=
code
)
return
NULL
;
if
(
TMQ_CONF_OK
!=
code
)
{
tmq_conf_destroy
(
conf
);
return
NULL
;
}
code
=
tmq_conf_set
(
conf
,
"td.connect.user"
,
"root"
);
code
=
tmq_conf_set
(
conf
,
"td.connect.user"
,
"root"
);
if
(
TMQ_CONF_OK
!=
code
)
return
NULL
;
if
(
TMQ_CONF_OK
!=
code
)
{
tmq_conf_destroy
(
conf
);
return
NULL
;
}
code
=
tmq_conf_set
(
conf
,
"td.connect.pass"
,
"taosdata"
);
code
=
tmq_conf_set
(
conf
,
"td.connect.pass"
,
"taosdata"
);
if
(
TMQ_CONF_OK
!=
code
)
return
NULL
;
if
(
TMQ_CONF_OK
!=
code
)
{
tmq_conf_destroy
(
conf
);
return
NULL
;
}
code
=
tmq_conf_set
(
conf
,
"auto.offset.reset"
,
"earliest"
);
code
=
tmq_conf_set
(
conf
,
"auto.offset.reset"
,
"earliest"
);
if
(
TMQ_CONF_OK
!=
code
)
return
NULL
;
if
(
TMQ_CONF_OK
!=
code
)
{
tmq_conf_destroy
(
conf
);
return
NULL
;
}
code
=
tmq_conf_set
(
conf
,
"experimental.snapshot.enable"
,
"false"
);
code
=
tmq_conf_set
(
conf
,
"experimental.snapshot.enable"
,
"false"
);
if
(
TMQ_CONF_OK
!=
code
)
return
NULL
;
if
(
TMQ_CONF_OK
!=
code
)
{
tmq_conf_destroy
(
conf
);
return
NULL
;
}
tmq_conf_set_auto_commit_cb
(
conf
,
tmq_commit_cb_print
,
NULL
);
tmq_conf_set_auto_commit_cb
(
conf
,
tmq_commit_cb_print
,
NULL
);
...
...
source/common/src/tdataformat.c
浏览文件 @
5a8172d6
...
@@ -411,7 +411,7 @@ _exit:
...
@@ -411,7 +411,7 @@ _exit:
int32_t
tTSRowClone
(
const
STSRow2
*
pRow
,
STSRow2
**
ppRow
)
{
int32_t
tTSRowClone
(
const
STSRow2
*
pRow
,
STSRow2
**
ppRow
)
{
int32_t
code
=
0
;
int32_t
code
=
0
;
int32_t
rLen
;
int32_t
rLen
=
0
;
TSROW_LEN
(
pRow
,
rLen
);
TSROW_LEN
(
pRow
,
rLen
);
(
*
ppRow
)
=
(
STSRow2
*
)
taosMemoryMalloc
(
rLen
);
(
*
ppRow
)
=
(
STSRow2
*
)
taosMemoryMalloc
(
rLen
);
...
@@ -1678,8 +1678,8 @@ int32_t tColDataCopy(SColData *pColDataSrc, SColData *pColDataDest) {
...
@@ -1678,8 +1678,8 @@ int32_t tColDataCopy(SColData *pColDataSrc, SColData *pColDataDest) {
int32_t
size
;
int32_t
size
;
ASSERT
(
pColDataSrc
->
nVal
>
0
);
ASSERT
(
pColDataSrc
->
nVal
>
0
);
ASSERT
(
pColDataDest
->
cid
=
pColDataSrc
->
cid
);
ASSERT
(
pColDataDest
->
cid
=
=
pColDataSrc
->
cid
);
ASSERT
(
pColDataDest
->
type
=
pColDataSrc
->
type
);
ASSERT
(
pColDataDest
->
type
=
=
pColDataSrc
->
type
);
pColDataDest
->
smaOn
=
pColDataSrc
->
smaOn
;
pColDataDest
->
smaOn
=
pColDataSrc
->
smaOn
;
pColDataDest
->
nVal
=
pColDataSrc
->
nVal
;
pColDataDest
->
nVal
=
pColDataSrc
->
nVal
;
...
...
source/common/src/ttszip.c
浏览文件 @
5a8172d6
...
@@ -52,10 +52,13 @@ STSBuf* tsBufCreate(bool autoDelete, int32_t order) {
...
@@ -52,10 +52,13 @@ STSBuf* tsBufCreate(bool autoDelete, int32_t order) {
}
}
if
(
!
autoDelete
)
{
if
(
!
autoDelete
)
{
taosRemoveFile
(
pTSBuf
->
path
);
if
(
taosRemoveFile
(
pTSBuf
->
path
)
!=
0
)
{
taosMemoryFree
(
pTSBuf
);
return
NULL
;
}
}
}
if
(
NULL
==
allocResForTSBuf
(
pTSBuf
)
)
{
if
(
allocResForTSBuf
(
pTSBuf
)
==
NULL
)
{
return
NULL
;
return
NULL
;
}
}
...
...
source/libs/scalar/src/filter.c
浏览文件 @
5a8172d6
...
@@ -1939,7 +1939,7 @@ int32_t fltInitValFieldData(SFilterInfo *info) {
...
@@ -1939,7 +1939,7 @@ int32_t fltInitValFieldData(SFilterInfo *info) {
bytes
=
(
len
+
1
)
*
TSDB_NCHAR_SIZE
+
VARSTR_HEADER_SIZE
;
bytes
=
(
len
+
1
)
*
TSDB_NCHAR_SIZE
+
VARSTR_HEADER_SIZE
;
fi
->
data
=
taosMemoryCalloc
(
1
,
bytes
);
fi
->
data
=
taosMemoryCalloc
(
1
,
bytes
);
}
else
{
}
else
{
if
(
dType
->
type
==
TSDB_DATA_TYPE_VALUE_ARRAY
)
{
//TIME RANGE
if
(
dType
->
type
==
TSDB_DATA_TYPE_VALUE_ARRAY
)
{
//TIME RANGE
/*
/*
fi->data = taosMemoryCalloc(dType->bytes, tDataTypes[type].bytes);
fi->data = taosMemoryCalloc(dType->bytes, tDataTypes[type].bytes);
...
...
source/libs/scalar/src/scalar.c
浏览文件 @
5a8172d6
...
@@ -363,7 +363,11 @@ int32_t sclInitParam(SNode* node, SScalarParam *param, SScalarCtx *ctx, int32_t
...
@@ -363,7 +363,11 @@ int32_t sclInitParam(SNode* node, SScalarParam *param, SScalarCtx *ctx, int32_t
}
}
SSDataBlock
*
block
=
*
(
SSDataBlock
**
)
taosArrayGet
(
ctx
->
pBlockList
,
index
);
SSDataBlock
*
block
=
*
(
SSDataBlock
**
)
taosArrayGet
(
ctx
->
pBlockList
,
index
);
if
(
NULL
==
block
||
ref
->
slotId
>=
taosArrayGetSize
(
block
->
pDataBlock
))
{
if
(
NULL
==
block
)
{
SCL_ERR_RET
(
TSDB_CODE_QRY_INVALID_INPUT
);
}
if
(
ref
->
slotId
>=
taosArrayGetSize
(
block
->
pDataBlock
))
{
sclError
(
"column slotId is too big, slodId:%d, dataBlockSize:%d"
,
ref
->
slotId
,
(
int32_t
)
taosArrayGetSize
(
block
->
pDataBlock
));
sclError
(
"column slotId is too big, slodId:%d, dataBlockSize:%d"
,
ref
->
slotId
,
(
int32_t
)
taosArrayGetSize
(
block
->
pDataBlock
));
SCL_ERR_RET
(
TSDB_CODE_QRY_INVALID_INPUT
);
SCL_ERR_RET
(
TSDB_CODE_QRY_INVALID_INPUT
);
}
}
...
...
source/libs/scalar/src/sclfunc.c
浏览文件 @
5a8172d6
...
@@ -2002,7 +2002,7 @@ int32_t avgScalarFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *
...
@@ -2002,7 +2002,7 @@ int32_t avgScalarFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *
}
}
}
}
if
(
hasNull
)
{
if
(
hasNull
||
(
count
==
0
)
)
{
colDataAppendNULL
(
pOutputData
,
0
);
colDataAppendNULL
(
pOutputData
,
0
);
}
else
{
}
else
{
if
(
IS_SIGNED_NUMERIC_TYPE
(
type
))
{
if
(
IS_SIGNED_NUMERIC_TYPE
(
type
))
{
...
...
source/libs/scalar/src/sclvector.c
浏览文件 @
5a8172d6
...
@@ -529,24 +529,24 @@ void* ncharTobinary(void *buf){ // todo need to remove , if tobinary
...
@@ -529,24 +529,24 @@ void* ncharTobinary(void *buf){ // todo need to remove , if tobinary
bool
convertJsonValue
(
__compar_fn_t
*
fp
,
int32_t
optr
,
int8_t
typeLeft
,
int8_t
typeRight
,
char
**
pLeftData
,
char
**
pRightData
,
bool
convertJsonValue
(
__compar_fn_t
*
fp
,
int32_t
optr
,
int8_t
typeLeft
,
int8_t
typeRight
,
char
**
pLeftData
,
char
**
pRightData
,
void
*
pLeftOut
,
void
*
pRightOut
,
bool
*
isNull
,
bool
*
freeLeft
,
bool
*
freeRight
){
void
*
pLeftOut
,
void
*
pRightOut
,
bool
*
isNull
,
bool
*
freeLeft
,
bool
*
freeRight
){
if
(
optr
==
OP_TYPE_JSON_CONTAINS
)
{
if
(
optr
==
OP_TYPE_JSON_CONTAINS
)
{
return
true
;
return
true
;
}
}
if
(
typeLeft
!=
TSDB_DATA_TYPE_JSON
&&
typeRight
!=
TSDB_DATA_TYPE_JSON
)
{
if
(
typeLeft
!=
TSDB_DATA_TYPE_JSON
&&
typeRight
!=
TSDB_DATA_TYPE_JSON
)
{
return
true
;
return
true
;
}
}
if
(
typeLeft
==
TSDB_DATA_TYPE_JSON
)
{
if
(
typeLeft
==
TSDB_DATA_TYPE_JSON
)
{
if
(
tTagIsJson
(
*
pLeftData
))
{
if
(
tTagIsJson
(
*
pLeftData
))
{
terrno
=
TSDB_CODE_QRY_JSON_NOT_SUPPORT_ERROR
;
terrno
=
TSDB_CODE_QRY_JSON_NOT_SUPPORT_ERROR
;
return
false
;
return
false
;
}
}
typeLeft
=
**
pLeftData
;
typeLeft
=
**
pLeftData
;
(
*
pLeftData
)
++
;
(
*
pLeftData
)
++
;
}
}
if
(
typeRight
==
TSDB_DATA_TYPE_JSON
)
{
if
(
typeRight
==
TSDB_DATA_TYPE_JSON
)
{
if
(
tTagIsJson
(
*
pLeftData
))
{
if
(
tTagIsJson
(
*
pLeftData
))
{
terrno
=
TSDB_CODE_QRY_JSON_NOT_SUPPORT_ERROR
;
terrno
=
TSDB_CODE_QRY_JSON_NOT_SUPPORT_ERROR
;
return
false
;
return
false
;
}
}
...
@@ -554,14 +554,14 @@ bool convertJsonValue(__compar_fn_t *fp, int32_t optr, int8_t typeLeft, int8_t t
...
@@ -554,14 +554,14 @@ bool convertJsonValue(__compar_fn_t *fp, int32_t optr, int8_t typeLeft, int8_t t
(
*
pRightData
)
++
;
(
*
pRightData
)
++
;
}
}
if
(
optr
==
OP_TYPE_LIKE
||
optr
==
OP_TYPE_NOT_LIKE
||
optr
==
OP_TYPE_MATCH
||
optr
==
OP_TYPE_NMATCH
)
{
if
(
optr
==
OP_TYPE_LIKE
||
optr
==
OP_TYPE_NOT_LIKE
||
optr
==
OP_TYPE_MATCH
||
optr
==
OP_TYPE_NMATCH
)
{
if
(
typeLeft
!=
TSDB_DATA_TYPE_NCHAR
&&
typeLeft
!=
TSDB_DATA_TYPE_BINARY
)
{
if
(
typeLeft
!=
TSDB_DATA_TYPE_NCHAR
&&
typeLeft
!=
TSDB_DATA_TYPE_BINARY
)
{
return
false
;
return
false
;
}
}
}
}
// if types can not comparable
// if types can not comparable
if
((
IS_NUMERIC_TYPE
(
typeLeft
)
&&
!
IS_NUMERIC_TYPE
(
typeRight
))
||
if
((
IS_NUMERIC_TYPE
(
typeLeft
)
&&
!
IS_NUMERIC_TYPE
(
typeRight
))
||
(
IS_NUMERIC_TYPE
(
typeRight
)
&&
!
IS_NUMERIC_TYPE
(
typeLeft
))
||
(
IS_NUMERIC_TYPE
(
typeRight
)
&&
!
IS_NUMERIC_TYPE
(
typeLeft
))
||
(
IS_VAR_DATA_TYPE
(
typeLeft
)
&&
!
IS_VAR_DATA_TYPE
(
typeRight
))
||
(
IS_VAR_DATA_TYPE
(
typeLeft
)
&&
!
IS_VAR_DATA_TYPE
(
typeRight
))
||
(
IS_VAR_DATA_TYPE
(
typeRight
)
&&
!
IS_VAR_DATA_TYPE
(
typeLeft
))
||
(
IS_VAR_DATA_TYPE
(
typeRight
)
&&
!
IS_VAR_DATA_TYPE
(
typeLeft
))
||
...
@@ -570,55 +570,55 @@ bool convertJsonValue(__compar_fn_t *fp, int32_t optr, int8_t typeLeft, int8_t t
...
@@ -570,55 +570,55 @@ bool convertJsonValue(__compar_fn_t *fp, int32_t optr, int8_t typeLeft, int8_t t
return
false
;
return
false
;
if
(
typeLeft
==
TSDB_DATA_TYPE_NULL
||
typeRight
==
TSDB_DATA_TYPE_NULL
)
{
if
(
typeLeft
==
TSDB_DATA_TYPE_NULL
||
typeRight
==
TSDB_DATA_TYPE_NULL
)
{
*
isNull
=
true
;
*
isNull
=
true
;
return
true
;
return
true
;
}
}
int8_t
type
=
vectorGetConvertType
(
typeLeft
,
typeRight
);
int8_t
type
=
vectorGetConvertType
(
typeLeft
,
typeRight
);
if
(
type
==
0
)
{
if
(
type
==
0
)
{
*
fp
=
filterGetCompFunc
(
typeLeft
,
optr
);
*
fp
=
filterGetCompFunc
(
typeLeft
,
optr
);
return
true
;
return
true
;
}
}
*
fp
=
filterGetCompFunc
(
type
,
optr
);
*
fp
=
filterGetCompFunc
(
type
,
optr
);
if
(
IS_NUMERIC_TYPE
(
type
))
{
if
(
IS_NUMERIC_TYPE
(
type
))
{
if
(
typeLeft
==
TSDB_DATA_TYPE_NCHAR
)
{
if
(
typeLeft
==
TSDB_DATA_TYPE_NCHAR
)
{
ASSERT
(
0
);
ASSERT
(
0
);
// convertNcharToDouble(*pLeftData, pLeftOut);
// convertNcharToDouble(*pLeftData, pLeftOut);
// *pLeftData = pLeftOut;
// *pLeftData = pLeftOut;
}
else
if
(
typeLeft
==
TSDB_DATA_TYPE_BINARY
)
{
}
else
if
(
typeLeft
==
TSDB_DATA_TYPE_BINARY
)
{
ASSERT
(
0
);
ASSERT
(
0
);
// convertBinaryToDouble(*pLeftData, pLeftOut);
// convertBinaryToDouble(*pLeftData, pLeftOut);
// *pLeftData = pLeftOut;
// *pLeftData = pLeftOut;
}
else
if
(
typeLeft
!=
type
)
{
}
else
if
(
typeLeft
!=
type
)
{
convertNumberToNumber
(
*
pLeftData
,
pLeftOut
,
typeLeft
,
type
);
convertNumberToNumber
(
*
pLeftData
,
pLeftOut
,
typeLeft
,
type
);
*
pLeftData
=
pLeftOut
;
*
pLeftData
=
pLeftOut
;
}
}
if
(
typeRight
==
TSDB_DATA_TYPE_NCHAR
)
{
if
(
typeRight
==
TSDB_DATA_TYPE_NCHAR
)
{
ASSERT
(
0
);
ASSERT
(
0
);
// convertNcharToDouble(*pRightData, pRightOut);
// convertNcharToDouble(*pRightData, pRightOut);
// *pRightData = pRightOut;
// *pRightData = pRightOut;
}
else
if
(
typeRight
==
TSDB_DATA_TYPE_BINARY
)
{
}
else
if
(
typeRight
==
TSDB_DATA_TYPE_BINARY
)
{
ASSERT
(
0
);
ASSERT
(
0
);
// convertBinaryToDouble(*pRightData, pRightOut);
// convertBinaryToDouble(*pRightData, pRightOut);
// *pRightData = pRightOut;
// *pRightData = pRightOut;
}
else
if
(
typeRight
!=
type
)
{
}
else
if
(
typeRight
!=
type
)
{
convertNumberToNumber
(
*
pRightData
,
pRightOut
,
typeRight
,
type
);
convertNumberToNumber
(
*
pRightData
,
pRightOut
,
typeRight
,
type
);
*
pRightData
=
pRightOut
;
*
pRightData
=
pRightOut
;
}
}
}
else
if
(
type
==
TSDB_DATA_TYPE_BINARY
)
{
}
else
if
(
type
==
TSDB_DATA_TYPE_BINARY
)
{
if
(
typeLeft
==
TSDB_DATA_TYPE_NCHAR
)
{
if
(
typeLeft
==
TSDB_DATA_TYPE_NCHAR
)
{
*
pLeftData
=
ncharTobinary
(
*
pLeftData
);
*
pLeftData
=
ncharTobinary
(
*
pLeftData
);
*
freeLeft
=
true
;
*
freeLeft
=
true
;
}
}
if
(
typeRight
==
TSDB_DATA_TYPE_NCHAR
)
{
if
(
typeRight
==
TSDB_DATA_TYPE_NCHAR
)
{
*
pRightData
=
ncharTobinary
(
*
pRightData
);
*
pRightData
=
ncharTobinary
(
*
pRightData
);
*
freeRight
=
true
;
*
freeRight
=
true
;
}
}
}
else
{
}
else
{
ASSERT
(
0
);
ASSERT
(
0
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录