Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
28a8020e
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看板
未验证
提交
28a8020e
编写于
10月 16, 2022
作者:
H
Haojun Liao
提交者:
GitHub
10月 16, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #17379 from taosdata/fix/liao_cov
fix(query): fix coverity issues.
上级
90ced77b
bcb3d41d
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
69 addition
and
34 deletion
+69
-34
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
+8
-1
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+5
-6
source/libs/executor/src/dataInserter.c
source/libs/executor/src/dataInserter.c
+1
-1
source/libs/executor/src/executil.c
source/libs/executor/src/executil.c
+12
-5
source/libs/executor/src/executor.c
source/libs/executor/src/executor.c
+3
-3
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+1
-0
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+14
-2
source/libs/executor/src/sortoperator.c
source/libs/executor/src/sortoperator.c
+1
-1
source/libs/executor/src/tfill.c
source/libs/executor/src/tfill.c
+7
-2
source/libs/executor/src/timewindowoperator.c
source/libs/executor/src/timewindowoperator.c
+16
-12
tools/shell/src/shellEngine.c
tools/shell/src/shellEngine.c
+1
-1
未找到文件。
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
浏览文件 @
28a8020e
...
...
@@ -133,8 +133,15 @@ static SBlockData *loadLastBlock(SLDataIter *pIter, const char *idStr) {
id
.
uid
=
pIter
->
uid
;
}
tBlockDataInit
(
pBlock
,
&
id
,
pInfo
->
pSchema
,
pInfo
->
colIds
,
pInfo
->
numOfCols
);
code
=
tBlockDataInit
(
pBlock
,
&
id
,
pInfo
->
pSchema
,
pInfo
->
colIds
,
pInfo
->
numOfCols
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_exit
;
}
code
=
tsdbReadSttBlock
(
pIter
->
pReader
,
pIter
->
iStt
,
pIter
->
pSttBlk
,
pBlock
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_exit
;
}
double
el
=
(
taosGetTimestampUs
()
-
st
)
/
1000
.
0
;
pInfo
->
elapsedTime
+=
el
;
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
28a8020e
...
...
@@ -2676,9 +2676,9 @@ static STsdb* getTsdbByRetentions(SVnode* pVnode, TSKEY winSKey, SRetention* ret
int8_t
level
=
0
;
int8_t
precision
=
pVnode
->
config
.
tsdbCfg
.
precision
;
int64_t
now
=
taosGetTimestamp
(
precision
);
int64_t
offset
=
tsQueryRsmaTolerance
*
((
precision
==
TSDB_TIME_PRECISION_MILLI
)
?
1
:
(
precision
==
TSDB_TIME_PRECISION_MICRO
)
?
1000
:
1000000
);
int64_t
offset
=
tsQueryRsmaTolerance
*
((
precision
==
TSDB_TIME_PRECISION_MILLI
)
?
1
L
:
(
precision
==
TSDB_TIME_PRECISION_MICRO
)
?
1000
L
:
1000000
L
);
for
(
int8_t
i
=
0
;
i
<
TSDB_RETENTION_MAX
;
++
i
)
{
SRetention
*
pRetention
=
retentions
+
level
;
...
...
@@ -3372,14 +3372,13 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, SArray* pTabl
if
(
pCond
->
suid
!=
0
)
{
pReader
->
pSchema
=
metaGetTbTSchema
(
pReader
->
pTsdb
->
pVnode
->
pMeta
,
pReader
->
suid
,
-
1
,
1
);
if
(
pReader
->
pSchema
==
NULL
)
{
tsdbError
(
"failed to get table schema, suid:%"
PRIu64
", ver:%"
PRId64
" , %s"
,
pReader
->
suid
,
-
1
,
pReader
->
idStr
);
tsdbError
(
"failed to get table schema, suid:%"
PRIu64
", ver:-1, %s"
,
pReader
->
suid
,
pReader
->
idStr
);
}
}
else
if
(
taosArrayGetSize
(
pTableList
)
>
0
)
{
STableKeyInfo
*
pKey
=
taosArrayGet
(
pTableList
,
0
);
pReader
->
pSchema
=
metaGetTbTSchema
(
pReader
->
pTsdb
->
pVnode
->
pMeta
,
pKey
->
uid
,
-
1
,
1
);
if
(
pReader
->
pSchema
==
NULL
)
{
tsdbError
(
"failed to get table schema, uid:%"
PRIu64
", ver:
%"
PRId64
" , %s"
,
pKey
->
uid
,
-
1
,
pReader
->
idStr
);
tsdbError
(
"failed to get table schema, uid:%"
PRIu64
", ver:
-1, %s"
,
pKey
->
uid
,
pReader
->
idStr
);
}
}
...
...
source/libs/executor/src/dataInserter.c
浏览文件 @
28a8020e
...
...
@@ -81,7 +81,7 @@ int32_t inserterCallback(void* param, SDataBuf* pMsg, int32_t code) {
}
pInserter
->
submitRes
.
affectedRows
+=
pInserter
->
submitRes
.
pRsp
->
affectedRows
;
qDebug
(
"submit rsp received, affectedRows:%d, total:%
d"
,
pInserter
->
submitRes
.
pRsp
->
affectedRows
,
qDebug
(
"submit rsp received, affectedRows:%d, total:%
"
PRId64
,
pInserter
->
submitRes
.
pRsp
->
affectedRows
,
pInserter
->
submitRes
.
affectedRows
);
tFreeSSubmitRsp
(
pInserter
->
submitRes
.
pRsp
);
...
...
source/libs/executor/src/executil.c
浏览文件 @
28a8020e
...
...
@@ -1201,14 +1201,21 @@ void createExprFromOneNode(SExprInfo* pExp, SNode* pNode, int16_t slotId) {
pExp
->
base
.
resSchema
=
createResSchema
(
pType
->
type
,
pType
->
bytes
,
slotId
,
pType
->
scale
,
pType
->
precision
,
pFuncNode
->
node
.
aliasName
);
pExp
->
pExpr
->
_function
.
functionId
=
pFuncNode
->
funcId
;
pExp
->
pExpr
->
_function
.
pFunctNode
=
pFuncNode
;
tExprNode
*
pExprNode
=
pExp
->
pExpr
;
pExprNode
->
_function
.
functionId
=
pFuncNode
->
funcId
;
pExprNode
->
_function
.
pFunctNode
=
pFuncNode
;
tstrncpy
(
pExprNode
->
_function
.
functionName
,
pFuncNode
->
functionName
,
tListLen
(
pExprNode
->
_function
.
functionName
));
strncpy
(
pExp
->
pExpr
->
_function
.
functionName
,
pFuncNode
->
functionName
,
tListLen
(
pExp
->
pExpr
->
_function
.
functionName
));
#if 1
// todo refactor: add the parameter for tbname function
if
(
!
pFuncNode
->
pParameterList
&&
(
strcmp
(
pExp
->
pExpr
->
_function
.
functionName
,
"tbname"
)
==
0
))
{
const
char
*
name
=
"tbname"
;
int32_t
len
=
strlen
(
name
);
if
(
!
pFuncNode
->
pParameterList
&&
(
memcmp
(
pExprNode
->
_function
.
functionName
,
name
,
len
)
==
0
)
&&
pExprNode
->
_function
.
functionName
[
len
]
==
0
)
{
pFuncNode
->
pParameterList
=
nodesMakeList
();
ASSERT
(
LIST_LENGTH
(
pFuncNode
->
pParameterList
)
==
0
);
SValueNode
*
res
=
(
SValueNode
*
)
nodesMakeNode
(
QUERY_NODE_VALUE
);
...
...
source/libs/executor/src/executor.c
浏览文件 @
28a8020e
...
...
@@ -856,15 +856,15 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
tDeleteSSchemaWrapper
(
pTaskInfo
->
streamInfo
.
schema
);
pTaskInfo
->
streamInfo
.
schema
=
mtInfo
.
schema
;
qDebug
(
"tmqsnap qStreamPrepareScan snapshot data uid %ld ts %
ld"
,
mtInfo
.
uid
,
pOffset
->
ts
);
qDebug
(
"tmqsnap qStreamPrepareScan snapshot data uid %ld ts %
"
PRId64
,
mtInfo
.
uid
,
pOffset
->
ts
);
}
else
if
(
pOffset
->
type
==
TMQ_OFFSET__SNAPSHOT_META
)
{
SStreamRawScanInfo
*
pInfo
=
pOperator
->
info
;
SSnapContext
*
sContext
=
pInfo
->
sContext
;
if
(
setForSnapShot
(
sContext
,
pOffset
->
uid
)
!=
0
)
{
qError
(
"setForSnapShot error. uid:%"
PRI
i64
" ,version:%"
PRIi64
,
pOffset
->
uid
);
qError
(
"setForSnapShot error. uid:%"
PRI
u64
" ,version:%"
PRId64
,
pOffset
->
uid
,
pOffset
->
version
);
return
-
1
;
}
qDebug
(
"tmqsnap qStreamPrepareScan snapshot meta uid %ld ts %
ld"
,
pOffset
->
uid
);
qDebug
(
"tmqsnap qStreamPrepareScan snapshot meta uid %ld ts %
"
PRId64
,
pOffset
->
uid
,
pOffset
->
ts
);
}
else
if
(
pOffset
->
type
==
TMQ_OFFSET__LOG
)
{
SStreamRawScanInfo
*
pInfo
=
pOperator
->
info
;
tsdbReaderClose
(
pInfo
->
dataReader
);
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
28a8020e
...
...
@@ -1857,6 +1857,7 @@ static int32_t doSendFetchDataRequest(SExchangeInfo* pExchangeInfo, SExecTaskInf
SResFetchReq
*
pMsg
=
taosMemoryCalloc
(
1
,
sizeof
(
SResFetchReq
));
if
(
NULL
==
pMsg
)
{
pTaskInfo
->
code
=
TSDB_CODE_QRY_OUT_OF_MEMORY
;
taosMemoryFree
(
pWrapper
);
return
pTaskInfo
->
code
;
}
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
28a8020e
...
...
@@ -2568,16 +2568,27 @@ static SSDataBlock* sysTableScanUserTags(SOperatorInfo* pOperator) {
SMetaReader
smrChildTable
=
{
0
};
metaReaderInit
(
&
smrChildTable
,
pInfo
->
readHandle
.
meta
,
0
);
metaGetTableEntryByName
(
&
smrChildTable
,
condTableName
);
int32_t
code
=
metaGetTableEntryByName
(
&
smrChildTable
,
condTableName
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
// terrno has been set by metaGetTableEntryByName, therefore, return directly
return
NULL
;
}
if
(
smrChildTable
.
me
.
type
!=
TSDB_CHILD_TABLE
)
{
metaReaderClear
(
&
smrChildTable
);
blockDataDestroy
(
dataBlock
);
pInfo
->
loadInfo
.
totalRows
=
0
;
return
NULL
;
}
SMetaReader
smrSuperTable
=
{
0
};
metaReaderInit
(
&
smrSuperTable
,
pInfo
->
readHandle
.
meta
,
META_READER_NOLOCK
);
metaGetTableEntryByUid
(
&
smrSuperTable
,
smrChildTable
.
me
.
ctbEntry
.
suid
);
code
=
metaGetTableEntryByUid
(
&
smrSuperTable
,
smrChildTable
.
me
.
ctbEntry
.
suid
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
// terrno has been set by metaGetTableEntryByUid
return
NULL
;
}
sysTableUserTagsFillOneTableTags
(
pInfo
,
&
smrSuperTable
,
&
smrChildTable
,
dbname
,
tableName
,
&
numOfRows
,
dataBlock
);
metaReaderClear
(
&
smrSuperTable
);
metaReaderClear
(
&
smrChildTable
);
...
...
@@ -3795,6 +3806,7 @@ SOperatorInfo* createTableMergeScanOperatorInfo(STableScanPhysiNode* pTableScanN
int32_t
code
=
initQueryTableDataCond
(
&
pInfo
->
cond
,
pTableScanNode
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
taosArrayDestroy
(
pColList
);
goto
_error
;
}
...
...
source/libs/executor/src/sortoperator.c
浏览文件 @
28a8020e
...
...
@@ -658,7 +658,7 @@ SSDataBlock* getMultiwaySortedBlockData(SSortHandle* pHandle, SSDataBlock* pData
blockDataDestroy
(
p
);
qDebug
(
"%s get sorted block, groupId:
%0x
"
PRIx64
" rows:%d"
,
GET_TASKID
(
pTaskInfo
),
pDataBlock
->
info
.
groupId
,
qDebug
(
"%s get sorted block, groupId:
0x%
"
PRIx64
" rows:%d"
,
GET_TASKID
(
pTaskInfo
),
pDataBlock
->
info
.
groupId
,
pDataBlock
->
info
.
rows
);
return
(
pDataBlock
->
info
.
rows
>
0
)
?
pDataBlock
:
NULL
;
}
...
...
source/libs/executor/src/tfill.c
浏览文件 @
28a8020e
...
...
@@ -1681,7 +1681,11 @@ SOperatorInfo* createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFi
&
numOfOutputCols
,
COL_MATCH_FROM_SLOT_ID
);
pInfo
->
pCondition
=
pPhyFillNode
->
node
.
pConditions
;
pInfo
->
pColMatchColInfo
=
pColMatchColInfo
;
initExprSupp
(
&
pOperator
->
exprSupp
,
pFillExprInfo
,
numOfFillCols
);
int32_t
code
=
initExprSupp
(
&
pOperator
->
exprSupp
,
pFillExprInfo
,
numOfFillCols
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
pInfo
->
srcRowIndex
=
0
;
pOperator
->
name
=
"FillOperator"
;
...
...
@@ -1693,7 +1697,7 @@ SOperatorInfo* createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFi
pOperator
->
fpSet
=
createOperatorFpSet
(
operatorDummyOpenFn
,
doStreamFill
,
NULL
,
NULL
,
destroyStreamFillOperatorInfo
,
NULL
,
NULL
,
NULL
);
int32_t
code
=
appendDownstream
(
pOperator
,
&
downstream
,
1
);
code
=
appendDownstream
(
pOperator
,
&
downstream
,
1
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
@@ -1702,5 +1706,6 @@ SOperatorInfo* createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFi
_error:
destroyStreamFillOperatorInfo
(
pInfo
);
taosMemoryFreeClear
(
pOperator
);
pTaskInfo
->
code
=
code
;
return
NULL
;
}
source/libs/executor/src/timewindowoperator.c
浏览文件 @
28a8020e
...
...
@@ -1420,8 +1420,9 @@ static void doDeleteWindows(SOperatorInfo* pOperator, SInterval* pInterval, SSDa
SColumnInfoData
*
pGpCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
GROUPID_COLUMN_INDEX
);
uint64_t
*
pGpDatas
=
(
uint64_t
*
)
pGpCol
->
pData
;
for
(
int32_t
i
=
0
;
i
<
pBlock
->
info
.
rows
;
i
++
)
{
SResultRowInfo
dumyInfo
;
SResultRowInfo
dumyInfo
=
{
0
}
;
dumyInfo
.
cur
.
pageId
=
-
1
;
STimeWindow
win
=
{
0
};
if
(
IS_FINAL_OP
(
pInfo
))
{
win
.
skey
=
startTsCols
[
i
];
...
...
@@ -5828,27 +5829,30 @@ SOperatorInfo* createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhys
pInfo
->
ignoreExpiredData
=
pIntervalPhyNode
->
window
.
igExpired
;
pInfo
->
isFinal
=
false
;
if
(
pIntervalPhyNode
->
window
.
pExprs
!=
NULL
)
{
int32_t
numOfScalar
=
0
;
SExprInfo
*
pScalarExprInfo
=
createExprInfo
(
pIntervalPhyNode
->
window
.
pExprs
,
NULL
,
&
numOfScalar
);
int32_t
code
=
initExprSupp
(
&
pInfo
->
scalarSupp
,
pScalarExprInfo
,
numOfScalar
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
}
pInfo
->
primaryTsIndex
=
((
SColumnNode
*
)
pIntervalPhyNode
->
window
.
pTspk
)
->
slotId
;
initResultSizeInfo
(
&
pOperator
->
resultInfo
,
4096
);
SExprSupp
*
pSup
=
&
pOperator
->
exprSupp
;
initBasicInfo
(
&
pInfo
->
binfo
,
pResBlock
);
initStreamFunciton
(
pSup
->
pCtx
,
pSup
->
numOfExprs
);
initExecTimeWindowInfo
(
&
pInfo
->
twAggSup
.
timeWindowData
,
&
pTaskInfo
->
window
);
size_t
keyBufSize
=
sizeof
(
int64_t
)
+
sizeof
(
int64_t
)
+
POINTER_BYTES
;
int32_t
code
=
initAggInfo
(
pSup
,
&
pInfo
->
aggSup
,
pExprInfo
,
numOfCols
,
keyBufSize
,
pTaskInfo
->
id
.
str
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
initBasicInfo
(
&
pInfo
->
binfo
,
pResBlock
);
initStreamFunciton
(
pSup
->
pCtx
,
pSup
->
numOfExprs
);
initExecTimeWindowInfo
(
&
pInfo
->
twAggSup
.
timeWindowData
,
&
pTaskInfo
->
window
);
if
(
pIntervalPhyNode
->
window
.
pExprs
!=
NULL
)
{
int32_t
numOfScalar
=
0
;
SExprInfo
*
pScalarExprInfo
=
createExprInfo
(
pIntervalPhyNode
->
window
.
pExprs
,
NULL
,
&
numOfScalar
);
code
=
initExprSupp
(
&
pInfo
->
scalarSupp
,
pScalarExprInfo
,
numOfScalar
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
}
pInfo
->
invertible
=
allInvertible
(
pSup
->
pCtx
,
numOfCols
);
pInfo
->
invertible
=
false
;
...
...
tools/shell/src/shellEngine.c
浏览文件 @
28a8020e
...
...
@@ -229,7 +229,7 @@ void shellRunSingleCommandImp(char *command) {
printf
(
"Query OK, %d of %d rows affected (%.6fs)
\r\n
"
,
num_rows_affacted
,
num_rows_affacted
,
(
et
-
st
)
/
1E6
);
// call auto tab
callbackAutoTab
(
command
,
pSql
,
false
);
callbackAutoTab
(
command
,
NULL
,
false
);
}
printf
(
"
\r\n
"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录