Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b849252e
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
b849252e
编写于
7月 08, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: insert from query
上级
2722c5ee
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
26 addition
and
13 deletion
+26
-13
source/libs/executor/src/dataInserter.c
source/libs/executor/src/dataInserter.c
+22
-10
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+1
-1
source/libs/planner/src/planPhysiCreater.c
source/libs/planner/src/planPhysiCreater.c
+1
-1
source/libs/scheduler/inc/schInt.h
source/libs/scheduler/inc/schInt.h
+1
-0
source/libs/scheduler/src/schRemote.c
source/libs/scheduler/src/schRemote.c
+1
-1
未找到文件。
source/libs/executor/src/dataInserter.c
浏览文件 @
b849252e
...
...
@@ -110,7 +110,7 @@ static int32_t sendSubmitRequest(SDataInserterHandle* pInserter, SSubmitReq* pMs
pMsgSendInfo
->
param
=
pParam
;
pMsgSendInfo
->
msgInfo
.
pData
=
pMsg
;
pMsgSendInfo
->
msgInfo
.
len
=
sizeof
(
SSubmitReq
);
pMsgSendInfo
->
msgInfo
.
len
=
ntohl
(
pMsg
->
length
);
pMsgSendInfo
->
msgType
=
TDMT_VND_SUBMIT
;
pMsgSendInfo
->
fp
=
inserterCallback
;
...
...
@@ -119,7 +119,7 @@ static int32_t sendSubmitRequest(SDataInserterHandle* pInserter, SSubmitReq* pMs
}
SSubmitReq
*
dataBlockToSubmit
(
SDataInserterHandle
*
pInserter
)
{
int32_t
dataBlockToSubmit
(
SDataInserterHandle
*
pInserter
,
SSubmitReq
**
pReq
)
{
const
SArray
*
pBlocks
=
pInserter
->
pDataBlocks
;
const
STSchema
*
pTSchema
=
pInserter
->
pSchema
;
int64_t
uid
=
pInserter
->
pNode
->
tableId
;
...
...
@@ -133,7 +133,7 @@ SSubmitReq* dataBlockToSubmit(SDataInserterHandle* pInserter) {
// cal size
int32_t
cap
=
sizeof
(
SSubmitReq
);
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
SSDataBlock
*
pDataBlock
=
taosArrayGet
(
pBlocks
,
i
);
SSDataBlock
*
pDataBlock
=
taosArrayGet
P
(
pBlocks
,
i
);
int32_t
rows
=
pDataBlock
->
info
.
rows
;
// TODO min
int32_t
rowSize
=
pDataBlock
->
info
.
rowSize
;
...
...
@@ -144,15 +144,15 @@ SSubmitReq* dataBlockToSubmit(SDataInserterHandle* pInserter) {
// assign data
// TODO
ret
=
rpcMallocCont
(
cap
);
ret
->
header
.
vgId
=
vgId
;
ret
=
taosMemoryCalloc
(
1
,
cap
);
ret
->
header
.
vgId
=
htonl
(
vgId
)
;
ret
->
version
=
htonl
(
pTSchema
->
version
);
ret
->
length
=
sizeof
(
SSubmitReq
);
ret
->
numOfBlocks
=
htonl
(
sz
);
SSubmitBlk
*
blkHead
=
POINTER_SHIFT
(
ret
,
sizeof
(
SSubmitReq
));
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
SSDataBlock
*
pDataBlock
=
taosArrayGet
(
pBlocks
,
i
);
SSDataBlock
*
pDataBlock
=
taosArrayGet
P
(
pBlocks
,
i
);
blkHead
->
numOfRows
=
htons
(
pDataBlock
->
info
.
rows
);
blkHead
->
sversion
=
htonl
(
pTSchema
->
version
);
...
...
@@ -184,6 +184,12 @@ SSubmitReq* dataBlockToSubmit(SDataInserterHandle* pInserter) {
}
pColData
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
colIdx
);
if
(
pColData
->
info
.
type
!=
pColumn
->
type
)
{
qError
(
"col type mis-match, schema type:%d, type in block:%d"
,
pColumn
->
type
,
pColData
->
info
.
type
);
terrno
=
TSDB_CODE_APP_ERROR
;
return
TSDB_CODE_APP_ERROR
;
}
if
(
colDataIsNull_s
(
pColData
,
j
))
{
tdAppendColValToRow
(
&
rb
,
pColumn
->
colId
,
pColumn
->
type
,
TD_VTYPE_NULL
,
NULL
,
false
,
pColumn
->
offset
,
k
);
}
else
{
...
...
@@ -204,16 +210,22 @@ SSubmitReq* dataBlockToSubmit(SDataInserterHandle* pInserter) {
ret
->
length
=
htonl
(
ret
->
length
);
return
ret
;
*
pReq
=
ret
;
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
putDataBlock
(
SDataSinkHandle
*
pHandle
,
const
SInputData
*
pInput
,
bool
*
pContinue
)
{
SDataInserterHandle
*
pInserter
=
(
SDataInserterHandle
*
)
pHandle
;
taosArrayPush
(
pInserter
->
pDataBlocks
,
pInput
->
pData
);
SSubmitReq
*
pMsg
=
dataBlockToSubmit
(
pInserter
);
taosArrayPush
(
pInserter
->
pDataBlocks
,
&
pInput
->
pData
);
SSubmitReq
*
pMsg
=
NULL
;
int32_t
code
=
dataBlockToSubmit
(
pInserter
,
&
pMsg
);
if
(
code
)
{
return
code
;
}
int32_t
code
=
sendSubmitRequest
(
pInserter
,
pMsg
,
pInserter
->
pParam
->
readHandle
->
pMsgCb
->
clientRpc
,
&
pInserter
->
pNode
->
epSet
);
code
=
sendSubmitRequest
(
pInserter
,
pMsg
,
pInserter
->
pParam
->
readHandle
->
pMsgCb
->
clientRpc
,
&
pInserter
->
pNode
->
epSet
);
if
(
code
)
{
return
code
;
}
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
b849252e
...
...
@@ -6378,7 +6378,7 @@ static int32_t setQuery(STranslateContext* pCxt, SQuery* pQuery) {
break
;
case
QUERY_NODE_INSERT_STMT
:
pQuery
->
execMode
=
QUERY_EXEC_MODE_SCHEDULE
;
pQuery
->
msgType
=
TDMT_
SCH_QUERY
;
pQuery
->
msgType
=
TDMT_
VND_SUBMIT
;
break
;
case
QUERY_NODE_VNODE_MODIF_STMT
:
pQuery
->
execMode
=
QUERY_EXEC_MODE_SCHEDULE
;
...
...
source/libs/planner/src/planPhysiCreater.c
浏览文件 @
b849252e
...
...
@@ -1566,7 +1566,7 @@ static int32_t buildInsertSelectSubplan(SPhysiPlanContext* pCxt, SVnodeModifyLog
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
createQueryInserter
(
pCxt
,
pModify
,
pSubplan
,
&
pSubplan
->
pDataSink
);
}
pSubplan
->
msgType
=
TDMT_
VND_SUBMIT
;
pSubplan
->
msgType
=
TDMT_
SCH_MERGE_QUERY
;
return
code
;
}
...
...
source/libs/scheduler/inc/schInt.h
浏览文件 @
b849252e
...
...
@@ -319,6 +319,7 @@ extern SSchedulerMgmt schMgmt;
#define SCH_JOB_NEED_FLOW_CTRL(_job) ((_job)->attr.needFlowCtrl)
#define SCH_TASK_NEED_FLOW_CTRL(_job, _task) (SCH_IS_DATA_BIND_QRY_TASK(_task) && SCH_JOB_NEED_FLOW_CTRL(_job) && SCH_IS_LEVEL_UNFINISHED((_task)->level))
#define SCH_FETCH_TYPE(_pSrcTask) (SCH_IS_DATA_BIND_QRY_TASK(_pSrcTask) ? TDMT_SCH_FETCH : TDMT_SCH_MERGE_FETCH)
#define SCH_TASK_NEED_FETCH(_task) ((_task)->plan->subplanType != SUBPLAN_TYPE_MODIFY)
#define SCH_SET_JOB_TYPE(_job, type) do { if ((type) != SUBPLAN_TYPE_MODIFY) { (_job)->attr.queryJob = true; } } while (0)
#define SCH_IS_QUERY_JOB(_job) ((_job)->attr.queryJob)
...
...
source/libs/scheduler/src/schRemote.c
浏览文件 @
b849252e
...
...
@@ -1001,7 +1001,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr,
pMsg
->
execId
=
htonl
(
pTask
->
execId
);
pMsg
->
taskType
=
TASK_TYPE_TEMP
;
pMsg
->
explain
=
SCH_IS_EXPLAIN_JOB
(
pJob
);
pMsg
->
needFetch
=
SCH_
JOB_NEED_FETCH
(
pJob
);
pMsg
->
needFetch
=
SCH_
TASK_NEED_FETCH
(
pTask
);
pMsg
->
phyLen
=
htonl
(
pTask
->
msgLen
);
pMsg
->
sqlLen
=
htonl
(
len
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录