Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b53cc7f3
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看板
提交
b53cc7f3
编写于
10月 21, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(query): fix coverity issues.
上级
bcb3dcc7
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
59 addition
and
28 deletion
+59
-28
include/libs/executor/dataSinkMgt.h
include/libs/executor/dataSinkMgt.h
+1
-1
source/common/src/tdataformat.c
source/common/src/tdataformat.c
+13
-3
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+4
-4
source/libs/executor/src/dataDeleter.c
source/libs/executor/src/dataDeleter.c
+21
-6
source/libs/executor/src/dataDispatcher.c
source/libs/executor/src/dataDispatcher.c
+4
-2
source/libs/executor/src/dataSinkMgt.c
source/libs/executor/src/dataSinkMgt.c
+4
-2
source/libs/executor/src/executor.c
source/libs/executor/src/executor.c
+1
-1
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+2
-0
source/libs/executor/src/groupoperator.c
source/libs/executor/src/groupoperator.c
+6
-4
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+3
-5
未找到文件。
include/libs/executor/dataSinkMgt.h
浏览文件 @
b53cc7f3
...
...
@@ -84,7 +84,7 @@ typedef struct SOutputData {
* @param pHandle output
* @return error code
*/
int32_t
dsCreateDataSinker
(
const
SDataSinkNode
*
pDataSink
,
DataSinkHandle
*
pHandle
,
void
*
pParam
);
int32_t
dsCreateDataSinker
(
const
SDataSinkNode
*
pDataSink
,
DataSinkHandle
*
pHandle
,
void
*
pParam
,
const
char
*
id
);
int32_t
dsDataSinkGetCacheSize
(
SDataSinkStat
*
pStat
);
...
...
source/common/src/tdataformat.c
浏览文件 @
b53cc7f3
...
...
@@ -893,16 +893,26 @@ void tTagFree(STag *pTag) {
}
char
*
tTagValToData
(
const
STagVal
*
value
,
bool
isJson
)
{
if
(
!
value
)
return
NULL
;
if
(
!
value
)
{
return
NULL
;
}
char
*
data
=
NULL
;
int8_t
typeBytes
=
0
;
if
(
isJson
)
{
typeBytes
=
CHAR_BYTES
;
}
if
(
IS_VAR_DATA_TYPE
(
value
->
type
))
{
data
=
taosMemoryCalloc
(
1
,
typeBytes
+
VARSTR_HEADER_SIZE
+
value
->
nData
);
if
(
data
==
NULL
)
return
NULL
;
if
(
isJson
)
*
data
=
value
->
type
;
if
(
data
==
NULL
)
{
return
NULL
;
}
if
(
isJson
)
{
*
data
=
value
->
type
;
}
varDataLen
(
data
+
typeBytes
)
=
value
->
nData
;
memcpy
(
varDataVal
(
data
+
typeBytes
),
value
->
pData
,
value
->
nData
);
}
else
{
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
b53cc7f3
...
...
@@ -1523,9 +1523,9 @@ static FORCE_INLINE STSchema* doGetSchemaForTSRow(int32_t sversion, STsdbReader*
return
pReader
->
pMemSchema
;
}
taosMemoryFree
(
pReader
->
pMemSchema
);
taosMemoryFree
Clear
(
pReader
->
pMemSchema
);
int32_t
code
=
metaGetTbTSchemaEx
(
pReader
->
pTsdb
->
pVnode
->
pMeta
,
pReader
->
suid
,
uid
,
sversion
,
&
pReader
->
pMemSchema
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
||
pReader
->
pMemSchema
==
NULL
)
{
terrno
=
code
;
return
NULL
;
}
else
{
...
...
@@ -2274,7 +2274,7 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader) {
}
_end:
pResBlock
->
info
.
uid
=
pBlockScanInfo
->
uid
;
pResBlock
->
info
.
uid
=
(
pBlockScanInfo
!=
NULL
)
?
pBlockScanInfo
->
uid
:
0
;
blockDataUpdateTsWindow
(
pResBlock
,
0
);
setComposedBlockFlag
(
pReader
,
true
);
...
...
@@ -2569,7 +2569,7 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) {
}
if
(
pScanInfo
==
NULL
)
{
tsdbError
(
"failed to get table
, uid:%"
PRIu64
", %s"
,
pBlockInfo
->
uid
,
pReader
->
idStr
);
tsdbError
(
"failed to get table
scan-info, %s"
,
pReader
->
idStr
);
code
=
TSDB_CODE_INVALID_PARA
;
return
code
;
}
...
...
source/libs/executor/src/dataDeleter.c
浏览文件 @
b53cc7f3
...
...
@@ -254,10 +254,12 @@ static int32_t getCacheSize(struct SDataSinkHandle* pHandle, uint64_t* size) {
int32_t
createDataDeleter
(
SDataSinkManager
*
pManager
,
const
SDataSinkNode
*
pDataSink
,
DataSinkHandle
*
pHandle
,
void
*
pParam
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
SDataDeleterHandle
*
deleter
=
taosMemoryCalloc
(
1
,
sizeof
(
SDataDeleterHandle
));
if
(
NULL
==
deleter
)
{
terrno
=
TSDB_CODE_QRY
_OUT_OF_MEMORY
;
return
TSDB_CODE_QRY_OUT_OF_MEMORY
;
code
=
TSDB_CODE
_OUT_OF_MEMORY
;
goto
_end
;
}
SDataDeleterNode
*
pDeleterNode
=
(
SDataDeleterNode
*
)
pDataSink
;
...
...
@@ -270,17 +272,30 @@ int32_t createDataDeleter(SDataSinkManager* pManager, const SDataSinkNode* pData
deleter
->
pManager
=
pManager
;
deleter
->
pDeleter
=
pDeleterNode
;
deleter
->
pSchema
=
pDataSink
->
pInputDataBlockDesc
;
if
(
pParam
==
NULL
)
{
code
=
TSDB_CODE_QRY_INVALID_INPUT
;
qError
(
"invalid input param in creating data deleter, code%s"
,
tstrerror
(
code
));
goto
_end
;
}
deleter
->
pParam
=
pParam
;
deleter
->
status
=
DS_BUF_EMPTY
;
deleter
->
queryEnd
=
false
;
deleter
->
pDataBlocks
=
taosOpenQueue
();
taosThreadMutexInit
(
&
deleter
->
mutex
,
NULL
);
if
(
NULL
==
deleter
->
pDataBlocks
)
{
terrno
=
TSDB_CODE_QRY_OUT_OF_MEMORY
;
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_end
;
}
*
pHandle
=
deleter
;
return
code
;
_end:
if
(
deleter
!=
NULL
)
{
destroyDataSinker
((
SDataSinkHandle
*
)
deleter
);
taosMemoryFree
(
deleter
);
return
TSDB_CODE_QRY_OUT_OF_MEMORY
;
}
*
pHandle
=
deleter
;
return
TSDB_CODE_SUCCESS
;
return
code
;
}
source/libs/executor/src/dataDispatcher.c
浏览文件 @
b53cc7f3
...
...
@@ -231,8 +231,10 @@ static int32_t destroyDataSinker(SDataSinkHandle* pHandle) {
while
(
!
taosQueueEmpty
(
pDispatcher
->
pDataBlocks
))
{
SDataDispatchBuf
*
pBuf
=
NULL
;
taosReadQitem
(
pDispatcher
->
pDataBlocks
,
(
void
**
)
&
pBuf
);
taosMemoryFreeClear
(
pBuf
->
pData
);
taosFreeQitem
(
pBuf
);
if
(
pBuf
!=
NULL
)
{
taosMemoryFreeClear
(
pBuf
->
pData
);
taosFreeQitem
(
pBuf
);
}
}
taosCloseQueue
(
pDispatcher
->
pDataBlocks
);
taosThreadMutexDestroy
(
&
pDispatcher
->
mutex
);
...
...
source/libs/executor/src/dataSinkMgt.c
浏览文件 @
b53cc7f3
...
...
@@ -33,7 +33,7 @@ int32_t dsDataSinkGetCacheSize(SDataSinkStat* pStat) {
return
0
;
}
int32_t
dsCreateDataSinker
(
const
SDataSinkNode
*
pDataSink
,
DataSinkHandle
*
pHandle
,
void
*
pParam
)
{
int32_t
dsCreateDataSinker
(
const
SDataSinkNode
*
pDataSink
,
DataSinkHandle
*
pHandle
,
void
*
pParam
,
const
char
*
id
)
{
switch
((
int
)
nodeType
(
pDataSink
))
{
case
QUERY_NODE_PHYSICAL_PLAN_DISPATCH
:
return
createDataDispatcher
(
&
gDataSinkManager
,
pDataSink
,
pHandle
);
...
...
@@ -42,7 +42,9 @@ int32_t dsCreateDataSinker(const SDataSinkNode* pDataSink, DataSinkHandle* pHand
case
QUERY_NODE_PHYSICAL_PLAN_QUERY_INSERT
:
return
createDataInserter
(
&
gDataSinkManager
,
pDataSink
,
pHandle
,
pParam
);
}
return
TSDB_CODE_FAILED
;
qError
(
"invalid input node type:%d, %s"
,
nodeType
(
pDataSink
),
id
);
return
TSDB_CODE_QRY_INVALID_INPUT
;
}
int32_t
dsPutDataBlock
(
DataSinkHandle
handle
,
const
SInputData
*
pInput
,
bool
*
pContinue
)
{
...
...
source/libs/executor/src/executor.c
浏览文件 @
b53cc7f3
...
...
@@ -370,7 +370,7 @@ int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId,
goto
_error
;
}
code
=
dsCreateDataSinker
(
pSubplan
->
pDataSink
,
handle
,
pSinkParam
);
code
=
dsCreateDataSinker
(
pSubplan
->
pDataSink
,
handle
,
pSinkParam
,
(
*
pTask
)
->
id
.
str
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
taosMemoryFreeClear
(
pSinkParam
);
}
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
b53cc7f3
...
...
@@ -3098,7 +3098,9 @@ _error:
destroyAggOperatorInfo
(
pInfo
);
}
cleanupExprSupp
(
&
pOperator
->
exprSupp
);
taosMemoryFreeClear
(
pOperator
);
pTaskInfo
->
code
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
}
...
...
source/libs/executor/src/groupoperator.c
浏览文件 @
b53cc7f3
...
...
@@ -421,14 +421,14 @@ SOperatorInfo* createGroupOperatorInfo(SOperatorInfo* downstream, SAggPhysiNode
goto
_error
;
}
int32_t
num
=
0
;
SExprInfo
*
pExprInfo
=
createExprInfo
(
pAggNode
->
pAggFuncs
,
pAggNode
->
pGroupKeys
,
&
num
);
initResultSizeInfo
(
&
pOperator
->
resultInfo
,
4096
);
code
=
initGroupOptrInfo
(
&
pInfo
->
pGroupColVals
,
&
pInfo
->
groupKeyLen
,
&
pInfo
->
keyBuf
,
pInfo
->
pGroupCols
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
initResultSizeInfo
(
&
pOperator
->
resultInfo
,
4096
);
int32_t
num
=
0
;
SExprInfo
*
pExprInfo
=
createExprInfo
(
pAggNode
->
pAggFuncs
,
pAggNode
->
pGroupKeys
,
&
num
);
code
=
initAggInfo
(
&
pOperator
->
exprSupp
,
&
pInfo
->
aggSup
,
pExprInfo
,
num
,
pInfo
->
groupKeyLen
,
pTaskInfo
->
id
.
str
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
...
...
@@ -453,7 +453,9 @@ SOperatorInfo* createGroupOperatorInfo(SOperatorInfo* downstream, SAggPhysiNode
_error:
pTaskInfo
->
code
=
TSDB_CODE_OUT_OF_MEMORY
;
destroyGroupOperatorInfo
(
pInfo
);
if
(
pInfo
!=
NULL
)
{
destroyGroupOperatorInfo
(
pInfo
);
}
taosMemoryFreeClear
(
pOperator
);
return
NULL
;
}
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
b53cc7f3
...
...
@@ -466,16 +466,14 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, SExprInfo* pPseudoExpr, int
colDataAppendNNULL
(
pColInfoData
,
0
,
pBlock
->
info
.
rows
);
}
else
if
(
pColInfoData
->
info
.
type
!=
TSDB_DATA_TYPE_JSON
)
{
colDataAppendNItems
(
pColInfoData
,
0
,
data
,
pBlock
->
info
.
rows
);
if
(
IS_VAR_DATA_TYPE
(((
const
STagVal
*
)
p
)
->
type
))
{
taosMemoryFree
(
data
);
}
}
else
{
// todo opt for json tag
for
(
int32_t
i
=
0
;
i
<
pBlock
->
info
.
rows
;
++
i
)
{
colDataAppend
(
pColInfoData
,
i
,
data
,
false
);
}
}
if
(
data
&&
(
pColInfoData
->
info
.
type
!=
TSDB_DATA_TYPE_JSON
)
&&
p
!=
NULL
&&
IS_VAR_DATA_TYPE
(((
const
STagVal
*
)
p
)
->
type
))
{
taosMemoryFree
(
data
);
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录