Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
57836d8b
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看板
提交
57836d8b
编写于
7月 04, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh: add type convert api
上级
a9161a5c
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
363 addition
and
0 deletion
+363
-0
include/libs/nodes/plannodes.h
include/libs/nodes/plannodes.h
+1
-0
source/libs/command/inc/commandInt.h
source/libs/command/inc/commandInt.h
+6
-0
source/libs/command/src/explain.c
source/libs/command/src/explain.c
+279
-0
source/libs/planner/src/planPhysiCreater.c
source/libs/planner/src/planPhysiCreater.c
+3
-0
source/libs/scalar/src/scalar.c
source/libs/scalar/src/scalar.c
+69
-0
source/libs/scheduler/src/schJob.c
source/libs/scheduler/src/schJob.c
+5
-0
未找到文件。
include/libs/nodes/plannodes.h
浏览文件 @
57836d8b
...
...
@@ -320,6 +320,7 @@ typedef struct SInterpFuncPhysiNode {
SNodeList
*
pFuncs
;
STimeWindow
timeRange
;
int64_t
interval
;
int8_t
intervalUnit
;
EFillMode
fillMode
;
SNode
*
pFillValues
;
// SNodeListNode
SNode
*
pTimeSeries
;
// SColumnNode
...
...
source/libs/command/inc/commandInt.h
浏览文件 @
57836d8b
...
...
@@ -29,13 +29,17 @@ extern "C" {
#define EXPLAIN_TAG_SCAN_FORMAT "Tag Scan on %s"
#define EXPLAIN_TBL_SCAN_FORMAT "Table Scan on %s"
#define EXPLAIN_SYSTBL_SCAN_FORMAT "System Table Scan on %s"
#define EXPLAIN_DISTBLK_SCAN_FORMAT "Block Dist Scan on %s"
#define EXPLAIN_LASTROW_SCAN_FORMAT "Last Row Scan on %s"
#define EXPLAIN_PROJECTION_FORMAT "Projection"
#define EXPLAIN_JOIN_FORMAT "%s"
#define EXPLAIN_AGG_FORMAT "Aggragate"
#define EXPLAIN_INDEF_ROWS_FORMAT "Indefinite Rows Function"
#define EXPLAIN_EXCHANGE_FORMAT "Data Exchange %d:1"
#define EXPLAIN_SORT_FORMAT "Sort"
#define EXPLAIN_GROUP_SORT_FORMAT "Group Sort"
#define EXPLAIN_INTERVAL_FORMAT "Interval on Column %s"
#define EXPLAIN_MERGE_INTERVAL_FORMAT "Merge Interval on Column %s"
#define EXPLAIN_FILL_FORMAT "Fill"
#define EXPLAIN_SESSION_FORMAT "Session"
#define EXPLAIN_STATE_WINDOW_FORMAT "StateWindow on Column %s"
...
...
@@ -62,10 +66,12 @@ extern "C" {
#define EXPLAIN_COST_FORMAT "cost=%.2f..%.2f"
#define EXPLAIN_ROWS_FORMAT "rows=%" PRIu64
#define EXPLAIN_COLUMNS_FORMAT "columns=%d"
#define EXPLAIN_PSEUDO_COLUMNS_FORMAT "pseudo_columns=%d"
#define EXPLAIN_WIDTH_FORMAT "width=%d"
#define EXPLAIN_TABLE_SCAN_FORMAT "order=[asc|%d desc|%d]"
#define EXPLAIN_GROUPS_FORMAT "groups=%d"
#define EXPLAIN_WIDTH_FORMAT "width=%d"
#define EXPLAIN_INTERVAL_VALUE_FORMAT "interval=%" PRId64 "%c"
#define EXPLAIN_FUNCTIONS_FORMAT "functions=%d"
#define EXPLAIN_EXECINFO_FORMAT "cost=%.3f..%.3f rows=%" PRIu64
#define EXPLAIN_MODE_FORMAT "mode=%s"
...
...
source/libs/command/src/explain.c
浏览文件 @
57836d8b
...
...
@@ -199,6 +199,31 @@ int32_t qExplainGenerateResChildren(SPhysiNode *pNode, SExplainGroup *group, SNo
pPhysiChildren
=
mergePhysiNode
->
scan
.
node
.
pChildren
;
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN
:
{
SBlockDistScanPhysiNode
*
distPhysiNode
=
(
SBlockDistScanPhysiNode
*
)
pNode
;
pPhysiChildren
=
distPhysiNode
->
node
.
pChildren
;
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN
:
{
SLastRowScanPhysiNode
*
lastRowPhysiNode
=
(
SLastRowScanPhysiNode
*
)
pNode
;
pPhysiChildren
=
lastRowPhysiNode
->
node
.
pChildren
;
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_GROUP_SORT
:
{
SGroupSortPhysiNode
*
groupSortPhysiNode
=
(
SGroupSortPhysiNode
*
)
pNode
;
pPhysiChildren
=
groupSortPhysiNode
->
node
.
pChildren
;
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_MERGE_INTERVAL
:
{
SMergeIntervalPhysiNode
*
mergeIntPhysiNode
=
(
SMergeIntervalPhysiNode
*
)
pNode
;
pPhysiChildren
=
mergeIntPhysiNode
->
window
.
node
.
pChildren
;
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC
:
{
SInterpFuncPhysiNode
*
interpPhysiNode
=
(
SInterpFuncPhysiNode
*
)
pNode
;
pPhysiChildren
=
interpPhysiNode
->
node
.
pChildren
;
break
;
}
default:
qError
(
"not supported physical node type %d"
,
pNode
->
type
);
QRY_ERR_RET
(
TSDB_CODE_QRY_APP_ERROR
);
...
...
@@ -378,6 +403,8 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
}
EXPLAIN_ROW_APPEND
(
EXPLAIN_COLUMNS_FORMAT
,
pTagScanNode
->
pScanCols
->
length
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_PSEUDO_COLUMNS_FORMAT
,
pTagScanNode
->
pScanPseudoCols
->
length
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_WIDTH_FORMAT
,
pTagScanNode
->
node
.
pOutputDataBlockDesc
->
totalRowSize
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_RIGHT_PARENTHESIS_FORMAT
);
EXPLAIN_ROW_END
();
...
...
@@ -415,6 +442,8 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
EXPLAIN_ROW_APPEND
(
EXPLAIN_COLUMNS_FORMAT
,
pTblScanNode
->
scan
.
pScanCols
->
length
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_PSEUDO_COLUMNS_FORMAT
,
pTblScanNode
->
scan
.
pScanPseudoCols
->
length
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_WIDTH_FORMAT
,
pTblScanNode
->
scan
.
node
.
pOutputDataBlockDesc
->
totalRowSize
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_TABLE_SCAN_FORMAT
,
pTblScanNode
->
scanSeq
[
0
],
pTblScanNode
->
scanSeq
[
1
]);
...
...
@@ -516,6 +545,8 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
}
EXPLAIN_ROW_APPEND
(
EXPLAIN_COLUMNS_FORMAT
,
pSTblScanNode
->
scan
.
pScanCols
->
length
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_PSEUDO_COLUMNS_FORMAT
,
pSTblScanNode
->
scan
.
pScanPseudoCols
->
length
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_WIDTH_FORMAT
,
pSTblScanNode
->
scan
.
node
.
pOutputDataBlockDesc
->
totalRowSize
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_RIGHT_PARENTHESIS_FORMAT
);
...
...
@@ -1131,6 +1162,254 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
}
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN
:
{
SBlockDistScanPhysiNode
*
pDistScanNode
=
(
SBlockDistScanPhysiNode
*
)
pNode
;
EXPLAIN_ROW_NEW
(
level
,
EXPLAIN_DISTBLK_SCAN_FORMAT
,
pDistScanNode
->
tableName
.
tname
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_LEFT_PARENTHESIS_FORMAT
);
if
(
pResNode
->
pExecInfo
)
{
QRY_ERR_RET
(
qExplainBufAppendExecInfo
(
pResNode
->
pExecInfo
,
tbuf
,
&
tlen
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
}
EXPLAIN_ROW_APPEND
(
EXPLAIN_COLUMNS_FORMAT
,
pDistScanNode
->
pScanCols
->
length
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_PSEUDO_COLUMNS_FORMAT
,
pDistScanNode
->
pScanPseudoCols
->
length
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_WIDTH_FORMAT
,
pDistScanNode
->
node
.
pOutputDataBlockDesc
->
totalRowSize
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_RIGHT_PARENTHESIS_FORMAT
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
));
if
(
verbose
)
{
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_OUTPUT_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_COLUMNS_FORMAT
,
nodesGetOutputNumFromSlotList
(
pDistScanNode
->
node
.
pOutputDataBlockDesc
->
pSlots
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_WIDTH_FORMAT
,
pDistScanNode
->
node
.
pOutputDataBlockDesc
->
outputRowSize
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
if
(
pDistScanNode
->
node
.
pConditions
)
{
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_FILTER_FORMAT
);
QRY_ERR_RET
(
nodesNodeToSQL
(
pDistScanNode
->
node
.
pConditions
,
tbuf
+
VARSTR_HEADER_SIZE
,
TSDB_EXPLAIN_RESULT_ROW_SIZE
,
&
tlen
));
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
}
}
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN
:
{
SLastRowScanPhysiNode
*
pLastRowNode
=
(
SLastRowScanPhysiNode
*
)
pNode
;
EXPLAIN_ROW_NEW
(
level
,
EXPLAIN_LASTROW_SCAN_FORMAT
,
pLastRowNode
->
tableName
.
tname
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_LEFT_PARENTHESIS_FORMAT
);
if
(
pResNode
->
pExecInfo
)
{
QRY_ERR_RET
(
qExplainBufAppendExecInfo
(
pResNode
->
pExecInfo
,
tbuf
,
&
tlen
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
}
EXPLAIN_ROW_APPEND
(
EXPLAIN_COLUMNS_FORMAT
,
pLastRowNode
->
pScanCols
->
length
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_PSEUDO_COLUMNS_FORMAT
,
pLastRowNode
->
pScanPseudoCols
->
length
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_WIDTH_FORMAT
,
pLastRowNode
->
node
.
pOutputDataBlockDesc
->
totalRowSize
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_RIGHT_PARENTHESIS_FORMAT
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
));
if
(
verbose
)
{
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_OUTPUT_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_COLUMNS_FORMAT
,
nodesGetOutputNumFromSlotList
(
pLastRowNode
->
node
.
pOutputDataBlockDesc
->
pSlots
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_WIDTH_FORMAT
,
pLastRowNode
->
node
.
pOutputDataBlockDesc
->
outputRowSize
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
if
(
pLastRowNode
->
node
.
pConditions
)
{
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_FILTER_FORMAT
);
QRY_ERR_RET
(
nodesNodeToSQL
(
pLastRowNode
->
node
.
pConditions
,
tbuf
+
VARSTR_HEADER_SIZE
,
TSDB_EXPLAIN_RESULT_ROW_SIZE
,
&
tlen
));
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
}
}
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_GROUP_SORT
:
{
SGroupSortPhysiNode
*
pSortNode
=
(
SGroupSortPhysiNode
*
)
pNode
;
EXPLAIN_ROW_NEW
(
level
,
EXPLAIN_GROUP_SORT_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_LEFT_PARENTHESIS_FORMAT
);
if
(
pResNode
->
pExecInfo
)
{
QRY_ERR_RET
(
qExplainBufAppendExecInfo
(
pResNode
->
pExecInfo
,
tbuf
,
&
tlen
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
}
SDataBlockDescNode
*
pDescNode
=
pSortNode
->
node
.
pOutputDataBlockDesc
;
EXPLAIN_ROW_APPEND
(
EXPLAIN_COLUMNS_FORMAT
,
nodesGetOutputNumFromSlotList
(
pDescNode
->
pSlots
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_WIDTH_FORMAT
,
pDescNode
->
totalRowSize
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_RIGHT_PARENTHESIS_FORMAT
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
));
if
(
EXPLAIN_MODE_ANALYZE
==
ctx
->
mode
)
{
// sort key
EXPLAIN_ROW_NEW
(
level
+
1
,
"Sort Key: "
);
if
(
pResNode
->
pExecInfo
)
{
for
(
int32_t
i
=
0
;
i
<
LIST_LENGTH
(
pSortNode
->
pSortKeys
);
++
i
)
{
SOrderByExprNode
*
ptn
=
(
SOrderByExprNode
*
)
nodesListGetNode
(
pSortNode
->
pSortKeys
,
i
);
EXPLAIN_ROW_APPEND
(
"%s "
,
nodesGetNameFromColumnNode
(
ptn
->
pExpr
));
}
}
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
));
// sort method
EXPLAIN_ROW_NEW
(
level
+
1
,
"Sort Method: "
);
int32_t
nodeNum
=
taosArrayGetSize
(
pResNode
->
pExecInfo
);
SExplainExecInfo
*
execInfo
=
taosArrayGet
(
pResNode
->
pExecInfo
,
0
);
SSortExecInfo
*
pExecInfo
=
(
SSortExecInfo
*
)
execInfo
->
verboseInfo
;
EXPLAIN_ROW_APPEND
(
"%s"
,
pExecInfo
->
sortMethod
==
SORT_QSORT_T
?
"quicksort"
:
"merge sort"
);
if
(
pExecInfo
->
sortBuffer
>
1024
*
1024
)
{
EXPLAIN_ROW_APPEND
(
" Buffers:%.2f Mb"
,
pExecInfo
->
sortBuffer
/
(
1024
*
1024
.
0
));
}
else
if
(
pExecInfo
->
sortBuffer
>
1024
)
{
EXPLAIN_ROW_APPEND
(
" Buffers:%.2f Kb"
,
pExecInfo
->
sortBuffer
/
(
1024
.
0
));
}
else
{
EXPLAIN_ROW_APPEND
(
" Buffers:%d b"
,
pExecInfo
->
sortBuffer
);
}
EXPLAIN_ROW_APPEND
(
" loops:%d"
,
pExecInfo
->
loops
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
));
}
if
(
verbose
)
{
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_OUTPUT_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_COLUMNS_FORMAT
,
nodesGetOutputNumFromSlotList
(
pSortNode
->
node
.
pOutputDataBlockDesc
->
pSlots
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_WIDTH_FORMAT
,
pSortNode
->
node
.
pOutputDataBlockDesc
->
outputRowSize
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
if
(
pSortNode
->
node
.
pConditions
)
{
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_FILTER_FORMAT
);
QRY_ERR_RET
(
nodesNodeToSQL
(
pSortNode
->
node
.
pConditions
,
tbuf
+
VARSTR_HEADER_SIZE
,
TSDB_EXPLAIN_RESULT_ROW_SIZE
,
&
tlen
));
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
}
}
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_MERGE_INTERVAL
:
{
SMergeIntervalPhysiNode
*
pIntNode
=
(
SMergeIntervalPhysiNode
*
)
pNode
;
EXPLAIN_ROW_NEW
(
level
,
EXPLAIN_MERGE_INTERVAL_FORMAT
,
nodesGetNameFromColumnNode
(
pIntNode
->
window
.
pTspk
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_LEFT_PARENTHESIS_FORMAT
);
if
(
pResNode
->
pExecInfo
)
{
QRY_ERR_RET
(
qExplainBufAppendExecInfo
(
pResNode
->
pExecInfo
,
tbuf
,
&
tlen
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
}
EXPLAIN_ROW_APPEND
(
EXPLAIN_FUNCTIONS_FORMAT
,
pIntNode
->
window
.
pFuncs
->
length
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_RIGHT_PARENTHESIS_FORMAT
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
));
if
(
verbose
)
{
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_OUTPUT_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_COLUMNS_FORMAT
,
nodesGetOutputNumFromSlotList
(
pIntNode
->
window
.
node
.
pOutputDataBlockDesc
->
pSlots
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_WIDTH_FORMAT
,
pIntNode
->
window
.
node
.
pOutputDataBlockDesc
->
outputRowSize
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
uint8_t
precision
=
getIntervalPrecision
(
pIntNode
);
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_TIME_WINDOWS_FORMAT
,
INVERAL_TIME_FROM_PRECISION_TO_UNIT
(
pIntNode
->
interval
,
pIntNode
->
intervalUnit
,
precision
),
pIntNode
->
intervalUnit
,
pIntNode
->
offset
,
getPrecisionUnit
(
precision
),
INVERAL_TIME_FROM_PRECISION_TO_UNIT
(
pIntNode
->
sliding
,
pIntNode
->
slidingUnit
,
precision
),
pIntNode
->
slidingUnit
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
if
(
pIntNode
->
window
.
node
.
pConditions
)
{
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_FILTER_FORMAT
);
QRY_ERR_RET
(
nodesNodeToSQL
(
pIntNode
->
window
.
node
.
pConditions
,
tbuf
+
VARSTR_HEADER_SIZE
,
TSDB_EXPLAIN_RESULT_ROW_SIZE
,
&
tlen
));
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
}
}
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC
:
{
SInterpFuncPhysiNode
*
pInterpNode
=
(
SInterpFuncPhysiNode
*
)
pNode
;
EXPLAIN_ROW_NEW
(
level
,
EXPLAIN_AGG_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_LEFT_PARENTHESIS_FORMAT
);
if
(
pResNode
->
pExecInfo
)
{
QRY_ERR_RET
(
qExplainBufAppendExecInfo
(
pResNode
->
pExecInfo
,
tbuf
,
&
tlen
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
}
if
(
pInterpNode
->
pFuncs
)
{
EXPLAIN_ROW_APPEND
(
EXPLAIN_FUNCTIONS_FORMAT
,
pInterpNode
->
pFuncs
->
length
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
}
EXPLAIN_ROW_APPEND
(
EXPLAIN_MODE_FORMAT
,
nodesGetFillModeString
(
pInterpNode
->
fillMode
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_RIGHT_PARENTHESIS_FORMAT
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
));
if
(
verbose
)
{
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_OUTPUT_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_COLUMNS_FORMAT
,
nodesGetOutputNumFromSlotList
(
pInterpNode
->
node
.
pOutputDataBlockDesc
->
pSlots
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_WIDTH_FORMAT
,
pInterpNode
->
node
.
pOutputDataBlockDesc
->
outputRowSize
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
if
(
pInterpNode
->
pFillValues
)
{
SNodeListNode
*
pValues
=
(
SNodeListNode
*
)
pInterpNode
->
pFillValues
;
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_FILL_VALUE_FORMAT
);
SNode
*
tNode
=
NULL
;
int32_t
i
=
0
;
FOREACH
(
tNode
,
pValues
->
pNodeList
)
{
if
(
i
)
{
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
}
SValueNode
*
tValue
=
(
SValueNode
*
)
tNode
;
char
*
value
=
nodesGetStrValueFromNode
(
tValue
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_STRING_TYPE_FORMAT
,
value
);
taosMemoryFree
(
value
);
++
i
;
}
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
}
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_INTERVAL_VALUE_FORMAT
,
pInterpNode
->
interval
,
pInterpNode
->
intervalUnit
);
EXPLAIN_ROW_END
();
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_TIMERANGE_FORMAT
,
pInterpNode
->
timeRange
.
skey
,
pInterpNode
->
timeRange
.
ekey
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
if
(
pInterpNode
->
node
.
pConditions
)
{
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_FILTER_FORMAT
);
QRY_ERR_RET
(
nodesNodeToSQL
(
pInterpNode
->
node
.
pConditions
,
tbuf
+
VARSTR_HEADER_SIZE
,
TSDB_EXPLAIN_RESULT_ROW_SIZE
,
&
tlen
));
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
}
}
break
;
}
default:
qError
(
"not supported physical node type %d"
,
pNode
->
type
);
return
TSDB_CODE_QRY_APP_ERROR
;
...
...
source/libs/planner/src/planPhysiCreater.c
浏览文件 @
57836d8b
...
...
@@ -552,6 +552,9 @@ static int32_t createSystemTableScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan*
if
(
0
==
strcmp
(
pScanLogicNode
->
tableName
.
tname
,
TSDB_INS_TABLE_USER_TABLES
)
||
0
==
strcmp
(
pScanLogicNode
->
tableName
.
tname
,
TSDB_INS_TABLE_USER_TABLE_DISTRIBUTED
))
{
vgroupInfoToNodeAddr
(
pScanLogicNode
->
pVgroupList
->
vgroups
,
&
pSubplan
->
execNode
);
}
else
{
pSubplan
->
execNode
.
nodeId
=
MNODE_HANDLE
;
pSubplan
->
execNode
.
epSet
=
pCxt
->
pPlanCxt
->
mgmtEpSet
;
}
SQueryNodeLoad
node
=
{.
addr
=
{.
nodeId
=
MNODE_HANDLE
,
.
epSet
=
pCxt
->
pPlanCxt
->
mgmtEpSet
},
.
load
=
0
};
taosArrayPush
(
pCxt
->
pExecNodeList
,
&
node
);
...
...
source/libs/scalar/src/scalar.c
浏览文件 @
57836d8b
...
...
@@ -1035,3 +1035,72 @@ _return:
sclFreeRes
(
ctx
.
pRes
);
return
code
;
}
int32_t
scalarGetOperatorResultType
(
SDataType
left
,
SDataType
right
,
EOperatorType
op
,
SDataType
*
pRes
)
{
switch
(
op
)
{
case
OP_TYPE_ADD
:
if
(
left
.
type
==
TSDB_DATA_TYPE_TIMESTAMP
&&
right
.
type
==
TSDB_DATA_TYPE_TIMESTAMP
)
{
qError
(
"invalid op %d, left type:%d, right type:%d"
,
op
,
left
.
type
,
right
.
type
);
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
if
((
left
.
type
==
TSDB_DATA_TYPE_TIMESTAMP
&&
(
IS_INTEGER_TYPE
(
right
.
type
)
||
right
.
type
==
TSDB_DATA_TYPE_BOOL
))
||
(
right
.
type
==
TSDB_DATA_TYPE_TIMESTAMP
&&
(
IS_INTEGER_TYPE
(
left
.
type
)
||
left
.
type
==
TSDB_DATA_TYPE_BOOL
)))
{
pRes
->
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
return
TSDB_CODE_SUCCESS
;
}
pRes
->
type
=
TSDB_DATA_TYPE_DOUBLE
;
return
TSDB_CODE_SUCCESS
;
case
OP_TYPE_SUB
:
if
((
left
.
type
==
TSDB_DATA_TYPE_TIMESTAMP
&&
right
.
type
==
TSDB_DATA_TYPE_BIGINT
)
||
(
right
.
type
==
TSDB_DATA_TYPE_TIMESTAMP
&&
left
.
type
==
TSDB_DATA_TYPE_BIGINT
))
{
pRes
->
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
return
TSDB_CODE_SUCCESS
;
}
pRes
->
type
=
TSDB_DATA_TYPE_DOUBLE
;
return
TSDB_CODE_SUCCESS
;
case
OP_TYPE_MULTI
:
if
(
left
.
type
==
TSDB_DATA_TYPE_TIMESTAMP
&&
right
.
type
==
TSDB_DATA_TYPE_TIMESTAMP
)
{
qError
(
"invalid op %d, left type:%d, right type:%d"
,
op
,
left
.
type
,
right
.
type
);
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
case
OP_TYPE_DIV
:
if
(
left
.
type
==
TSDB_DATA_TYPE_TIMESTAMP
&&
right
.
type
==
TSDB_DATA_TYPE_TIMESTAMP
)
{
qError
(
"invalid op %d, left type:%d, right type:%d"
,
op
,
left
.
type
,
right
.
type
);
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
case
OP_TYPE_REM
:
case
OP_TYPE_MINUS
:
pRes
->
type
=
TSDB_DATA_TYPE_DOUBLE
;
return
TSDB_CODE_SUCCESS
;
case
OP_TYPE_GREATER_THAN
:
case
OP_TYPE_GREATER_EQUAL
:
case
OP_TYPE_LOWER_THAN
:
case
OP_TYPE_LOWER_EQUAL
:
case
OP_TYPE_EQUAL
:
case
OP_TYPE_NOT_EQUAL
:
case
OP_TYPE_IN
:
case
OP_TYPE_NOT_IN
:
case
OP_TYPE_LIKE
:
case
OP_TYPE_NOT_LIKE
:
case
OP_TYPE_MATCH
:
case
OP_TYPE_NMATCH
:
case
OP_TYPE_IS_NULL
:
case
OP_TYPE_IS_NOT_NULL
:
case
OP_TYPE_IS_TRUE
:
case
OP_TYPE_JSON_CONTAINS
:
pRes
->
type
=
TSDB_DATA_TYPE_BOOL
;
return
TSDB_CODE_SUCCESS
;
case
OP_TYPE_BIT_AND
:
case
OP_TYPE_BIT_OR
:
pRes
->
type
=
TSDB_DATA_TYPE_BIGINT
;
return
TSDB_CODE_SUCCESS
;
case
OP_TYPE_JSON_GET_VALUE
:
pRes
->
type
=
TSDB_DATA_TYPE_JSON
;
return
TSDB_CODE_SUCCESS
;
default:
ASSERT
(
0
);
return
TSDB_CODE_APP_ERROR
;
}
}
source/libs/scheduler/src/schJob.c
浏览文件 @
57836d8b
...
...
@@ -669,6 +669,11 @@ int32_t schSetTaskCandidateAddrs(SSchJob *pJob, SSchTask *pTask) {
return
TSDB_CODE_SUCCESS
;
}
if
(
SCH_IS_DATA_SRC_QRY_TASK
(
pTask
))
{
SCH_TASK_ELOG
(
"no execNode specifed for data src task, numOfEps:%d"
,
pTask
->
plan
->
execNode
.
epSet
.
numOfEps
);
SCH_ERR_RET
(
TSDB_CODE_QRY_APP_ERROR
);
}
SCH_ERR_RET
(
schSetAddrsFromNodeList
(
pJob
,
pTask
));
/*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录