Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9aa35c2e
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看板
提交
9aa35c2e
编写于
7月 08, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: sql command 'insert ... select'
上级
80172d5c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
32 addition
and
29 deletion
+32
-29
source/libs/planner/src/planLogicCreater.c
source/libs/planner/src/planLogicCreater.c
+12
-5
source/libs/planner/src/planSpliter.c
source/libs/planner/src/planSpliter.c
+18
-22
tests/script/jenkins/basic.txt
tests/script/jenkins/basic.txt
+2
-2
未找到文件。
source/libs/planner/src/planLogicCreater.c
浏览文件 @
9aa35c2e
...
...
@@ -1340,6 +1340,17 @@ static void doSetLogicNodeParent(SLogicNode* pNode, SLogicNode* pParent) {
static
void
setLogicNodeParent
(
SLogicNode
*
pNode
)
{
doSetLogicNodeParent
(
pNode
,
NULL
);
}
static
void
setLogicSubplanType
(
SLogicSubplan
*
pSubplan
)
{
if
(
QUERY_NODE_LOGIC_PLAN_VNODE_MODIFY
!=
nodeType
(
pSubplan
->
pNode
))
{
pSubplan
->
subplanType
=
SUBPLAN_TYPE_SCAN
;
}
else
{
SVnodeModifyLogicNode
*
pModify
=
(
SVnodeModifyLogicNode
*
)
pSubplan
->
pNode
;
pSubplan
->
subplanType
=
(
MODIFY_TABLE_TYPE_INSERT
==
pModify
->
modifyType
&&
NULL
!=
pModify
->
node
.
pChildren
)
?
SUBPLAN_TYPE_SCAN
:
SUBPLAN_TYPE_MODIFY
;
}
}
int32_t
createLogicPlan
(
SPlanContext
*
pCxt
,
SLogicSubplan
**
pLogicSubplan
)
{
SLogicPlanContext
cxt
=
{.
pPlanCxt
=
pCxt
};
...
...
@@ -1354,11 +1365,7 @@ int32_t createLogicPlan(SPlanContext* pCxt, SLogicSubplan** pLogicSubplan) {
int32_t
code
=
createQueryLogicNode
(
&
cxt
,
pCxt
->
pAstRoot
,
&
pSubplan
->
pNode
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
setLogicNodeParent
(
pSubplan
->
pNode
);
if
(
QUERY_NODE_LOGIC_PLAN_VNODE_MODIFY
==
nodeType
(
pSubplan
->
pNode
))
{
pSubplan
->
subplanType
=
SUBPLAN_TYPE_MODIFY
;
}
else
{
pSubplan
->
subplanType
=
SUBPLAN_TYPE_SCAN
;
}
setLogicSubplanType
(
pSubplan
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
...
...
source/libs/planner/src/planSpliter.c
浏览文件 @
9aa35c2e
...
...
@@ -39,7 +39,6 @@ typedef struct SSplitRule {
FSplit
splitFunc
;
}
SSplitRule
;
// typedef bool (*FSplFindSplitNode)(SSplitContext* pCxt, SLogicSubplan* pSubplan, void* pInfo);
typedef
bool
(
*
FSplFindSplitNode
)(
SSplitContext
*
pCxt
,
SLogicSubplan
*
pSubplan
,
SLogicNode
*
pNode
,
void
*
pInfo
);
static
void
splSetSubplanVgroups
(
SLogicSubplan
*
pSubplan
,
SLogicNode
*
pNode
)
{
...
...
@@ -67,6 +66,19 @@ static SLogicSubplan* splCreateScanSubplan(SSplitContext* pCxt, SLogicNode* pNod
return
pSubplan
;
}
static
SLogicSubplan
*
splCreateSubplan
(
SSplitContext
*
pCxt
,
SLogicNode
*
pNode
,
ESubplanType
subplanType
)
{
SLogicSubplan
*
pSubplan
=
(
SLogicSubplan
*
)
nodesMakeNode
(
QUERY_NODE_LOGIC_SUBPLAN
);
if
(
NULL
==
pSubplan
)
{
return
NULL
;
}
pSubplan
->
id
.
queryId
=
pCxt
->
queryId
;
pSubplan
->
id
.
groupId
=
pCxt
->
groupId
;
pSubplan
->
subplanType
=
subplanType
;
pSubplan
->
pNode
=
pNode
;
pNode
->
pParent
=
NULL
;
return
pSubplan
;
}
static
int32_t
splCreateExchangeNode
(
SSplitContext
*
pCxt
,
SLogicNode
*
pChild
,
SExchangeLogicNode
**
pOutput
)
{
SExchangeLogicNode
*
pExchange
=
(
SExchangeLogicNode
*
)
nodesMakeNode
(
QUERY_NODE_LOGIC_PLAN_EXCHANGE
);
if
(
NULL
==
pExchange
)
{
...
...
@@ -1019,19 +1031,6 @@ static int32_t singleTableJoinSplit(SSplitContext* pCxt, SLogicSubplan* pSubplan
return
code
;
}
static
SLogicSubplan
*
unionCreateSubplan
(
SSplitContext
*
pCxt
,
SLogicNode
*
pNode
,
ESubplanType
subplanType
)
{
SLogicSubplan
*
pSubplan
=
(
SLogicSubplan
*
)
nodesMakeNode
(
QUERY_NODE_LOGIC_SUBPLAN
);
if
(
NULL
==
pSubplan
)
{
return
NULL
;
}
pSubplan
->
id
.
queryId
=
pCxt
->
queryId
;
pSubplan
->
id
.
groupId
=
pCxt
->
groupId
;
pSubplan
->
subplanType
=
subplanType
;
pSubplan
->
pNode
=
pNode
;
pNode
->
pParent
=
NULL
;
return
pSubplan
;
}
static
int32_t
unionSplitSubplan
(
SSplitContext
*
pCxt
,
SLogicSubplan
*
pUnionSubplan
,
SLogicNode
*
pSplitNode
)
{
SNodeList
*
pSubplanChildren
=
pUnionSubplan
->
pChildren
;
pUnionSubplan
->
pChildren
=
NULL
;
...
...
@@ -1040,7 +1039,7 @@ static int32_t unionSplitSubplan(SSplitContext* pCxt, SLogicSubplan* pUnionSubpl
SNode
*
pChild
=
NULL
;
FOREACH
(
pChild
,
pSplitNode
->
pChildren
)
{
SLogicSubplan
*
pNewSubplan
=
union
CreateSubplan
(
pCxt
,
(
SLogicNode
*
)
pChild
,
pUnionSubplan
->
subplanType
);
SLogicSubplan
*
pNewSubplan
=
spl
CreateSubplan
(
pCxt
,
(
SLogicNode
*
)
pChild
,
pUnionSubplan
->
subplanType
);
code
=
nodesListMakeStrictAppend
(
&
pUnionSubplan
->
pChildren
,
(
SNode
*
)
pNewSubplan
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
REPLACE_NODE
(
NULL
);
...
...
@@ -1221,9 +1220,10 @@ static int32_t insertSelectSplit(SSplitContext* pCxt, SLogicSubplan* pSubplan) {
SLogicSubplan
*
pNewSubplan
=
NULL
;
SNodeList
*
pSubplanChildren
=
info
.
pSubplan
->
pChildren
;
int32_t
code
=
splCreateExchangeNodeForSubplan
(
pCxt
,
info
.
pSubplan
,
info
.
pQueryRoot
,
info
.
pSubplan
->
subplanType
);
ESubplanType
subplanType
=
info
.
pSubplan
->
subplanType
;
int32_t
code
=
splCreateExchangeNodeForSubplan
(
pCxt
,
info
.
pSubplan
,
info
.
pQueryRoot
,
SUBPLAN_TYPE_MODIFY
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
pNewSubplan
=
splCreateS
canSubplan
(
pCxt
,
info
.
pQueryRoot
,
0
);
pNewSubplan
=
splCreateS
ubplan
(
pCxt
,
info
.
pQueryRoot
,
subplanType
);
if
(
NULL
==
pNewSubplan
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
}
...
...
@@ -1235,11 +1235,7 @@ static int32_t insertSelectSplit(SSplitContext* pCxt, SLogicSubplan* pSubplan) {
code
=
splMountSubplan
(
pNewSubplan
,
pSubplanChildren
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
info
.
pSubplan
->
subplanType
=
SUBPLAN_TYPE_MODIFY
;
SPLIT_FLAG_SET_MASK
(
info
.
pSubplan
->
splitFlag
,
SPLIT_FLAG_INSERT_SPLIT
);
}
SPLIT_FLAG_SET_MASK
(
info
.
pSubplan
->
splitFlag
,
SPLIT_FLAG_INSERT_SPLIT
);
++
(
pCxt
->
groupId
);
pCxt
->
split
=
true
;
return
code
;
...
...
tests/script/jenkins/basic.txt
浏览文件 @
9aa35c2e
...
...
@@ -163,8 +163,8 @@
# --- sma
./test.sh -f tsim/sma/drop_sma.sim
./test.sh -f tsim/sma/tsmaCreateInsertQuery.sim
./test.sh -f tsim/sma/rsmaCreateInsertQuery.sim
./test.sh -f tsim/sma/rsmaPersistenceRecovery.sim
#
./test.sh -f tsim/sma/rsmaCreateInsertQuery.sim
#
./test.sh -f tsim/sma/rsmaPersistenceRecovery.sim
# --- valgrind
./test.sh -f tsim/valgrind/checkError1.sim
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录