Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9a946541
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看板
提交
9a946541
编写于
10月 13, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh: do coverity scan
上级
242a53c2
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
63 addition
and
120 deletion
+63
-120
source/libs/parser/src/parAstCreater.c
source/libs/parser/src/parAstCreater.c
+8
-8
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+23
-15
source/libs/parser/src/parUtil.c
source/libs/parser/src/parUtil.c
+3
-2
source/libs/planner/src/planLogicCreater.c
source/libs/planner/src/planLogicCreater.c
+2
-2
source/libs/planner/src/planOptimizer.c
source/libs/planner/src/planOptimizer.c
+3
-71
source/libs/planner/src/planPhysiCreater.c
source/libs/planner/src/planPhysiCreater.c
+13
-9
source/libs/planner/src/planSpliter.c
source/libs/planner/src/planSpliter.c
+11
-13
未找到文件。
source/libs/parser/src/parAstCreater.c
浏览文件 @
9a946541
...
...
@@ -518,7 +518,7 @@ SNode* createRealTableNode(SAstCreateContext* pCxt, SToken* pDbName, SToken* pTa
if
(
NULL
!=
pDbName
)
{
COPY_STRING_FORM_ID_TOKEN
(
realTable
->
table
.
dbName
,
pDbName
);
}
else
{
s
trncpy
(
realTable
->
table
.
dbName
,
pCxt
->
pQueryCxt
->
db
,
sizeof
(
realTable
->
table
.
dbName
)
-
1
);
s
nprintf
(
realTable
->
table
.
dbName
,
sizeof
(
realTable
->
table
.
dbName
),
"%s"
,
pCxt
->
pQueryCxt
->
db
);
}
if
(
NULL
!=
pTableAlias
&&
TK_NK_NIL
!=
pTableAlias
->
type
)
{
COPY_STRING_FORM_ID_TOKEN
(
realTable
->
table
.
tableAlias
,
pTableAlias
);
...
...
@@ -1495,10 +1495,10 @@ SNode* createCreateIndexStmt(SAstCreateContext* pCxt, EIndexType type, bool igno
CHECK_OUT_OF_MEM
(
pStmt
);
pStmt
->
indexType
=
type
;
pStmt
->
ignoreExists
=
ignoreExists
;
s
trncpy
(
pStmt
->
indexDbName
,
((
SRealTableNode
*
)
pIndexName
)
->
table
.
dbName
,
sizeof
(
pStmt
->
indexDbName
)
-
1
);
s
trncpy
(
pStmt
->
indexName
,
((
SRealTableNode
*
)
pIndexName
)
->
table
.
tableName
,
sizeof
(
pStmt
->
indexName
)
-
1
);
s
trncpy
(
pStmt
->
dbName
,
((
SRealTableNode
*
)
pRealTable
)
->
table
.
dbName
,
sizeof
(
pStmt
->
dbName
)
-
1
);
s
trncpy
(
pStmt
->
tableName
,
((
SRealTableNode
*
)
pRealTable
)
->
table
.
tableName
,
sizeof
(
pStmt
->
tableName
)
-
1
);
s
nprintf
(
pStmt
->
indexDbName
,
sizeof
(
pStmt
->
indexDbName
),
"%s"
,
((
SRealTableNode
*
)
pIndexName
)
->
table
.
dbName
);
s
nprintf
(
pStmt
->
indexName
,
sizeof
(
pStmt
->
indexName
),
"%s"
,
((
SRealTableNode
*
)
pIndexName
)
->
table
.
tableName
);
s
nprintf
(
pStmt
->
dbName
,
sizeof
(
pStmt
->
dbName
),
"%s"
,
((
SRealTableNode
*
)
pRealTable
)
->
table
.
dbName
);
s
nprintf
(
pStmt
->
tableName
,
sizeof
(
pStmt
->
tableName
),
"%s"
,
((
SRealTableNode
*
)
pRealTable
)
->
table
.
tableName
);
nodesDestroyNode
(
pIndexName
);
nodesDestroyNode
(
pRealTable
);
pStmt
->
pCols
=
pCols
;
...
...
@@ -1524,8 +1524,8 @@ SNode* createDropIndexStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SNode*
SDropIndexStmt
*
pStmt
=
(
SDropIndexStmt
*
)
nodesMakeNode
(
QUERY_NODE_DROP_INDEX_STMT
);
CHECK_OUT_OF_MEM
(
pStmt
);
pStmt
->
ignoreNotExists
=
ignoreNotExists
;
s
trcpy
(
pStmt
->
indexDbName
,
((
SRealTableNode
*
)
pIndexName
)
->
table
.
dbName
);
s
trncpy
(
pStmt
->
indexName
,
((
SRealTableNode
*
)
pIndexName
)
->
table
.
tableName
,
sizeof
(
pStmt
->
indexName
)
-
1
);
s
nprintf
(
pStmt
->
indexDbName
,
sizeof
(
pStmt
->
indexDbName
),
"%s"
,
((
SRealTableNode
*
)
pIndexName
)
->
table
.
dbName
);
s
nprintf
(
pStmt
->
indexName
,
sizeof
(
pStmt
->
indexName
),
"%s"
,
((
SRealTableNode
*
)
pIndexName
)
->
table
.
tableName
);
nodesDestroyNode
(
pIndexName
);
return
(
SNode
*
)
pStmt
;
}
...
...
@@ -1818,7 +1818,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
);
s
trncpy
(
pFunc
->
functionName
,
pFuncName
,
sizeof
(
pFunc
->
functionName
)
-
1
);
s
nprintf
(
pFunc
->
functionName
,
sizeof
(
pFunc
->
functionName
),
"%s"
,
pFuncName
);
if
(
TSDB_CODE_SUCCESS
!=
nodesListMakeStrictAppend
(
&
pFunc
->
pParameterList
,
createPrimaryKeyCol
(
pCxt
,
NULL
)))
{
nodesDestroyNode
((
SNode
*
)
pFunc
);
CHECK_OUT_OF_MEM
(
NULL
);
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
9a946541
...
...
@@ -292,9 +292,13 @@ static int32_t addNamespace(STranslateContext* pCxt, void* pTable) {
}
else
{
do
{
SArray
*
pTables
=
taosArrayInit
(
TARRAY_MIN_SIZE
,
POINTER_BYTES
);
if
(
NULL
==
pTables
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
if
(
pCxt
->
currLevel
==
currTotalLevel
)
{
taosArrayPush
(
pTables
,
&
pTable
);
if
(
hasSameTableAlias
(
pTables
))
{
taosArrayDestroy
(
pTables
);
return
generateSyntaxErrMsgExt
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_NOT_UNIQUE_TABLE_ALIAS
,
"Not unique table/alias: '%s'"
,
((
STableNode
*
)
pTable
)
->
tableAlias
);
}
...
...
@@ -540,15 +544,17 @@ static int32_t getTableIndex(STranslateContext* pCxt, const SName* pName, SArray
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
collectUseTable
(
pName
,
pCxt
->
pTables
);
}
if
(
pParCxt
->
async
)
{
code
=
getTableIndexFromCache
(
pCxt
->
pMetaCache
,
pName
,
pIndexes
);
}
else
{
SRequestConnInfo
conn
=
{.
pTrans
=
pParCxt
->
pTransporter
,
.
requestId
=
pParCxt
->
requestId
,
.
requestObjRefId
=
pParCxt
->
requestRid
,
.
mgmtEps
=
pParCxt
->
mgmtEpSet
};
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
pParCxt
->
async
)
{
code
=
getTableIndexFromCache
(
pCxt
->
pMetaCache
,
pName
,
pIndexes
);
}
else
{
SRequestConnInfo
conn
=
{.
pTrans
=
pParCxt
->
pTransporter
,
.
requestId
=
pParCxt
->
requestId
,
.
requestObjRefId
=
pParCxt
->
requestRid
,
.
mgmtEps
=
pParCxt
->
mgmtEpSet
};
code
=
catalogGetTableIndex
(
pParCxt
->
pCatalog
,
&
conn
,
pName
,
pIndexes
);
code
=
catalogGetTableIndex
(
pParCxt
->
pCatalog
,
&
conn
,
pName
,
pIndexes
);
}
}
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
parserError
(
"0x%"
PRIx64
" getTableIndex error, code:%s, dbName:%s, tbName:%s"
,
pCxt
->
pParseCxt
->
requestId
,
...
...
@@ -990,9 +996,9 @@ static int32_t parseTimeFromValueNode(STranslateContext* pCxt, SValueNode* pVal)
return
pCxt
->
errCode
;
}
if
(
IS_UNSIGNED_NUMERIC_TYPE
(
pVal
->
node
.
resType
.
type
))
{
pVal
->
datum
.
i
=
pVal
->
datum
.
u
;
pVal
->
datum
.
i
=
(
int64_t
)
pVal
->
datum
.
u
;
}
else
if
(
IS_FLOAT_TYPE
(
pVal
->
node
.
resType
.
type
))
{
pVal
->
datum
.
i
=
pVal
->
datum
.
d
;
pVal
->
datum
.
i
=
(
int64_t
)
pVal
->
datum
.
d
;
}
else
if
(
TSDB_DATA_TYPE_BOOL
==
pVal
->
node
.
resType
.
type
)
{
pVal
->
datum
.
i
=
pVal
->
datum
.
b
;
}
...
...
@@ -1888,6 +1894,7 @@ static EDealRes translateCaseWhen(STranslateContext* pCxt, SCaseWhenNode* pCaseW
pWhenThen
->
pWhen
=
pIsTrue
;
}
if
(
first
)
{
first
=
false
;
pCaseWhen
->
node
.
resType
=
((
SExprNode
*
)
pNode
)
->
resType
;
}
else
if
(
!
dataTypeEqual
(
&
pCaseWhen
->
node
.
resType
,
&
((
SExprNode
*
)
pNode
)
->
resType
))
{
SNode
*
pCastFunc
=
NULL
;
...
...
@@ -3877,7 +3884,7 @@ static int32_t checkDbStrictOption(STranslateContext* pCxt, SDatabaseOptions* pO
static
int32_t
checkDbEnumOption
(
STranslateContext
*
pCxt
,
const
char
*
pName
,
int32_t
val
,
int32_t
v1
,
int32_t
v2
)
{
if
(
val
>=
0
&&
val
!=
v1
&&
val
!=
v2
)
{
return
generateSyntaxErrMsgExt
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_DB_OPTION
,
"Invalid option %s: %
"
PRId64
"
, only %d, %d allowed"
,
pName
,
val
,
v1
,
v2
);
"Invalid option %s: %
d
, only %d, %d allowed"
,
pName
,
val
,
v1
,
v2
);
}
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -4462,8 +4469,8 @@ static int32_t buildSampleAst(STranslateContext* pCxt, SSampleAstInfo* pInfo, ch
nodesDestroyNode
((
SNode
*
)
pSelect
);
return
TSDB_CODE_OUT_OF_MEMORY
;
}
s
trcpy
(
pTable
->
table
.
dbName
,
pInfo
->
pDbName
);
s
trcpy
(
pTable
->
table
.
tableName
,
pInfo
->
pTableName
);
s
nprintf
(
pTable
->
table
.
dbName
,
sizeof
(
pTable
->
table
.
dbName
),
"%s"
,
pInfo
->
pDbName
);
s
nprintf
(
pTable
->
table
.
tableName
,
sizeof
(
pTable
->
table
.
tableName
),
"%s"
,
pInfo
->
pTableName
);
TSWAP
(
pTable
->
pMeta
,
pInfo
->
pRollupTableMeta
);
pSelect
->
pFromTable
=
(
SNode
*
)
pTable
;
...
...
@@ -6048,7 +6055,7 @@ static SNode* createProjectCol(const char* pProjCol) {
if
(
NULL
==
pCol
)
{
return
NULL
;
}
s
trcpy
(
pCol
->
colName
,
pProjCol
);
s
nprintf
(
pCol
->
colName
,
sizeof
(
pCol
->
colName
),
"%s"
,
pProjCol
);
return
(
SNode
*
)
pCol
;
}
...
...
@@ -7124,8 +7131,9 @@ static int32_t buildUpdateOptionsReq(STranslateContext* pCxt, SAlterTableStmt* p
pReq
->
newComment
=
strdup
(
pStmt
->
pOptions
->
comment
);
if
(
NULL
==
pReq
->
newComment
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
}
else
{
pReq
->
newCommentLen
=
strlen
(
pReq
->
newComment
);
}
pReq
->
newCommentLen
=
strlen
(
pReq
->
newComment
);
}
else
{
pReq
->
newCommentLen
=
-
1
;
}
...
...
source/libs/parser/src/parUtil.c
浏览文件 @
9a946541
...
...
@@ -381,6 +381,7 @@ int32_t parseJsontoTagData(const char* json, SArray* pTagVals, STag** ppTag, voi
uError
(
"charset:%s to %s. val:%s, errno:%s, convert failed."
,
DEFAULT_UNICODE_ENCODEC
,
tsCharset
,
jsonValue
,
strerror
(
errno
));
retCode
=
buildSyntaxErrMsg
(
pMsgBuf
,
"charset convert json error"
,
jsonValue
);
taosMemoryFree
(
tmp
);
goto
end
;
}
val
.
nData
=
valLen
;
...
...
@@ -652,8 +653,8 @@ static int32_t buildCatalogReqForInsert(SParseContext* pCxt, const SParseMetaCac
}
SUserAuthInfo
auth
=
{
0
};
s
trcpy
(
auth
.
user
,
pCxt
->
pUser
);
s
trcpy
(
auth
.
dbFName
,
p
->
dbFName
);
s
nprintf
(
auth
.
user
,
sizeof
(
auth
.
user
),
"%s"
,
pCxt
->
pUser
);
s
nprintf
(
auth
.
dbFName
,
sizeof
(
auth
.
dbFName
),
"%s"
,
p
->
dbFName
);
auth
.
type
=
AUTH_TYPE_WRITE
;
taosArrayPush
(
pCatalogReq
->
pUser
,
&
auth
);
...
...
source/libs/planner/src/planLogicCreater.c
浏览文件 @
9a946541
...
...
@@ -459,9 +459,9 @@ static SColumnNode* createColumnByExpr(const char* pStmtName, SExprNode* pExpr)
return
NULL
;
}
pCol
->
node
.
resType
=
pExpr
->
resType
;
s
trcpy
(
pCol
->
colName
,
pExpr
->
aliasName
);
s
nprintf
(
pCol
->
colName
,
sizeof
(
pCol
->
colName
),
"%s"
,
pExpr
->
aliasName
);
if
(
NULL
!=
pStmtName
)
{
s
trcpy
(
pCol
->
tableAlias
,
pStmtName
);
s
nprintf
(
pCol
->
tableAlias
,
sizeof
(
pCol
->
tableAlias
),
"%s"
,
pStmtName
);
}
return
pCol
;
}
...
...
source/libs/planner/src/planOptimizer.c
浏览文件 @
9a946541
...
...
@@ -1124,7 +1124,7 @@ static int32_t sortPriKeyOptGetSequencingNodes(SLogicNode* pNode, SNodeList** pS
bool
notOptimize
=
false
;
int32_t
code
=
sortPriKeyOptGetSequencingNodesImpl
(
pNode
,
&
notOptimize
,
pSequencingNodes
);
if
(
TSDB_CODE_SUCCESS
!=
code
||
notOptimize
)
{
nodesClearList
(
*
pSequencingNodes
);
NODES_CLEAR_LIST
(
*
pSequencingNodes
);
}
return
code
;
}
...
...
@@ -1361,74 +1361,6 @@ static int32_t smaIndexOptCouldApplyIndex(SScanLogicNode* pScan, STableIndexInfo
return
code
;
}
static
SNode
*
smaIndexOptCreateWStartTs
()
{
SFunctionNode
*
pWStart
=
(
SFunctionNode
*
)
nodesMakeNode
(
QUERY_NODE_FUNCTION
);
if
(
NULL
==
pWStart
)
{
return
NULL
;
}
strcpy
(
pWStart
->
functionName
,
"_wstart"
);
snprintf
(
pWStart
->
node
.
aliasName
,
sizeof
(
pWStart
->
node
.
aliasName
),
"%s.%p"
,
pWStart
->
functionName
,
pWStart
);
if
(
TSDB_CODE_SUCCESS
!=
fmGetFuncInfo
(
pWStart
,
NULL
,
0
))
{
nodesDestroyNode
((
SNode
*
)
pWStart
);
return
NULL
;
}
return
(
SNode
*
)
pWStart
;
}
static
int32_t
smaIndexOptCreateMergeKey
(
SNode
*
pCol
,
SNodeList
**
pMergeKeys
)
{
SOrderByExprNode
*
pMergeKey
=
(
SOrderByExprNode
*
)
nodesMakeNode
(
QUERY_NODE_ORDER_BY_EXPR
);
if
(
NULL
==
pMergeKey
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
pMergeKey
->
pExpr
=
nodesCloneNode
(
pCol
);
if
(
NULL
==
pMergeKey
->
pExpr
)
{
nodesDestroyNode
((
SNode
*
)
pMergeKey
);
return
TSDB_CODE_OUT_OF_MEMORY
;
}
pMergeKey
->
order
=
ORDER_ASC
;
pMergeKey
->
nullOrder
=
NULL_ORDER_FIRST
;
return
nodesListMakeStrictAppend
(
pMergeKeys
,
(
SNode
*
)
pMergeKey
);
}
static
int32_t
smaIndexOptRewriteInterval
(
SWindowLogicNode
*
pInterval
,
int32_t
wstrartIndex
,
SNodeList
**
pMergeKeys
)
{
if
(
wstrartIndex
<
0
)
{
SNode
*
pWStart
=
smaIndexOptCreateWStartTs
();
if
(
NULL
==
pWStart
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
int32_t
code
=
createColumnByRewriteExpr
(
pWStart
,
&
pInterval
->
node
.
pTargets
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
nodesDestroyNode
(
pWStart
);
return
code
;
}
wstrartIndex
=
LIST_LENGTH
(
pInterval
->
node
.
pTargets
)
-
1
;
}
return
smaIndexOptCreateMergeKey
(
nodesListGetNode
(
pInterval
->
node
.
pTargets
,
wstrartIndex
),
pMergeKeys
);
}
static
int32_t
smaIndexOptApplyIndexExt
(
SLogicSubplan
*
pLogicSubplan
,
SScanLogicNode
*
pScan
,
STableIndexInfo
*
pIndex
,
SNodeList
*
pSmaCols
,
int32_t
wstrartIndex
)
{
SWindowLogicNode
*
pInterval
=
(
SWindowLogicNode
*
)
pScan
->
node
.
pParent
;
SNodeList
*
pMergeTargets
=
nodesCloneList
(
pInterval
->
node
.
pTargets
);
if
(
NULL
==
pMergeTargets
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
SLogicNode
*
pSmaScan
=
NULL
;
SLogicNode
*
pMerge
=
NULL
;
SNodeList
*
pMergeKeys
=
NULL
;
int32_t
code
=
smaIndexOptRewriteInterval
(
pInterval
,
wstrartIndex
,
&
pMergeKeys
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
smaIndexOptCreateSmaScan
(
pScan
,
pIndex
,
pSmaCols
,
&
pSmaScan
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
smaIndexOptCreateMerge
(
pScan
->
node
.
pParent
,
pMergeKeys
,
pMergeTargets
,
&
pMerge
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
smaIndexOptRecombinationNode
(
pLogicSubplan
,
pScan
->
node
.
pParent
,
pMerge
,
pSmaScan
);
}
return
code
;
}
static
int32_t
smaIndexOptApplyIndex
(
SLogicSubplan
*
pLogicSubplan
,
SScanLogicNode
*
pScan
,
STableIndexInfo
*
pIndex
,
SNodeList
*
pSmaCols
,
int32_t
wstrartIndex
)
{
SLogicNode
*
pSmaScan
=
NULL
;
...
...
@@ -1559,7 +1491,7 @@ static SNode* partTagsCreateWrapperFunc(const char* pFuncName, SNode* pNode) {
return
NULL
;
}
s
trcpy
(
pFunc
->
functionName
,
pFuncName
);
s
nprintf
(
pFunc
->
functionName
,
sizeof
(
pFunc
->
functionName
),
"%s"
,
pFuncName
);
if
(
QUERY_NODE_COLUMN
==
nodeType
(
pNode
)
&&
COLUMN_TYPE_TBNAME
!=
((
SColumnNode
*
)
pNode
)
->
colType
)
{
SColumnNode
*
pCol
=
(
SColumnNode
*
)
pNode
;
partTagsSetAlias
(
pFunc
->
node
.
aliasName
,
sizeof
(
pFunc
->
node
.
aliasName
),
pCol
->
tableAlias
,
pCol
->
colName
);
...
...
@@ -2028,7 +1960,7 @@ static SNode* rewriteUniqueOptCreateFirstFunc(SFunctionNode* pSelectValue, SNode
if
(
NULL
!=
pSelectValue
)
{
strcpy
(
pFunc
->
node
.
aliasName
,
pSelectValue
->
node
.
aliasName
);
}
else
{
snprintf
(
pFunc
->
node
.
aliasName
,
sizeof
(
pFunc
->
node
.
aliasName
),
"%s.%p"
,
pFunc
->
functionName
,
pFunc
);
snprintf
(
pFunc
->
node
.
aliasName
,
sizeof
(
pFunc
->
node
.
aliasName
),
"%s.%p"
,
pFunc
->
functionName
,
(
void
*
)
pFunc
);
}
int32_t
code
=
nodesListMakeStrictAppend
(
&
pFunc
->
pParameterList
,
nodesCloneNode
(
pCol
));
if
(
TSDB_CODE_SUCCESS
==
code
)
{
...
...
source/libs/planner/src/planPhysiCreater.c
浏览文件 @
9a946541
...
...
@@ -67,7 +67,7 @@ static SNode* createSlotDesc(SPhysiPlanContext* pCxt, const char* pName, const S
if
(
NULL
==
pSlot
)
{
return
NULL
;
}
s
trcpy
(
pSlot
->
name
,
pName
);
s
nprintf
(
pSlot
->
name
,
sizeof
(
pSlot
->
name
),
"%s"
,
pName
);
pSlot
->
slotId
=
slotId
;
pSlot
->
dataType
=
((
SExprNode
*
)
pNode
)
->
resType
;
pSlot
->
reserve
=
reserve
;
...
...
@@ -663,13 +663,17 @@ static int32_t createJoinPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren
code
=
addDataBlockSlots
(
pCxt
,
pJoin
->
pTargets
,
pJoin
->
node
.
pOutputDataBlockDesc
);
}
SNodeList
*
condCols
=
nodesMakeList
();
if
(
TSDB_CODE_SUCCESS
==
code
&&
NULL
!=
pJoinLogicNode
->
pOnConditions
)
{
code
=
nodesCollectColumnsFromNode
(
pJoinLogicNode
->
pOnConditions
,
NULL
,
COLLECT_COL_TYPE_ALL
,
&
condCols
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
addDataBlockSlots
(
pCxt
,
condCols
,
pJoin
->
node
.
pOutputDataBlockDesc
);
nodesDestroyList
(
condCols
);
SNodeList
*
pCondCols
=
nodesMakeList
();
if
(
NULL
==
pCondCols
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
}
else
{
code
=
nodesCollectColumnsFromNode
(
pJoinLogicNode
->
pOnConditions
,
NULL
,
COLLECT_COL_TYPE_ALL
,
&
pCondCols
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
addDataBlockSlots
(
pCxt
,
pCondCols
,
pJoin
->
node
.
pOutputDataBlockDesc
);
}
nodesDestroyList
(
pCondCols
);
}
if
(
TSDB_CODE_SUCCESS
==
code
&&
NULL
!=
pJoinLogicNode
->
pOnConditions
)
{
...
...
@@ -1633,7 +1637,7 @@ static SSubplan* makeSubplan(SPhysiPlanContext* pCxt, SLogicSubplan* pLogicSubpl
pSubplan
->
subplanType
=
pLogicSubplan
->
subplanType
;
pSubplan
->
level
=
pLogicSubplan
->
level
;
if
(
NULL
!=
pCxt
->
pPlanCxt
->
pUser
)
{
s
trncpy
(
pSubplan
->
user
,
pCxt
->
pPlanCxt
->
pUser
,
sizeof
(
pSubplan
->
user
)
-
1
);
s
nprintf
(
pSubplan
->
user
,
sizeof
(
pSubplan
->
user
),
"%s"
,
pCxt
->
pPlanCxt
->
pUser
);
}
return
pSubplan
;
}
...
...
@@ -1824,7 +1828,7 @@ static int32_t pushSubplan(SPhysiPlanContext* pCxt, SNode* pSubplan, int32_t lev
return
TSDB_CODE_OUT_OF_MEMORY
;
}
}
return
nodesList
Strict
Append
(
pGroup
->
pNodeList
,
(
SNode
*
)
pSubplan
);
return
nodesListAppend
(
pGroup
->
pNodeList
,
(
SNode
*
)
pSubplan
);
}
static
int32_t
buildPhysiPlan
(
SPhysiPlanContext
*
pCxt
,
SLogicSubplan
*
pLogicSubplan
,
SSubplan
*
pParent
,
...
...
source/libs/planner/src/planSpliter.c
浏览文件 @
9a946541
...
...
@@ -367,7 +367,7 @@ static int32_t stbSplAppendWEnd(SWindowLogicNode* pWin, int32_t* pIndex) {
return
TSDB_CODE_OUT_OF_MEMORY
;
}
strcpy
(
pWEnd
->
functionName
,
"_wend"
);
snprintf
(
pWEnd
->
node
.
aliasName
,
sizeof
(
pWEnd
->
node
.
aliasName
),
"%s.%p"
,
pWEnd
->
functionName
,
pWEnd
);
snprintf
(
pWEnd
->
node
.
aliasName
,
sizeof
(
pWEnd
->
node
.
aliasName
),
"%s.%p"
,
pWEnd
->
functionName
,
(
void
*
)
pWEnd
);
int32_t
code
=
fmGetFuncInfo
(
pWEnd
,
NULL
,
0
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
nodesListStrictAppend
(
pWin
->
pFuncs
,
(
SNode
*
)
pWEnd
);
...
...
@@ -389,22 +389,19 @@ static int32_t stbSplCreatePartWindowNode(SWindowLogicNode* pMergeWindow, SLogic
SNode
*
pConditions
=
pMergeWindow
->
node
.
pConditions
;
pMergeWindow
->
node
.
pConditions
=
NULL
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
SWindowLogicNode
*
pPartWin
=
(
SWindowLogicNode
*
)
nodesCloneNode
((
SNode
*
)
pMergeWindow
);
if
(
NULL
==
pPartWin
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
pPartWin
->
node
.
groupAction
=
GROUP_ACTION_KEEP
;
pMergeWindow
->
node
.
pTargets
=
pTargets
;
pMergeWindow
->
node
.
pConditions
=
pConditions
;
pPartWin
->
node
.
pChildren
=
pChildren
;
splSetParent
((
SLogicNode
*
)
pPartWin
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
pMergeWindow
->
node
.
pTargets
=
pTargets
;
pMergeWindow
->
node
.
pConditions
=
pConditions
;
pPartWin
->
node
.
pChildren
=
pChildren
;
splSetParent
((
SLogicNode
*
)
pPartWin
);
code
=
stbSplRewriteFuns
(
pFunc
,
&
pPartWin
->
pFuncs
,
&
pMergeWindow
->
pFuncs
);
}
int32_t
index
=
0
;
int32_t
code
=
stbSplRewriteFuns
(
pFunc
,
&
pPartWin
->
pFuncs
,
&
pMergeWindow
->
pFuncs
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
stbSplAppendWStart
(
pPartWin
->
pFuncs
,
&
index
);
}
...
...
@@ -721,15 +718,16 @@ static int32_t stbSplCreatePartAggNode(SAggLogicNode* pMergeAgg, SLogicNode** pO
SNode
*
pConditions
=
pMergeAgg
->
node
.
pConditions
;
pMergeAgg
->
node
.
pConditions
=
NULL
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
SAggLogicNode
*
pPartAgg
=
(
SAggLogicNode
*
)
nodesCloneNode
((
SNode
*
)
pMergeAgg
);
if
(
NULL
==
pPartAgg
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
pPartAgg
->
node
.
groupAction
=
GROUP_ACTION_KEEP
;
if
(
TSDB_CODE_SUCCESS
==
code
&&
NULL
!=
pGroupKeys
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
if
(
NULL
!=
pGroupKeys
)
{
pPartAgg
->
pGroupKeys
=
pGroupKeys
;
code
=
createColumnByRewriteExprs
(
pPartAgg
->
pGroupKeys
,
&
pPartAgg
->
node
.
pTargets
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录