Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c486530d
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
c486530d
编写于
2月 01, 2023
作者:
X
Xiaoyu Wang
提交者:
GitHub
2月 01, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #19720 from taosdata/feat/3.0_insert_explain
feat: explain insert select
上级
6a9462c4
000eefac
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
2325 addition
and
2285 deletion
+2325
-2285
source/libs/executor/src/dataDispatcher.c
source/libs/executor/src/dataDispatcher.c
+11
-9
source/libs/parser/inc/sql.y
source/libs/parser/inc/sql.y
+6
-3
source/libs/parser/src/parInsertUtil.c
source/libs/parser/src/parInsertUtil.c
+2
-1
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+2
-2
source/libs/parser/src/sql.c
source/libs/parser/src/sql.c
+2302
-2268
source/libs/scheduler/src/schJob.c
source/libs/scheduler/src/schJob.c
+2
-2
未找到文件。
source/libs/executor/src/dataDispatcher.c
浏览文件 @
c486530d
...
@@ -77,8 +77,8 @@ static void toDataCacheEntry(SDataDispatchHandle* pHandle, const SInputData* pIn
...
@@ -77,8 +77,8 @@ static void toDataCacheEntry(SDataDispatchHandle* pHandle, const SInputData* pIn
pBuf
->
useSize
=
sizeof
(
SDataCacheEntry
);
pBuf
->
useSize
=
sizeof
(
SDataCacheEntry
);
pEntry
->
dataLen
=
blockEncode
(
pInput
->
pData
,
pEntry
->
data
,
numOfCols
);
pEntry
->
dataLen
=
blockEncode
(
pInput
->
pData
,
pEntry
->
data
,
numOfCols
);
// ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8));
// ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8));
// ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4));
// ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4));
pBuf
->
useSize
+=
pEntry
->
dataLen
;
pBuf
->
useSize
+=
pEntry
->
dataLen
;
...
@@ -135,7 +135,7 @@ static int32_t putDataBlock(SDataSinkHandle* pHandle, const SInputData* pInput,
...
@@ -135,7 +135,7 @@ static int32_t putDataBlock(SDataSinkHandle* pHandle, const SInputData* pInput,
taosFreeQitem
(
pBuf
);
taosFreeQitem
(
pBuf
);
return
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
}
toDataCacheEntry
(
pDispatcher
,
pInput
,
pBuf
);
toDataCacheEntry
(
pDispatcher
,
pInput
,
pBuf
);
taosWriteQitem
(
pDispatcher
->
pDataBlocks
,
pBuf
);
taosWriteQitem
(
pDispatcher
->
pDataBlocks
,
pBuf
);
...
@@ -162,14 +162,16 @@ static void getDataLength(SDataSinkHandle* pHandle, int64_t* pLen, bool* pQueryE
...
@@ -162,14 +162,16 @@ static void getDataLength(SDataSinkHandle* pHandle, int64_t* pLen, bool* pQueryE
SDataDispatchBuf
*
pBuf
=
NULL
;
SDataDispatchBuf
*
pBuf
=
NULL
;
taosReadQitem
(
pDispatcher
->
pDataBlocks
,
(
void
**
)
&
pBuf
);
taosReadQitem
(
pDispatcher
->
pDataBlocks
,
(
void
**
)
&
pBuf
);
memcpy
(
&
pDispatcher
->
nextOutput
,
pBuf
,
sizeof
(
SDataDispatchBuf
));
if
(
pBuf
!=
NULL
)
{
taosFreeQitem
(
pBuf
);
memcpy
(
&
pDispatcher
->
nextOutput
,
pBuf
,
sizeof
(
SDataDispatchBuf
));
taosFreeQitem
(
pBuf
);
}
SDataCacheEntry
*
pEntry
=
(
SDataCacheEntry
*
)
pDispatcher
->
nextOutput
.
pData
;
SDataCacheEntry
*
pEntry
=
(
SDataCacheEntry
*
)
pDispatcher
->
nextOutput
.
pData
;
*
pLen
=
pEntry
->
dataLen
;
*
pLen
=
pEntry
->
dataLen
;
// ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8));
// ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8));
// ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4));
// ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4));
*
pQueryEnd
=
pDispatcher
->
queryEnd
;
*
pQueryEnd
=
pDispatcher
->
queryEnd
;
qDebug
(
"got data len %"
PRId64
", row num %d in sink"
,
*
pLen
,
qDebug
(
"got data len %"
PRId64
", row num %d in sink"
,
*
pLen
,
...
@@ -192,8 +194,8 @@ static int32_t getDataBlock(SDataSinkHandle* pHandle, SOutputData* pOutput) {
...
@@ -192,8 +194,8 @@ static int32_t getDataBlock(SDataSinkHandle* pHandle, SOutputData* pOutput) {
pOutput
->
numOfCols
=
pEntry
->
numOfCols
;
pOutput
->
numOfCols
=
pEntry
->
numOfCols
;
pOutput
->
compressed
=
pEntry
->
compressed
;
pOutput
->
compressed
=
pEntry
->
compressed
;
// ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8));
// ASSERT(pEntry->numOfRows == *(int32_t*)(pEntry->data + 8));
// ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4));
// ASSERT(pEntry->numOfCols == *(int32_t*)(pEntry->data + 8 + 4));
atomic_sub_fetch_64
(
&
pDispatcher
->
cachedSize
,
pEntry
->
dataLen
);
atomic_sub_fetch_64
(
&
pDispatcher
->
cachedSize
,
pEntry
->
dataLen
);
atomic_sub_fetch_64
(
&
gDataSinkStat
.
cachedSize
,
pEntry
->
dataLen
);
atomic_sub_fetch_64
(
&
gDataSinkStat
.
cachedSize
,
pEntry
->
dataLen
);
...
...
source/libs/parser/inc/sql.y
浏览文件 @
c486530d
...
@@ -517,6 +517,7 @@ cmd ::= RESET QUERY CACHE.
...
@@ -517,6 +517,7 @@ cmd ::= RESET QUERY CACHE.
/************************************************ explain *************************************************************/
/************************************************ explain *************************************************************/
cmd ::= EXPLAIN analyze_opt(A) explain_options(B) query_or_subquery(C). { pCxt->pRootNode = createExplainStmt(pCxt, A, B, C); }
cmd ::= EXPLAIN analyze_opt(A) explain_options(B) query_or_subquery(C). { pCxt->pRootNode = createExplainStmt(pCxt, A, B, C); }
cmd ::= EXPLAIN analyze_opt(A) explain_options(B) insert_query(C). { pCxt->pRootNode = createExplainStmt(pCxt, A, B, C); }
%type analyze_opt { bool }
%type analyze_opt { bool }
%destructor analyze_opt { }
%destructor analyze_opt { }
...
@@ -599,9 +600,11 @@ cmd ::= DELETE FROM full_table_name(A) where_clause_opt(B).
...
@@ -599,9 +600,11 @@ cmd ::= DELETE FROM full_table_name(A) where_clause_opt(B).
cmd ::= query_or_subquery(A). { pCxt->pRootNode = A; }
cmd ::= query_or_subquery(A). { pCxt->pRootNode = A; }
/************************************************ insert **************************************************************/
/************************************************ insert **************************************************************/
cmd ::= INSERT INTO full_table_name(A)
cmd ::= insert_query(A). { pCxt->pRootNode = A; }
NK_LP col_name_list(B) NK_RP query_or_subquery(C). { pCxt->pRootNode = createInsertStmt(pCxt, A, B, C); }
cmd ::= INSERT INTO full_table_name(A) query_or_subquery(B). { pCxt->pRootNode = createInsertStmt(pCxt, A, NULL, B); }
insert_query(A) ::= INSERT INTO full_table_name(D)
NK_LP col_name_list(B) NK_RP query_or_subquery(C). { A = createInsertStmt(pCxt, D, B, C); }
insert_query(A) ::= INSERT INTO full_table_name(C) query_or_subquery(B). { A = createInsertStmt(pCxt, C, NULL, B); }
/************************************************ literal *************************************************************/
/************************************************ literal *************************************************************/
literal(A) ::= NK_INTEGER(B). { A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &B)); }
literal(A) ::= NK_INTEGER(B). { A = createRawExprNode(pCxt, &B, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &B)); }
...
...
source/libs/parser/src/parInsertUtil.c
浏览文件 @
c486530d
...
@@ -290,7 +290,8 @@ int32_t insGetTableDataCxt(SHashObj* pHash, void* id, int32_t idLen, STableMeta*
...
@@ -290,7 +290,8 @@ int32_t insGetTableDataCxt(SHashObj* pHash, void* id, int32_t idLen, STableMeta*
}
}
int32_t
code
=
createTableDataCxt
(
pTableMeta
,
pCreateTbReq
,
pTableCxt
,
colMode
);
int32_t
code
=
createTableDataCxt
(
pTableMeta
,
pCreateTbReq
,
pTableCxt
,
colMode
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
taosHashPut
(
pHash
,
id
,
idLen
,
pTableCxt
,
POINTER_BYTES
);
void
*
pData
=
*
pTableCxt
;
// deal scan coverity
code
=
taosHashPut
(
pHash
,
id
,
idLen
,
&
pData
,
POINTER_BYTES
);
}
}
return
code
;
return
code
;
}
}
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
c486530d
...
@@ -3517,7 +3517,7 @@ static int32_t translateSetOperProject(STranslateContext* pCxt, SSetOperator* pS
...
@@ -3517,7 +3517,7 @@ static int32_t translateSetOperProject(STranslateContext* pCxt, SSetOperator* pS
if
(
comp
>
0
)
{
if
(
comp
>
0
)
{
SNode
*
pRightFunc
=
NULL
;
SNode
*
pRightFunc
=
NULL
;
int32_t
code
=
createCastFunc
(
pCxt
,
pRight
,
pLeftExpr
->
resType
,
&
pRightFunc
);
int32_t
code
=
createCastFunc
(
pCxt
,
pRight
,
pLeftExpr
->
resType
,
&
pRightFunc
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
if
(
TSDB_CODE_SUCCESS
!=
code
||
NULL
==
pRightFunc
)
{
// deal scan coverity
return
code
;
return
code
;
}
}
REPLACE_LIST2_NODE
(
pRightFunc
);
REPLACE_LIST2_NODE
(
pRightFunc
);
...
@@ -3525,7 +3525,7 @@ static int32_t translateSetOperProject(STranslateContext* pCxt, SSetOperator* pS
...
@@ -3525,7 +3525,7 @@ static int32_t translateSetOperProject(STranslateContext* pCxt, SSetOperator* pS
}
else
if
(
comp
<
0
)
{
}
else
if
(
comp
<
0
)
{
SNode
*
pLeftFunc
=
NULL
;
SNode
*
pLeftFunc
=
NULL
;
int32_t
code
=
createCastFunc
(
pCxt
,
pLeft
,
pRightExpr
->
resType
,
&
pLeftFunc
);
int32_t
code
=
createCastFunc
(
pCxt
,
pLeft
,
pRightExpr
->
resType
,
&
pLeftFunc
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
if
(
TSDB_CODE_SUCCESS
!=
code
||
NULL
==
pLeftFunc
)
{
// deal scan coverity
return
code
;
return
code
;
}
}
REPLACE_LIST1_NODE
(
pLeftFunc
);
REPLACE_LIST1_NODE
(
pLeftFunc
);
...
...
source/libs/parser/src/sql.c
浏览文件 @
c486530d
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
source/libs/scheduler/src/schJob.c
浏览文件 @
c486530d
...
@@ -234,7 +234,7 @@ int32_t schBuildTaskRalation(SSchJob *pJob, SHashObj *planToTask) {
...
@@ -234,7 +234,7 @@ int32_t schBuildTaskRalation(SSchJob *pJob, SHashObj *planToTask) {
}
}
SSchTask
*
pTask
=
taosArrayGet
(
pLevel
->
subTasks
,
0
);
SSchTask
*
pTask
=
taosArrayGet
(
pLevel
->
subTasks
,
0
);
if
(
SUBPLAN_TYPE_MODIFY
!=
pTask
->
plan
->
subplanType
)
{
if
(
SUBPLAN_TYPE_MODIFY
!=
pTask
->
plan
->
subplanType
||
EXPLAIN_MODE_DISABLE
!=
pJob
->
attr
.
explainMode
)
{
pJob
->
attr
.
needFetch
=
true
;
pJob
->
attr
.
needFetch
=
true
;
}
}
}
}
...
@@ -484,7 +484,7 @@ int32_t schProcessOnJobFailure(SSchJob *pJob, int32_t errCode) {
...
@@ -484,7 +484,7 @@ int32_t schProcessOnJobFailure(SSchJob *pJob, int32_t errCode) {
if
(
TSDB_CODE_SCH_IGNORE_ERROR
==
errCode
)
{
if
(
TSDB_CODE_SCH_IGNORE_ERROR
==
errCode
)
{
return
TSDB_CODE_SCH_IGNORE_ERROR
;
return
TSDB_CODE_SCH_IGNORE_ERROR
;
}
}
schUpdateJobErrCode
(
pJob
,
errCode
);
schUpdateJobErrCode
(
pJob
,
errCode
);
int32_t
code
=
atomic_load_32
(
&
pJob
->
errCode
);
int32_t
code
=
atomic_load_32
(
&
pJob
->
errCode
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录