Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
eaed6da8
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
eaed6da8
编写于
7月 27, 2021
作者:
M
markswang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-5534]<fix>:fix the coverity high risk of client
上级
a960f0ff
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
40 addition
and
16 deletion
+40
-16
src/client/src/tscGlobalmerge.c
src/client/src/tscGlobalmerge.c
+6
-1
src/client/src/tscSql.c
src/client/src/tscSql.c
+9
-1
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+2
-1
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+6
-2
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+1
-0
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+12
-11
src/query/src/qPlan.c
src/query/src/qPlan.c
+4
-0
未找到文件。
src/client/src/tscGlobalmerge.c
浏览文件 @
eaed6da8
...
...
@@ -135,7 +135,7 @@ int32_t tscCreateGlobalMerger(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, t
SLocalDataSource
*
ds
=
(
SLocalDataSource
*
)
malloc
(
sizeof
(
SLocalDataSource
)
+
pMemBuffer
[
0
]
->
pageSize
);
if
(
ds
==
NULL
)
{
tscError
(
"0x%"
PRIx64
" failed to create merge structure"
,
id
);
tfree
(
pMerger
);
tfree
(
*
pMerger
);
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
...
...
@@ -443,6 +443,10 @@ int32_t tscCreateGlobalMergerEnv(SQueryInfo *pQueryInfo, tExtMemBuffer ***pMemBu
}
pModel
=
createColumnModel
(
pSchema
,
(
int32_t
)
size
,
capacity
);
if
(
pModel
==
NULL
){
tfree
(
pSchema
);
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
tfree
(
pSchema
);
int32_t
pg
=
DEFAULT_PAGE_SIZE
;
...
...
@@ -458,6 +462,7 @@ int32_t tscCreateGlobalMergerEnv(SQueryInfo *pQueryInfo, tExtMemBuffer ***pMemBu
}
if
(
createOrderDescriptor
(
pOrderDesc
,
pQueryInfo
,
pModel
)
!=
TSDB_CODE_SUCCESS
)
{
tfree
(
pModel
);
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
...
...
src/client/src/tscSql.c
浏览文件 @
eaed6da8
...
...
@@ -963,8 +963,14 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) {
strtolower
(
str
,
tableNameList
);
SArray
*
plist
=
taosArrayInit
(
4
,
POINTER_BYTES
);
if
(
plist
==
NULL
)
{
tfree
(
str
);
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
SArray
*
vgroupList
=
taosArrayInit
(
4
,
POINTER_BYTES
);
if
(
plist
==
NULL
||
vgroupList
==
NULL
)
{
if
(
vgroupList
==
NULL
)
{
taosArrayDestroy
(
plist
);
tfree
(
str
);
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
...
...
@@ -980,6 +986,8 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) {
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tscFreeSqlObj
(
pSql
);
taosArrayDestroyEx
(
plist
);
taosArrayDestroyEx
(
vgroupList
);
return
code
;
}
...
...
src/client/src/tscSubquery.c
浏览文件 @
eaed6da8
...
...
@@ -2476,8 +2476,9 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
pState
->
states
=
calloc
(
pState
->
numOfSub
,
sizeof
(
*
pState
->
states
));
if
(
pState
->
states
==
NULL
)
{
pRes
->
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
tscDestroyGlobalMergerEnv
(
pMemoryBuf
,
pDesc
,
pState
->
numOfSub
);
tscAsyncResultOnError
(
pSql
);
tfree
(
pMemoryBuf
);
return
ret
;
}
...
...
src/client/src/tscUtil.c
浏览文件 @
eaed6da8
...
...
@@ -1246,6 +1246,10 @@ void handleDownstreamOperator(SSqlObj** pSqlObjList, int32_t numOfUpstream, SQue
}
pSourceOperator
=
createJoinOperatorInfo
(
p
,
px
->
numOfTables
,
schema
,
num
);
for
(
int32_t
i
=
0
;
i
<
px
->
numOfTables
;
++
i
)
{
destroyOperatorInfo
(
p
[
i
]);
}
tfree
(
p
);
}
else
{
size_t
num
=
taosArrayGetSize
(
px
->
colList
);
...
...
@@ -4368,7 +4372,7 @@ int32_t tscCreateTableMetaFromSTableMeta(STableMeta* pChild, const char* name, v
pChild
->
sversion
=
p
->
sversion
;
pChild
->
tversion
=
p
->
tversion
;
memcpy
(
&
pChild
->
tableInfo
,
&
p
->
tableInfo
,
sizeof
(
STableInfo
));
memcpy
(
&
pChild
->
tableInfo
,
&
p
->
tableInfo
,
sizeof
(
STable
Com
Info
));
int32_t
total
=
pChild
->
tableInfo
.
numOfColumns
+
pChild
->
tableInfo
.
numOfTags
;
memcpy
(
pChild
->
schema
,
p
->
schema
,
sizeof
(
SSchema
)
*
total
);
...
...
@@ -4719,7 +4723,7 @@ static int32_t doAddTableName(char* nextStr, char** str, SArray* pNameArray, SSq
int32_t
len
=
0
;
if
(
nextStr
==
NULL
)
{
strncpy
(
tablename
,
*
str
,
TSDB_TABLE_FNAME_LEN
);
strncpy
(
tablename
,
*
str
,
TSDB_TABLE_FNAME_LEN
-
1
);
len
=
(
int32_t
)
strlen
(
tablename
);
}
else
{
len
=
(
int32_t
)(
nextStr
-
(
*
str
));
...
...
src/query/inc/qExecutor.h
浏览文件 @
eaed6da8
...
...
@@ -578,6 +578,7 @@ void doCompactSDataBlock(SSDataBlock* pBlock, int32_t numOfRows, int8_t* p);
SSDataBlock
*
createOutputBuf
(
SExprInfo
*
pExpr
,
int32_t
numOfOutput
,
int32_t
numOfRows
);
void
*
destroyOutputBuf
(
SSDataBlock
*
pBlock
);
void
*
doDestroyFilterInfo
(
SSingleColumnFilterInfo
*
pFilterInfo
,
int32_t
numOfFilterCols
);
void
destroyOperatorInfo
(
SOperatorInfo
*
pOperator
);
void
setInputDataBlock
(
SOperatorInfo
*
pOperator
,
SQLFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
,
int32_t
order
);
int32_t
getNumOfResult
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SQLFunctionCtx
*
pCtx
,
int32_t
numOfOutput
);
...
...
src/query/src/qExecutor.c
浏览文件 @
eaed6da8
...
...
@@ -191,8 +191,6 @@ static void destroyTagScanOperatorInfo(void* param, int32_t numOfOutput);
static
void
destroySWindowOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
);
static
void
destroyStateWindowOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
);
static
void
destroyAggOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
);
static
void
destroyOperatorInfo
(
SOperatorInfo
*
pOperator
);
static
int32_t
doCopyToSDataBlock
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SGroupResInfo
*
pGroupResInfo
,
int32_t
orderType
,
SSDataBlock
*
pBlock
);
...
...
@@ -3563,6 +3561,7 @@ STableQueryInfo* createTmpTableQueryInfo(STimeWindow win) {
int32_t
initialSize
=
16
;
int32_t
code
=
initResultRowInfo
(
&
pTableQueryInfo
->
resInfo
,
initialSize
,
TSDB_DATA_TYPE_INT
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tfree
(
pTableQueryInfo
);
return
NULL
;
}
...
...
@@ -5945,7 +5944,7 @@ static int32_t getNumOfScanTimes(SQueryAttr* pQueryAttr) {
return
1
;
}
static
void
destroyOperatorInfo
(
SOperatorInfo
*
pOperator
)
{
void
destroyOperatorInfo
(
SOperatorInfo
*
pOperator
)
{
if
(
pOperator
==
NULL
)
{
return
;
}
...
...
@@ -7241,9 +7240,7 @@ void destroyUdfInfo(SUdfInfo* pUdfInfo) {
tfree
(
pUdfInfo
);
}
static
char
*
getUdfFuncName
(
char
*
name
,
int
type
)
{
char
*
funcname
=
calloc
(
1
,
TSDB_FUNCTIONS_NAME_MAX_LENGTH
+
10
);
static
char
*
getUdfFuncName
(
char
*
funcname
,
char
*
name
,
int
type
)
{
switch
(
type
)
{
case
TSDB_UDF_FUNC_NORMAL
:
strcpy
(
funcname
,
name
);
...
...
@@ -7314,19 +7311,20 @@ int32_t initUdfInfo(SUdfInfo* pUdfInfo) {
return
TSDB_CODE_QRY_SYS_ERROR
;
}
pUdfInfo
->
funcs
[
TSDB_UDF_FUNC_NORMAL
]
=
taosLoadSym
(
pUdfInfo
->
handle
,
getUdfFuncName
(
pUdfInfo
->
name
,
TSDB_UDF_FUNC_NORMAL
));
char
funcname
[
TSDB_FUNCTIONS_NAME_MAX_LENGTH
+
10
]
=
{
0
};
pUdfInfo
->
funcs
[
TSDB_UDF_FUNC_NORMAL
]
=
taosLoadSym
(
pUdfInfo
->
handle
,
getUdfFuncName
(
funcname
,
pUdfInfo
->
name
,
TSDB_UDF_FUNC_NORMAL
));
if
(
NULL
==
pUdfInfo
->
funcs
[
TSDB_UDF_FUNC_NORMAL
])
{
return
TSDB_CODE_QRY_SYS_ERROR
;
}
pUdfInfo
->
funcs
[
TSDB_UDF_FUNC_INIT
]
=
taosLoadSym
(
pUdfInfo
->
handle
,
getUdfFuncName
(
pUdfInfo
->
name
,
TSDB_UDF_FUNC_INIT
));
pUdfInfo
->
funcs
[
TSDB_UDF_FUNC_INIT
]
=
taosLoadSym
(
pUdfInfo
->
handle
,
getUdfFuncName
(
funcname
,
pUdfInfo
->
name
,
TSDB_UDF_FUNC_INIT
));
if
(
pUdfInfo
->
funcType
==
TSDB_UDF_TYPE_AGGREGATE
)
{
pUdfInfo
->
funcs
[
TSDB_UDF_FUNC_FINALIZE
]
=
taosLoadSym
(
pUdfInfo
->
handle
,
getUdfFuncName
(
pUdfInfo
->
name
,
TSDB_UDF_FUNC_FINALIZE
));
pUdfInfo
->
funcs
[
TSDB_UDF_FUNC_MERGE
]
=
taosLoadSym
(
pUdfInfo
->
handle
,
getUdfFuncName
(
pUdfInfo
->
name
,
TSDB_UDF_FUNC_MERGE
));
pUdfInfo
->
funcs
[
TSDB_UDF_FUNC_FINALIZE
]
=
taosLoadSym
(
pUdfInfo
->
handle
,
getUdfFuncName
(
funcname
,
pUdfInfo
->
name
,
TSDB_UDF_FUNC_FINALIZE
));
pUdfInfo
->
funcs
[
TSDB_UDF_FUNC_MERGE
]
=
taosLoadSym
(
pUdfInfo
->
handle
,
getUdfFuncName
(
funcname
,
pUdfInfo
->
name
,
TSDB_UDF_FUNC_MERGE
));
}
pUdfInfo
->
funcs
[
TSDB_UDF_FUNC_DESTROY
]
=
taosLoadSym
(
pUdfInfo
->
handle
,
getUdfFuncName
(
pUdfInfo
->
name
,
TSDB_UDF_FUNC_DESTROY
));
pUdfInfo
->
funcs
[
TSDB_UDF_FUNC_DESTROY
]
=
taosLoadSym
(
pUdfInfo
->
handle
,
getUdfFuncName
(
funcname
,
pUdfInfo
->
name
,
TSDB_UDF_FUNC_DESTROY
));
if
(
pUdfInfo
->
funcs
[
TSDB_UDF_FUNC_INIT
])
{
return
(
*
(
udfInitFunc
)
pUdfInfo
->
funcs
[
TSDB_UDF_FUNC_INIT
])(
&
pUdfInfo
->
init
);
...
...
@@ -7398,10 +7396,12 @@ int32_t createQueryFunc(SQueriedTableInfo* pTableInfo, int32_t numOfOutput, SExp
int32_t
j
=
getColumnIndexInSource
(
pTableInfo
,
&
pExprs
[
i
].
base
,
pTagCols
);
if
(
TSDB_COL_IS_TAG
(
pExprs
[
i
].
base
.
colInfo
.
flag
))
{
if
(
j
<
TSDB_TBNAME_COLUMN_INDEX
||
j
>=
pTableInfo
->
numOfTags
)
{
tfree
(
pExprs
);
return
TSDB_CODE_QRY_INVALID_MSG
;
}
}
else
{
if
(
j
<
PRIMARYKEY_TIMESTAMP_COL_INDEX
||
j
>=
pTableInfo
->
numOfCols
)
{
tfree
(
pExprs
);
return
TSDB_CODE_QRY_INVALID_MSG
;
}
}
...
...
@@ -7421,6 +7421,7 @@ int32_t createQueryFunc(SQueriedTableInfo* pTableInfo, int32_t numOfOutput, SExp
int32_t
ret
=
cloneExprFilterInfo
(
&
pExprs
[
i
].
base
.
flist
.
filterInfo
,
pExprMsg
[
i
]
->
flist
.
filterInfo
,
pExprMsg
[
i
]
->
flist
.
numOfFilters
);
if
(
ret
)
{
tfree
(
pExprs
);
return
ret
;
}
}
...
...
src/query/src/qPlan.c
浏览文件 @
eaed6da8
...
...
@@ -222,6 +222,7 @@ SArray* createQueryPlanImpl(SQueryInfo* pQueryInfo) {
if
(
pQueryInfo
->
numOfTables
>
1
)
{
// it is a join query
// 1. separate the select clause according to table
taosArrayDestroy
(
upstream
);
upstream
=
taosArrayInit
(
5
,
POINTER_BYTES
);
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
numOfTables
;
++
i
)
{
...
...
@@ -231,6 +232,7 @@ SArray* createQueryPlanImpl(SQueryInfo* pQueryInfo) {
SArray
*
exprList
=
taosArrayInit
(
4
,
POINTER_BYTES
);
if
(
tscExprCopy
(
exprList
,
pQueryInfo
->
exprList
,
uid
,
true
)
!=
0
)
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
tscExprDestroy
(
exprList
);
exit
(
-
1
);
}
...
...
@@ -245,6 +247,8 @@ SArray* createQueryPlanImpl(SQueryInfo* pQueryInfo) {
// 4. add the projection query node
SQueryNode
*
pNode
=
doAddTableColumnNode
(
pQueryInfo
,
pTableMetaInfo
,
&
info
,
exprList
,
tableColumnList
);
tscColumnListDestroy
(
tableColumnList
);
tscExprDestroy
(
exprList
);
taosArrayPush
(
upstream
,
&
pNode
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录