Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3cce1787
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看板
提交
3cce1787
编写于
10月 13, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh: do coverity scan
上级
b3b0e5a5
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
72 addition
and
86 deletion
+72
-86
source/libs/nodes/src/nodesMsgFuncs.c
source/libs/nodes/src/nodesMsgFuncs.c
+17
-9
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+7
-2
source/libs/parser/inc/parToken.h
source/libs/parser/inc/parToken.h
+0
-2
source/libs/parser/src/parAstCreater.c
source/libs/parser/src/parAstCreater.c
+10
-10
source/libs/parser/src/parInsert.c
source/libs/parser/src/parInsert.c
+7
-10
source/libs/parser/src/parInsertData.c
source/libs/parser/src/parInsertData.c
+27
-28
source/libs/parser/src/parTokenizer.c
source/libs/parser/src/parTokenizer.c
+0
-21
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+2
-2
source/libs/planner/src/planPhysiCreater.c
source/libs/planner/src/planPhysiCreater.c
+1
-1
source/libs/planner/src/planSpliter.c
source/libs/planner/src/planSpliter.c
+1
-1
未找到文件。
source/libs/nodes/src/nodesMsgFuncs.c
浏览文件 @
3cce1787
...
...
@@ -478,7 +478,10 @@ static int32_t tlvDecodeValueEnum(STlvDecoder* pDecoder, void* pValue, int16_t l
return
code
;
}
static
int32_t
tlvDecodeCStr
(
STlv
*
pTlv
,
char
*
pValue
)
{
static
int32_t
tlvDecodeCStr
(
STlv
*
pTlv
,
char
*
pValue
,
int32_t
size
)
{
if
(
pTlv
->
len
>
size
-
1
)
{
return
TSDB_CODE_FAILED
;
}
memcpy
(
pValue
,
pTlv
->
value
,
pTlv
->
len
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -919,9 +922,14 @@ static int32_t msgToDatum(STlv* pTlv, void* pObj) {
}
break
;
}
case
TSDB_DATA_TYPE_JSON
:
case
TSDB_DATA_TYPE_JSON
:
{
if
(
pTlv
->
len
<=
0
||
pTlv
>
TSDB_MAX_JSON_TAG_LEN
)
{
code
=
TSDB_CODE_FAILED
;
break
;
}
code
=
tlvDecodeDynBinary
(
pTlv
,
(
void
**
)
&
pNode
->
datum
.
p
);
break
;
}
case
TSDB_DATA_TYPE_DECIMAL
:
case
TSDB_DATA_TYPE_BLOB
:
// todo
...
...
@@ -1097,7 +1105,7 @@ static int32_t msgToFunctionNode(STlvDecoder* pDecoder, void* pObj) {
code
=
tlvDecodeObjFromTlv
(
pTlv
,
msgToExprNode
,
&
pNode
->
node
);
break
;
case
FUNCTION_CODE_FUNCTION_NAME
:
code
=
tlvDecodeCStr
(
pTlv
,
pNode
->
functionName
);
code
=
tlvDecodeCStr
(
pTlv
,
pNode
->
functionName
,
sizeof
(
pNode
->
functionName
)
);
break
;
case
FUNCTION_CODE_FUNCTION_ID
:
code
=
tlvDecodeI32
(
pTlv
,
&
pNode
->
funcId
);
...
...
@@ -1226,10 +1234,10 @@ static int32_t msgToName(STlvDecoder* pDecoder, void* pObj) {
code
=
tlvDecodeI32
(
pTlv
,
&
pNode
->
acctId
);
break
;
case
NAME_CODE_DB_NAME
:
code
=
tlvDecodeCStr
(
pTlv
,
pNode
->
dbname
);
code
=
tlvDecodeCStr
(
pTlv
,
pNode
->
dbname
,
sizeof
(
pNode
->
dbname
)
);
break
;
case
NAME_CODE_TABLE_NAME
:
code
=
tlvDecodeCStr
(
pTlv
,
pNode
->
tname
);
code
=
tlvDecodeCStr
(
pTlv
,
pNode
->
tname
,
sizeof
(
pNode
->
tname
)
);
break
;
default:
break
;
...
...
@@ -1538,7 +1546,7 @@ static int32_t msgToEp(STlvDecoder* pDecoder, void* pObj) {
tlvForEach
(
pDecoder
,
pTlv
,
code
)
{
switch
(
pTlv
->
type
)
{
case
EP_CODE_FQDN
:
code
=
tlvDecodeCStr
(
pTlv
,
pNode
->
fqdn
);
code
=
tlvDecodeCStr
(
pTlv
,
pNode
->
fqdn
,
sizeof
(
pNode
->
fqdn
)
);
break
;
case
EP_CODE_port
:
code
=
tlvDecodeU16
(
pTlv
,
&
pNode
->
port
);
...
...
@@ -3207,7 +3215,7 @@ static int32_t msgToPhysiQueryInsertNode(STlvDecoder* pDecoder, void* pObj) {
code
=
tlvDecodeI8
(
pTlv
,
&
pNode
->
tableType
);
break
;
case
PHY_QUERY_INSERT_CODE_TABLE_NAME
:
code
=
tlvDecodeCStr
(
pTlv
,
pNode
->
tableName
);
code
=
tlvDecodeCStr
(
pTlv
,
pNode
->
tableName
,
sizeof
(
pNode
->
tableName
)
);
break
;
case
PHY_QUERY_INSERT_CODE_VG_ID
:
code
=
tlvDecodeI32
(
pTlv
,
&
pNode
->
vgId
);
...
...
@@ -3284,10 +3292,10 @@ static int32_t msgToPhysiDeleteNode(STlvDecoder* pDecoder, void* pObj) {
code
=
tlvDecodeI8
(
pTlv
,
&
pNode
->
tableType
);
break
;
case
PHY_DELETER_CODE_TABLE_FNAME
:
code
=
tlvDecodeCStr
(
pTlv
,
pNode
->
tableFName
);
code
=
tlvDecodeCStr
(
pTlv
,
pNode
->
tableFName
,
sizeof
(
pNode
->
tableFName
)
);
break
;
case
PHY_DELETER_CODE_TS_COL_NAME
:
code
=
tlvDecodeCStr
(
pTlv
,
pNode
->
tsColName
);
code
=
tlvDecodeCStr
(
pTlv
,
pNode
->
tsColName
,
sizeof
(
pNode
->
tsColName
)
);
break
;
case
PHY_DELETER_CODE_DELETE_TIME_RANGE
:
code
=
tlvDecodeObjFromTlv
(
pTlv
,
msgToTimeWindow
,
&
pNode
->
deleteTimeRange
);
...
...
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
3cce1787
...
...
@@ -209,6 +209,10 @@ int64_t nodesMakeAllocatorWeakRef(int64_t allocatorId) {
}
SNodeAllocator
*
pAllocator
=
taosAcquireRef
(
g_allocatorReqRefPool
,
allocatorId
);
if
(
NULL
==
pAllocator
)
{
nodesError
(
"allocator id %"
PRIx64
" weak reference failed"
,
allocatorId
);
return
-
1
;
}
return
pAllocator
->
self
;
}
...
...
@@ -1716,9 +1720,10 @@ static EDealRes doCollect(SCollectColumnsCxt* pCxt, SColumnNode* pCol, SNode* pN
char
name
[
TSDB_TABLE_NAME_LEN
+
TSDB_COL_NAME_LEN
];
int32_t
len
=
0
;
if
(
'\0'
==
pCol
->
tableAlias
[
0
])
{
len
=
sprintf
(
name
,
"%s"
,
pCol
->
colName
);
len
=
snprintf
(
name
,
sizeof
(
name
),
"%s"
,
pCol
->
colName
);
}
else
{
len
=
snprintf
(
name
,
sizeof
(
name
),
"%s.%s"
,
pCol
->
tableAlias
,
pCol
->
colName
);
}
len
=
sprintf
(
name
,
"%s.%s"
,
pCol
->
tableAlias
,
pCol
->
colName
);
if
(
NULL
==
taosHashGet
(
pCxt
->
pColHash
,
name
,
len
))
{
pCxt
->
errCode
=
taosHashPut
(
pCxt
->
pColHash
,
name
,
len
,
NULL
,
0
);
if
(
TSDB_CODE_SUCCESS
==
pCxt
->
errCode
)
{
...
...
source/libs/parser/inc/parToken.h
浏览文件 @
3cce1787
...
...
@@ -175,8 +175,6 @@ _end:
void
taosCleanupKeywordsTable
();
SToken
tscReplaceStrToken
(
char
**
str
,
SToken
*
token
,
const
char
*
newToken
);
SToken
taosTokenDup
(
SToken
*
pToken
,
char
*
buf
,
int32_t
len
);
#ifdef __cplusplus
...
...
source/libs/parser/src/parAstCreater.c
浏览文件 @
3cce1787
...
...
@@ -513,7 +513,7 @@ SNode* createRealTableNode(SAstCreateContext* pCxt, SToken* pDbName, SToken* pTa
if
(
NULL
!=
pDbName
)
{
COPY_STRING_FORM_ID_TOKEN
(
realTable
->
table
.
dbName
,
pDbName
);
}
else
{
str
cpy
(
realTable
->
table
.
dbName
,
pCxt
->
pQueryCxt
->
db
);
str
ncpy
(
realTable
->
table
.
dbName
,
pCxt
->
pQueryCxt
->
db
,
sizeof
(
realTable
->
table
.
dbName
)
-
1
);
}
if
(
NULL
!=
pTableAlias
&&
TK_NK_NIL
!=
pTableAlias
->
type
)
{
COPY_STRING_FORM_ID_TOKEN
(
realTable
->
table
.
tableAlias
,
pTableAlias
);
...
...
@@ -594,7 +594,7 @@ SNode* createStateWindowNode(SAstCreateContext* pCxt, SNode* pExpr) {
state
->
pCol
=
createPrimaryKeyCol
(
pCxt
,
NULL
);
if
(
NULL
==
state
->
pCol
)
{
nodesDestroyNode
((
SNode
*
)
state
);
CHECK_OUT_OF_MEM
(
state
->
pCol
);
CHECK_OUT_OF_MEM
(
NULL
);
}
state
->
pExpr
=
pExpr
;
return
(
SNode
*
)
state
;
...
...
@@ -608,7 +608,7 @@ SNode* createIntervalWindowNode(SAstCreateContext* pCxt, SNode* pInterval, SNode
interval
->
pCol
=
createPrimaryKeyCol
(
pCxt
,
NULL
);
if
(
NULL
==
interval
->
pCol
)
{
nodesDestroyNode
((
SNode
*
)
interval
);
CHECK_OUT_OF_MEM
(
interval
->
pCol
);
CHECK_OUT_OF_MEM
(
NULL
);
}
interval
->
pInterval
=
pInterval
;
interval
->
pOffset
=
pOffset
;
...
...
@@ -626,7 +626,7 @@ SNode* createFillNode(SAstCreateContext* pCxt, EFillMode mode, SNode* pValues) {
fill
->
pWStartTs
=
nodesMakeNode
(
QUERY_NODE_FUNCTION
);
if
(
NULL
==
fill
->
pWStartTs
)
{
nodesDestroyNode
((
SNode
*
)
fill
);
CHECK_OUT_OF_MEM
(
fill
->
pWStartTs
);
CHECK_OUT_OF_MEM
(
NULL
);
}
strcpy
(((
SFunctionNode
*
)
fill
->
pWStartTs
)
->
functionName
,
"_wstart"
);
return
(
SNode
*
)
fill
;
...
...
@@ -1490,10 +1490,10 @@ SNode* createCreateIndexStmt(SAstCreateContext* pCxt, EIndexType type, bool igno
CHECK_OUT_OF_MEM
(
pStmt
);
pStmt
->
indexType
=
type
;
pStmt
->
ignoreExists
=
ignoreExists
;
str
cpy
(
pStmt
->
indexDbName
,
((
SRealTableNode
*
)
pIndexName
)
->
table
.
dbName
);
str
cpy
(
pStmt
->
indexName
,
((
SRealTableNode
*
)
pIndexName
)
->
table
.
tableName
);
str
cpy
(
pStmt
->
dbName
,
((
SRealTableNode
*
)
pRealTable
)
->
table
.
dbName
);
str
cpy
(
pStmt
->
tableName
,
((
SRealTableNode
*
)
pRealTable
)
->
table
.
tableName
);
str
ncpy
(
pStmt
->
indexDbName
,
((
SRealTableNode
*
)
pIndexName
)
->
table
.
dbName
,
sizeof
(
pStmt
->
indexDbName
)
-
1
);
str
ncpy
(
pStmt
->
indexName
,
((
SRealTableNode
*
)
pIndexName
)
->
table
.
tableName
,
sizeof
(
pStmt
->
indexName
)
-
1
);
str
ncpy
(
pStmt
->
dbName
,
((
SRealTableNode
*
)
pRealTable
)
->
table
.
dbName
,
sizeof
(
pStmt
->
dbName
)
-
1
);
str
ncpy
(
pStmt
->
tableName
,
((
SRealTableNode
*
)
pRealTable
)
->
table
.
tableName
,
sizeof
(
pStmt
->
tableName
)
-
1
);
nodesDestroyNode
(
pIndexName
);
nodesDestroyNode
(
pRealTable
);
pStmt
->
pCols
=
pCols
;
...
...
@@ -1520,7 +1520,7 @@ SNode* createDropIndexStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SNode*
CHECK_OUT_OF_MEM
(
pStmt
);
pStmt
->
ignoreNotExists
=
ignoreNotExists
;
strcpy
(
pStmt
->
indexDbName
,
((
SRealTableNode
*
)
pIndexName
)
->
table
.
dbName
);
str
cpy
(
pStmt
->
indexName
,
((
SRealTableNode
*
)
pIndexName
)
->
table
.
tableName
);
str
ncpy
(
pStmt
->
indexName
,
((
SRealTableNode
*
)
pIndexName
)
->
table
.
tableName
,
sizeof
(
pStmt
->
indexName
)
-
1
);
nodesDestroyNode
(
pIndexName
);
return
(
SNode
*
)
pStmt
;
}
...
...
@@ -1813,7 +1813,7 @@ SNode* createRevokeStmt(SAstCreateContext* pCxt, int64_t privileges, SToken* pDb
SNode
*
createFuncForDelete
(
SAstCreateContext
*
pCxt
,
const
char
*
pFuncName
)
{
SFunctionNode
*
pFunc
=
(
SFunctionNode
*
)
nodesMakeNode
(
QUERY_NODE_FUNCTION
);
CHECK_OUT_OF_MEM
(
pFunc
);
str
cpy
(
pFunc
->
functionName
,
pFuncName
);
str
ncpy
(
pFunc
->
functionName
,
pFuncName
,
sizeof
(
pFunc
->
functionName
)
-
1
);
if
(
TSDB_CODE_SUCCESS
!=
nodesListMakeStrictAppend
(
&
pFunc
->
pParameterList
,
createPrimaryKeyCol
(
pCxt
,
NULL
)))
{
nodesDestroyNode
((
SNode
*
)
pFunc
);
CHECK_OUT_OF_MEM
(
NULL
);
...
...
source/libs/parser/src/parInsert.c
浏览文件 @
3cce1787
...
...
@@ -378,7 +378,9 @@ static int parseTime(char** end, SToken* pToken, int16_t timePrec, int64_t* time
}
else
if
(
pToken
->
type
==
TK_TODAY
)
{
ts
=
taosGetTimestampToday
(
timePrec
);
}
else
if
(
pToken
->
type
==
TK_NK_INTEGER
)
{
toInteger
(
pToken
->
z
,
pToken
->
n
,
10
,
&
ts
);
if
(
TSDB_CODE_SUCCESS
!=
toInteger
(
pToken
->
z
,
pToken
->
n
,
10
,
&
ts
))
{
return
buildSyntaxErrMsg
(
pMsgBuf
,
"invalid timestamp format"
,
pToken
->
z
);
}
}
else
{
// parse the RFC-3339/ISO-8601 timestamp format string
if
(
taosParseTime
(
pToken
->
z
,
time
,
pToken
->
n
,
timePrec
,
tsDaylight
)
!=
TSDB_CODE_SUCCESS
)
{
return
buildSyntaxErrMsg
(
pMsgBuf
,
"invalid timestamp format"
,
pToken
->
z
);
...
...
@@ -591,8 +593,6 @@ static int32_t parseValueToken(char** end, SToken* pToken, SSchema* pSchema, int
case
TSDB_DATA_TYPE_BIGINT
:
{
if
(
TSDB_CODE_SUCCESS
!=
toInteger
(
pToken
->
z
,
pToken
->
n
,
10
,
&
iv
))
{
return
buildSyntaxErrMsg
(
pMsgBuf
,
"invalid bigint data"
,
pToken
->
z
);
}
else
if
(
!
IS_VALID_BIGINT
(
iv
))
{
return
buildSyntaxErrMsg
(
pMsgBuf
,
"bigint data overflow"
,
pToken
->
z
);
}
return
func
(
pMsgBuf
,
&
iv
,
pSchema
->
bytes
,
param
);
}
...
...
@@ -894,10 +894,7 @@ static int32_t parseTagToken(char** end, SToken* pToken, SSchema* pSchema, int16
case
TSDB_DATA_TYPE_BIGINT
:
{
if
(
TSDB_CODE_SUCCESS
!=
toInteger
(
pToken
->
z
,
pToken
->
n
,
10
,
&
iv
))
{
return
buildSyntaxErrMsg
(
pMsgBuf
,
"invalid bigint data"
,
pToken
->
z
);
}
else
if
(
!
IS_VALID_BIGINT
(
iv
))
{
return
buildSyntaxErrMsg
(
pMsgBuf
,
"bigint data overflow"
,
pToken
->
z
);
}
val
->
i64
=
iv
;
break
;
}
...
...
@@ -1173,7 +1170,7 @@ static int32_t parseUsingClause(SInsertParseContext* pCxt, int32_t tbNo, SName*
NEXT_TOKEN
(
pCxt
->
pSql
,
sToken
);
SName
sname
;
createSName
(
&
sname
,
&
sToken
,
pCxt
->
pComCxt
->
acctId
,
pCxt
->
pComCxt
->
db
,
&
pCxt
->
msg
);
CHECK_CODE
(
createSName
(
&
sname
,
&
sToken
,
pCxt
->
pComCxt
->
acctId
,
pCxt
->
pComCxt
->
db
,
&
pCxt
->
msg
)
);
char
dbFName
[
TSDB_DB_FNAME_LEN
];
tNameGetFullDbName
(
&
sname
,
dbFName
);
strcpy
(
pCxt
->
sTableName
,
sname
.
tname
);
...
...
@@ -1605,7 +1602,7 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) {
if
(
!
pCxt
->
pComCxt
->
needMultiParse
)
{
continue
;
}
else
{
parser
Info
(
"0x%"
PRIx64
" insert from csv. File is too large, do it in batches."
,
pCxt
->
pComCxt
->
requestId
);
parser
Debug
(
"0x%"
PRIx64
" insert from csv. File is too large, do it in batches."
,
pCxt
->
pComCxt
->
requestId
);
break
;
}
}
...
...
@@ -1613,7 +1610,7 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) {
return
buildSyntaxErrMsg
(
&
pCxt
->
msg
,
"keyword VALUES or FILE is expected"
,
sToken
.
z
);
}
parser
Info
(
"0x%"
PRIx64
" insert input rows: %d"
,
pCxt
->
pComCxt
->
requestId
,
pCxt
->
totalNum
);
parser
Debug
(
"0x%"
PRIx64
" insert input rows: %d"
,
pCxt
->
pComCxt
->
requestId
,
pCxt
->
totalNum
);
if
(
TSDB_QUERY_HAS_TYPE
(
pCxt
->
pOutput
->
insertType
,
TSDB_QUERY_TYPE_STMT_INSERT
))
{
SParsedDataColInfo
*
tags
=
taosMemoryMalloc
(
sizeof
(
pCxt
->
tags
));
...
...
@@ -1650,7 +1647,7 @@ static int32_t parseInsertBodyAgain(SInsertParseContext* pCxt) {
pCxt
->
pComCxt
->
needMultiParse
=
false
;
return
TSDB_CODE_SUCCESS
;
}
parser
Info
(
"0x%"
PRIx64
" insert again input rows: %d"
,
pCxt
->
pComCxt
->
requestId
,
pCxt
->
totalNum
);
parser
Debug
(
"0x%"
PRIx64
" insert again input rows: %d"
,
pCxt
->
pComCxt
->
requestId
,
pCxt
->
totalNum
);
// merge according to vgId
if
(
taosHashGetSize
(
pCxt
->
pTableBlockHashObj
)
>
0
)
{
CHECK_CODE
(
mergeTableDataBlocks
(
pCxt
->
pTableBlockHashObj
,
pCxt
->
pOutput
->
payloadType
,
&
pCxt
->
pVgDataBlocks
));
...
...
source/libs/parser/src/parInsertData.c
浏览文件 @
3cce1787
...
...
@@ -12,7 +12,7 @@
* 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/>.
*/
// clang-format off
#include "parInsertData.h"
#include "catalog.h"
...
...
@@ -25,8 +25,8 @@
(((int)(t)) == PAYLOAD_TYPE_RAW) // 0: K-V payload for non-prepare insert, 1: rawPayload for prepare insert
typedef
struct
SBlockKeyTuple
{
TSKEY
skey
;
void
*
payloadAddr
;
TSKEY
skey
;
void
*
payloadAddr
;
int16_t
index
;
}
SBlockKeyTuple
;
...
...
@@ -194,8 +194,8 @@ static int32_t createDataBlock(size_t defaultSize, int32_t rowSize, int32_t star
int32_t
buildCreateTbMsg
(
STableDataBlocks
*
pBlocks
,
SVCreateTbReq
*
pCreateTbReq
)
{
SEncoder
coder
=
{
0
};
char
*
pBuf
;
int32_t
len
;
char
*
pBuf
;
int32_t
len
;
int32_t
ret
=
0
;
tEncodeSize
(
tEncodeSVCreateTbReq
,
pCreateTbReq
,
len
,
ret
);
...
...
@@ -211,19 +211,19 @@ int32_t buildCreateTbMsg(STableDataBlocks* pBlocks, SVCreateTbReq* pCreateTbReq)
}
}
pBuf
=
pBlocks
->
pData
+
pBlocks
->
size
;
pBuf
=
pBlocks
->
pData
+
pBlocks
->
size
;
tEncoderInit
(
&
coder
,
pBuf
,
len
);
tEncodeSVCreateTbReq
(
&
coder
,
pCreateTbReq
);
int32_t
code
=
tEncodeSVCreateTbReq
(
&
coder
,
pCreateTbReq
);
tEncoderClear
(
&
coder
);
pBlocks
->
size
+=
len
;
pBlocks
->
createTbReqLen
=
len
;
return
TSDB_CODE_SUCCESS
;
return
code
;
}
int32_t
getDataBlockFromList
(
SHashObj
*
pHashList
,
void
*
id
,
int32_t
idLen
,
int32_t
size
,
int32_t
startOffset
,
int32_t
rowSize
,
STableMeta
*
pTableMeta
,
STableDataBlocks
**
dataBlocks
,
SArray
*
pBlockList
,
int32_t
getDataBlockFromList
(
SHashObj
*
pHashList
,
void
*
id
,
int32_t
idLen
,
int32_t
size
,
int32_t
startOffset
,
int32_t
rowSize
,
STableMeta
*
pTableMeta
,
STableDataBlocks
**
dataBlocks
,
SArray
*
pBlockList
,
SVCreateTbReq
*
pCreateTbReq
)
{
*
dataBlocks
=
NULL
;
STableDataBlocks
**
t1
=
(
STableDataBlocks
**
)
taosHashGet
(
pHashList
,
(
const
char
*
)
id
,
idLen
);
...
...
@@ -272,12 +272,12 @@ static void destroyDataBlock(STableDataBlocks* pDataBlock) {
}
taosMemoryFreeClear
(
pDataBlock
->
pData
);
// if (!pDataBlock->cloned) {
// free the refcount for metermeta
taosMemoryFreeClear
(
pDataBlock
->
pTableMeta
);
// if (!pDataBlock->cloned) {
// free the refcount for metermeta
taosMemoryFreeClear
(
pDataBlock
->
pTableMeta
);
destroyBoundColumnInfo
(
&
pDataBlock
->
boundColumnInfo
);
// }
destroyBoundColumnInfo
(
&
pDataBlock
->
boundColumnInfo
);
// }
taosMemoryFreeClear
(
pDataBlock
);
}
...
...
@@ -687,16 +687,16 @@ int32_t mergeTableDataBlocks(SHashObj* pHashObj, uint8_t payloadType, SArray** p
STableDataBlocks
**
p
=
taosHashIterate
(
pHashObj
,
NULL
);
STableDataBlocks
*
pOneTableBlock
=
*
p
;
SBlockKeyInfo
blkKeyInfo
=
{
0
};
// share by pOneTableBlock
SBlockRowMerger
*
pBlkRowMerger
=
NULL
;
SBlockRowMerger
*
pBlkRowMerger
=
NULL
;
while
(
pOneTableBlock
)
{
SSubmitBlk
*
pBlocks
=
(
SSubmitBlk
*
)
pOneTableBlock
->
pData
;
if
(
pBlocks
->
numOfRows
>
0
)
{
STableDataBlocks
*
dataBuf
=
NULL
;
pOneTableBlock
->
pTableMeta
->
vgId
=
pOneTableBlock
->
vgId
;
// for schemaless, restore origin vgId
int32_t
ret
=
getDataBlockFromList
(
pVnodeDataBlockHashList
,
&
pOneTableBlock
->
vgId
,
sizeof
(
pOneTableBlock
->
vgId
),
TSDB_PAYLOAD_SIZE
,
INSERT_HEAD_SIZE
,
0
,
pOneTableBlock
->
pTableMeta
,
&
dataBuf
,
pVnodeDataBlockList
,
NULL
);
pOneTableBlock
->
pTableMeta
->
vgId
=
pOneTableBlock
->
vgId
;
// for schemaless, restore origin vgId
int32_t
ret
=
getDataBlockFromList
(
pVnodeDataBlockHashList
,
&
pOneTableBlock
->
vgId
,
sizeof
(
pOneTableBlock
->
vgId
),
TSDB_PAYLOAD_SIZE
,
INSERT_HEAD_SIZE
,
0
,
pOneTableBlock
->
pTableMeta
,
&
dataBuf
,
pVnodeDataBlockList
,
NULL
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
tdFreeSBlockRowMerger
(
pBlkRowMerger
);
taosHashCleanup
(
pVnodeDataBlockHashList
);
...
...
@@ -708,7 +708,8 @@ int32_t mergeTableDataBlocks(SHashObj* pHashObj, uint8_t payloadType, SArray** p
// the maximum expanded size in byte when a row-wise data is converted to SDataRow format
int32_t
expandSize
=
isRawPayload
?
getRowExpandSize
(
pOneTableBlock
->
pTableMeta
)
:
0
;
int64_t
destSize
=
dataBuf
->
size
+
pOneTableBlock
->
size
+
pBlocks
->
numOfRows
*
expandSize
+
sizeof
(
STColumn
)
*
getNumOfColumns
(
pOneTableBlock
->
pTableMeta
)
+
pOneTableBlock
->
createTbReqLen
;
sizeof
(
STColumn
)
*
getNumOfColumns
(
pOneTableBlock
->
pTableMeta
)
+
pOneTableBlock
->
createTbReqLen
;
if
(
dataBuf
->
nAllocSize
<
destSize
)
{
dataBuf
->
nAllocSize
=
(
uint32_t
)(
destSize
*
1
.
5
);
...
...
@@ -861,7 +862,7 @@ int32_t qCloneStmtDataBlock(void** pDst, void* pSrc) {
STableDataBlocks
*
pBlock
=
(
STableDataBlocks
*
)(
*
pDst
);
if
(
pBlock
->
pTableMeta
)
{
void
*
pNewMeta
=
taosMemoryMalloc
(
TABLE_META_SIZE
(
pBlock
->
pTableMeta
));
void
*
pNewMeta
=
taosMemoryMalloc
(
TABLE_META_SIZE
(
pBlock
->
pTableMeta
));
if
(
NULL
==
pNewMeta
)
{
taosMemoryFreeClear
(
*
pDst
);
return
TSDB_CODE_OUT_OF_MEMORY
;
...
...
@@ -887,20 +888,18 @@ int32_t qRebuildStmtDataBlock(void** pDst, void* pSrc, uint64_t uid, int32_t vgI
}
pBlock
->
vgId
=
vgId
;
if
(
pBlock
->
pTableMeta
)
{
pBlock
->
pTableMeta
->
uid
=
uid
;
pBlock
->
pTableMeta
->
vgId
=
vgId
;
}
memset
(
pBlock
->
pData
,
0
,
sizeof
(
SSubmitBlk
));
return
TSDB_CODE_SUCCESS
;
}
STableMeta
*
qGetTableMetaInDataBlock
(
void
*
pDataBlock
)
{
return
((
STableDataBlocks
*
)
pDataBlock
)
->
pTableMeta
;
}
STableMeta
*
qGetTableMetaInDataBlock
(
void
*
pDataBlock
)
{
return
((
STableDataBlocks
*
)
pDataBlock
)
->
pTableMeta
;
}
void
qFreeStmtDataBlock
(
void
*
pDataBlock
)
{
if
(
pDataBlock
==
NULL
)
{
...
...
source/libs/parser/src/parTokenizer.c
浏览文件 @
3cce1787
...
...
@@ -613,27 +613,6 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) {
return
0
;
}
SToken
tscReplaceStrToken
(
char
**
str
,
SToken
*
token
,
const
char
*
newToken
)
{
char
*
src
=
*
str
;
size_t
nsize
=
strlen
(
newToken
);
int32_t
size
=
(
int32_t
)
strlen
(
*
str
)
-
token
->
n
+
(
int32_t
)
nsize
+
1
;
int32_t
bsize
=
(
int32_t
)((
uint64_t
)
token
->
z
-
(
uint64_t
)
src
);
SToken
ntoken
;
*
str
=
taosMemoryCalloc
(
1
,
size
);
strncpy
(
*
str
,
src
,
bsize
);
strcat
(
*
str
,
newToken
);
strcat
(
*
str
,
token
->
z
+
token
->
n
);
ntoken
.
n
=
(
uint32_t
)
nsize
;
ntoken
.
z
=
*
str
+
bsize
;
taosMemoryFreeClear
(
src
);
return
ntoken
;
}
SToken
tStrGetToken
(
const
char
*
str
,
int32_t
*
i
,
bool
isPrevOptr
)
{
SToken
t0
=
{
0
};
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
3cce1787
...
...
@@ -308,7 +308,7 @@ static int32_t addNamespace(STranslateContext* pCxt, void* pTable) {
static
int32_t
collectUseDatabaseImpl
(
const
char
*
pFullDbName
,
SHashObj
*
pDbs
)
{
SFullDatabaseName
name
=
{
0
};
str
cpy
(
name
.
fullDbName
,
pFullDbName
);
str
ncpy
(
name
.
fullDbName
,
pFullDbName
,
sizeof
(
name
.
fullDbName
)
-
1
);
return
taosHashPut
(
pDbs
,
pFullDbName
,
strlen
(
pFullDbName
),
&
name
,
sizeof
(
SFullDatabaseName
));
}
...
...
@@ -1061,7 +1061,7 @@ static EDealRes translateNormalValue(STranslateContext* pCxt, SValueNode* pVal,
}
case
TSDB_DATA_TYPE_BIGINT
:
{
code
=
toInteger
(
pVal
->
literal
,
strlen
(
pVal
->
literal
),
10
,
&
pVal
->
datum
.
i
);
if
(
strict
&&
(
TSDB_CODE_SUCCESS
!=
code
||
!
IS_VALID_BIGINT
(
pVal
->
datum
.
i
))
)
{
if
(
strict
&&
TSDB_CODE_SUCCESS
!=
code
)
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
pVal
->
literal
);
}
*
(
int64_t
*
)
&
pVal
->
typeData
=
pVal
->
datum
.
i
;
...
...
source/libs/planner/src/planPhysiCreater.c
浏览文件 @
3cce1787
...
...
@@ -1632,7 +1632,7 @@ static SSubplan* makeSubplan(SPhysiPlanContext* pCxt, SLogicSubplan* pLogicSubpl
pSubplan
->
subplanType
=
pLogicSubplan
->
subplanType
;
pSubplan
->
level
=
pLogicSubplan
->
level
;
if
(
NULL
!=
pCxt
->
pPlanCxt
->
pUser
)
{
str
cpy
(
pSubplan
->
user
,
pCxt
->
pPlanCxt
->
pUser
);
str
ncpy
(
pSubplan
->
user
,
pCxt
->
pPlanCxt
->
pUser
,
sizeof
(
pSubplan
->
user
)
-
1
);
}
return
pSubplan
;
}
...
...
source/libs/planner/src/planSpliter.c
浏览文件 @
3cce1787
...
...
@@ -342,7 +342,7 @@ static int32_t stbSplAppendWStart(SNodeList* pFuncs, int32_t* pIndex) {
return
TSDB_CODE_OUT_OF_MEMORY
;
}
strcpy
(
pWStart
->
functionName
,
"_wstart"
);
snprintf
(
pWStart
->
node
.
aliasName
,
sizeof
(
pWStart
->
node
.
aliasName
),
"%s.%p"
,
pWStart
->
functionName
,
pWStart
);
snprintf
(
pWStart
->
node
.
aliasName
,
sizeof
(
pWStart
->
node
.
aliasName
),
"%s.%p"
,
pWStart
->
functionName
,
(
void
*
)
pWStart
);
int32_t
code
=
fmGetFuncInfo
(
pWStart
,
NULL
,
0
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
nodesListStrictAppend
(
pFuncs
,
(
SNode
*
)
pWStart
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录