Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c08f1ea2
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看板
未验证
提交
c08f1ea2
编写于
8月 08, 2022
作者:
X
Xiaoyu Wang
提交者:
GitHub
8月 08, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #15828 from taosdata/feature/3.0_query_optimize_wxy
enh: increase explain output, enhance debugging function
上级
ebe8192d
5ae9fdff
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
67 addition
and
26 deletion
+67
-26
source/libs/command/inc/commandInt.h
source/libs/command/inc/commandInt.h
+5
-0
source/libs/command/src/explain.c
source/libs/command/src/explain.c
+28
-3
source/libs/function/src/builtins.c
source/libs/function/src/builtins.c
+4
-3
source/libs/parser/src/parInsertData.c
source/libs/parser/src/parInsertData.c
+3
-3
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+0
-2
source/libs/planner/src/planLogicCreater.c
source/libs/planner/src/planLogicCreater.c
+26
-14
source/libs/planner/src/planPhysiCreater.c
source/libs/planner/src/planPhysiCreater.c
+1
-1
未找到文件。
source/libs/command/inc/commandInt.h
浏览文件 @
c08f1ea2
...
...
@@ -43,6 +43,7 @@ extern "C" {
#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_MERGE_ALIGNED_INTERVAL_FORMAT "Merge Aligned Interval on Column %s"
#define EXPLAIN_FILL_FORMAT "Fill"
#define EXPLAIN_SESSION_FORMAT "Session"
#define EXPLAIN_STATE_WINDOW_FORMAT "StateWindow on Column %s"
...
...
@@ -59,6 +60,8 @@ extern "C" {
#define EXPLAIN_RATIO_TIME_FORMAT "Ratio: %f"
#define EXPLAIN_MERGE_FORMAT "SortMerge"
#define EXPLAIN_MERGE_KEYS_FORMAT "Merge Key: "
#define EXPLAIN_PARTITION_KETS_FORMAT "Partition Key: "
#define EXPLAIN_INTERP_FORMAT "Interp"
#define EXPLAIN_PLANNING_TIME_FORMAT "Planning Time: %.3f ms"
#define EXPLAIN_EXEC_TIME_FORMAT "Execution Time: %.3f ms"
...
...
@@ -69,6 +72,7 @@ extern "C" {
#define EXPLAIN_LEFT_PARENTHESIS_FORMAT " ("
#define EXPLAIN_RIGHT_PARENTHESIS_FORMAT ")"
#define EXPLAIN_BLANK_FORMAT " "
#define EXPLAIN_COMMA_FORMAT ", "
#define EXPLAIN_COST_FORMAT "cost=%.2f..%.2f"
#define EXPLAIN_ROWS_FORMAT "rows=%" PRIu64
#define EXPLAIN_COLUMNS_FORMAT "columns=%d"
...
...
@@ -86,6 +90,7 @@ extern "C" {
#define EXPLAIN_OUTPUT_ORDER_TYPE_FORMAT "output_order=%s"
#define EXPLAIN_OFFSET_FORMAT "offset=%d"
#define EXPLAIN_SOFFSET_FORMAT "soffset=%d"
#define EXPLAIN_PARTITIONS_FORMAT "partitions=%d"
#define COMMAND_RESET_LOG "resetLog"
#define COMMAND_SCHEDULE_POLICY "schedulePolicy"
...
...
source/libs/command/src/explain.c
浏览文件 @
c08f1ea2
...
...
@@ -535,6 +535,13 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
if
(
NULL
!=
pTblScanNode
->
pGroupTags
)
{
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_PARTITION_KETS_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_PARTITIONS_FORMAT
,
pTblScanNode
->
pGroupTags
->
length
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
}
if
(
pTblScanNode
->
scan
.
node
.
pConditions
)
{
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_FILTER_FORMAT
);
QRY_ERR_RET
(
nodesNodeToSQL
(
pTblScanNode
->
scan
.
node
.
pConditions
,
tbuf
+
VARSTR_HEADER_SIZE
,
...
...
@@ -612,13 +619,17 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_MERGEBLOCKS_FORMAT
,
pPrjNode
->
mergeDataBlock
?
"True"
:
"False"
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
if
(
pPrjNode
->
node
.
pConditions
)
{
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_FILTER_FORMAT
);
QRY_ERR_RET
(
nodesNodeToSQL
(
pPrjNode
->
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
;
}
...
...
@@ -915,7 +926,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
}
case
QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL
:
{
SMergeAlignedIntervalPhysiNode
*
pIntNode
=
(
SMergeAlignedIntervalPhysiNode
*
)
pNode
;
EXPLAIN_ROW_NEW
(
level
,
EXPLAIN_INTERVAL_FORMAT
,
nodesGetNameFromColumnNode
(
pIntNode
->
window
.
pTspk
));
EXPLAIN_ROW_NEW
(
level
,
EXPLAIN_
MERGE_ALIGNED_
INTERVAL_FORMAT
,
nodesGetNameFromColumnNode
(
pIntNode
->
window
.
pTspk
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_LEFT_PARENTHESIS_FORMAT
);
if
(
pResNode
->
pExecInfo
)
{
QRY_ERR_RET
(
qExplainBufAppendExecInfo
(
pResNode
->
pExecInfo
,
tbuf
,
&
tlen
));
...
...
@@ -1129,6 +1140,11 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_PARTITION_KETS_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_PARTITIONS_FORMAT
,
pPartNode
->
pPartitionKeys
->
length
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
if
(
pPartNode
->
node
.
pConditions
)
{
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_FILTER_FORMAT
);
QRY_ERR_RET
(
nodesNodeToSQL
(
pPartNode
->
node
.
pConditions
,
tbuf
+
VARSTR_HEADER_SIZE
,
...
...
@@ -1201,11 +1217,20 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_MERGE_KEYS_FORMAT
);
if
(
pMergeNode
->
groupSort
)
{
EXPLAIN_ROW_APPEND
(
EXPLAIN_STRING_TYPE_FORMAT
,
"_group_id asc"
);
if
(
LIST_LENGTH
(
pMergeNode
->
pMergeKeys
)
>
0
)
{
EXPLAIN_ROW_APPEND
(
EXPLAIN_COMMA_FORMAT
);
}
}
for
(
int32_t
i
=
0
;
i
<
LIST_LENGTH
(
pMergeNode
->
pMergeKeys
);
++
i
)
{
SOrderByExprNode
*
ptn
=
(
SOrderByExprNode
*
)
nodesListGetNode
(
pMergeNode
->
pMergeKeys
,
i
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_STRING_TYPE_FORMAT
,
nodesGetNameFromColumnNode
(
ptn
->
pExpr
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_STRING_TYPE_FORMAT
,
EXPLAIN_ORDER_STRING
(
ptn
->
order
));
if
(
i
!=
LIST_LENGTH
(
pMergeNode
->
pMergeKeys
)
-
1
)
{
EXPLAIN_ROW_APPEND
(
EXPLAIN_COMMA_FORMAT
);
}
}
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
...
...
@@ -1417,7 +1442,7 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
}
case
QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC
:
{
SInterpFuncPhysiNode
*
pInterpNode
=
(
SInterpFuncPhysiNode
*
)
pNode
;
EXPLAIN_ROW_NEW
(
level
,
EXPLAIN_
AGG
_FORMAT
);
EXPLAIN_ROW_NEW
(
level
,
EXPLAIN_
INTERP
_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_LEFT_PARENTHESIS_FORMAT
);
if
(
pResNode
->
pExecInfo
)
{
QRY_ERR_RET
(
qExplainBufAppendExecInfo
(
pResNode
->
pExecInfo
,
tbuf
,
&
tlen
));
...
...
source/libs/function/src/builtins.c
浏览文件 @
c08f1ea2
...
...
@@ -1575,7 +1575,8 @@ static int32_t translateDiff(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
}
uint8_t
colType
=
((
SExprNode
*
)
nodesListGetNode
(
pFunc
->
pParameterList
,
0
))
->
resType
.
type
;
if
(
!
IS_SIGNED_NUMERIC_TYPE
(
colType
)
&&
!
IS_FLOAT_TYPE
(
colType
)
&&
TSDB_DATA_TYPE_BOOL
!=
colType
&&
TSDB_DATA_TYPE_TIMESTAMP
!=
colType
)
{
if
(
!
IS_SIGNED_NUMERIC_TYPE
(
colType
)
&&
!
IS_FLOAT_TYPE
(
colType
)
&&
TSDB_DATA_TYPE_BOOL
!=
colType
&&
TSDB_DATA_TYPE_TIMESTAMP
!=
colType
)
{
return
invaildFuncParaTypeErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
}
...
...
@@ -2150,7 +2151,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
},
{
.
name
=
"_apercentile_partial"
,
.
type
=
FUNCTION_TYPE_APERCENTILE_PARTIAL
|
FUNC_MGT_TIMELINE_FUNC
,
.
type
=
FUNCTION_TYPE_APERCENTILE_PARTIAL
,
.
classification
=
FUNC_MGT_AGG_FUNC
,
.
translateFunc
=
translateApercentilePartial
,
.
getEnvFunc
=
getApercentileFuncEnv
,
...
...
@@ -2163,7 +2164,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"_apercentile_merge"
,
.
type
=
FUNCTION_TYPE_APERCENTILE_MERGE
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_TIMELINE_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
,
.
translateFunc
=
translateApercentileMerge
,
.
getEnvFunc
=
getApercentileFuncEnv
,
.
initFunc
=
apercentileFunctionSetup
,
...
...
source/libs/parser/src/parInsertData.c
浏览文件 @
c08f1ea2
...
...
@@ -486,11 +486,11 @@ static int32_t tdBlockRowMerge(STableMeta* pTableMeta, SBlockKeyTuple* pEndKeyTp
void
*
pDestRow
=
NULL
;
++
((
*
pBlkRowMerger
)
->
index
);
if
((
*
pBlkRowMerger
)
->
index
<
taosArrayGetSize
((
*
pBlkRowMerger
)
->
rowArray
))
{
void
*
pAlloc
=
*
(
void
**
)
taosArrayGet
((
*
pBlkRowMerger
)
->
rowArray
,
(
*
pBlkRowMerger
)
->
index
);
if
(
tRealloc
((
uint8_t
**
)
&
pAlloc
,
rowSize
)
!=
0
)
{
void
*
*
pAlloc
=
(
void
**
)
taosArrayGet
((
*
pBlkRowMerger
)
->
rowArray
,
(
*
pBlkRowMerger
)
->
index
);
if
(
tRealloc
((
uint8_t
**
)
pAlloc
,
rowSize
)
!=
0
)
{
return
TSDB_CODE_FAILED
;
}
pDestRow
=
pAlloc
;
pDestRow
=
*
pAlloc
;
}
else
{
if
(
tRealloc
((
uint8_t
**
)
&
pDestRow
,
rowSize
)
!=
0
)
{
return
TSDB_CODE_FAILED
;
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
c08f1ea2
...
...
@@ -2543,7 +2543,6 @@ static int32_t translateWindow(STranslateContext* pCxt, SSelectStmt* pSelect) {
if
(
NULL
==
pSelect
->
pWindow
)
{
return
TSDB_CODE_SUCCESS
;
}
pSelect
->
isTimeLineResult
=
true
;
pCxt
->
currClause
=
SQL_CLAUSE_WINDOW
;
int32_t
code
=
translateExpr
(
pCxt
,
&
pSelect
->
pWindow
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
...
...
@@ -2614,7 +2613,6 @@ static int32_t translatePartitionBy(STranslateContext* pCxt, SSelectStmt* pSelec
if
(
NULL
==
pSelect
->
pPartitionByList
)
{
return
TSDB_CODE_SUCCESS
;
}
pSelect
->
isTimeLineResult
=
false
;
pCxt
->
currClause
=
SQL_CLAUSE_PARTITION_BY
;
return
translateExprList
(
pCxt
,
pSelect
->
pPartitionByList
);
}
...
...
source/libs/planner/src/planLogicCreater.c
浏览文件 @
c08f1ea2
...
...
@@ -342,7 +342,7 @@ static int32_t createJoinLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect
pJoin
->
inputTsOrder
=
ORDER_ASC
;
pJoin
->
node
.
groupAction
=
GROUP_ACTION_CLEAR
;
pJoin
->
node
.
requireDataOrder
=
DATA_ORDER_LEVEL_GLOBAL
;
pJoin
->
node
.
re
quire
DataOrder
=
DATA_ORDER_LEVEL_GLOBAL
;
pJoin
->
node
.
re
sult
DataOrder
=
DATA_ORDER_LEVEL_GLOBAL
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
...
...
@@ -472,6 +472,11 @@ static EGroupAction getGroupAction(SLogicPlanContext* pCxt, SSelectStmt* pSelect
return
(
pCxt
->
pPlanCxt
->
streamQuery
||
NULL
!=
pSelect
->
pLimit
)
?
GROUP_ACTION_KEEP
:
GROUP_ACTION_NONE
;
}
static
EDataOrderLevel
getRequireDataOrder
(
bool
needTimeline
,
SSelectStmt
*
pSelect
)
{
return
needTimeline
?
(
NULL
!=
pSelect
->
pPartitionByList
?
DATA_ORDER_LEVEL_IN_GROUP
:
DATA_ORDER_LEVEL_GLOBAL
)
:
DATA_ORDER_LEVEL_NONE
;
}
static
int32_t
createAggLogicNode
(
SLogicPlanContext
*
pCxt
,
SSelectStmt
*
pSelect
,
SLogicNode
**
pLogicNode
)
{
if
(
!
pSelect
->
hasAggFuncs
&&
NULL
==
pSelect
->
pGroupByList
)
{
return
TSDB_CODE_SUCCESS
;
...
...
@@ -486,8 +491,8 @@ static int32_t createAggLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect,
pAgg
->
hasTimeLineFunc
=
pSelect
->
hasTimeLineFunc
;
pAgg
->
onlyHasKeepOrderFunc
=
pSelect
->
onlyHasKeepOrderFunc
;
pAgg
->
node
.
groupAction
=
getGroupAction
(
pCxt
,
pSelect
);
pAgg
->
node
.
requireDataOrder
=
pAgg
->
hasTimeLineFunc
?
DATA_ORDER_LEVEL_IN_GROUP
:
DATA_ORDER_LEVEL_NONE
;
pAgg
->
node
.
resultDataOrder
=
DATA_ORDER_LEVEL_NONE
;
pAgg
->
node
.
requireDataOrder
=
getRequireDataOrder
(
pAgg
->
hasTimeLineFunc
,
pSelect
)
;
pAgg
->
node
.
resultDataOrder
=
pAgg
->
onlyHasKeepOrderFunc
?
pAgg
->
node
.
requireDataOrder
:
DATA_ORDER_LEVEL_NONE
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
...
...
@@ -557,8 +562,7 @@ static int32_t createIndefRowsFuncLogicNode(SLogicPlanContext* pCxt, SSelectStmt
pIdfRowsFunc
->
isUniqueFunc
=
pSelect
->
hasUniqueFunc
;
pIdfRowsFunc
->
isTimeLineFunc
=
pSelect
->
hasTimeLineFunc
;
pIdfRowsFunc
->
node
.
groupAction
=
getGroupAction
(
pCxt
,
pSelect
);
pIdfRowsFunc
->
node
.
requireDataOrder
=
pIdfRowsFunc
->
isTimeLineFunc
?
DATA_ORDER_LEVEL_IN_GROUP
:
DATA_ORDER_LEVEL_NONE
;
pIdfRowsFunc
->
node
.
requireDataOrder
=
getRequireDataOrder
(
pIdfRowsFunc
->
isTimeLineFunc
,
pSelect
);
pIdfRowsFunc
->
node
.
resultDataOrder
=
pIdfRowsFunc
->
node
.
requireDataOrder
;
// indefinite rows functions and _select_values functions
...
...
@@ -592,7 +596,7 @@ static int32_t createInterpFuncLogicNode(SLogicPlanContext* pCxt, SSelectStmt* p
}
pInterpFunc
->
node
.
groupAction
=
getGroupAction
(
pCxt
,
pSelect
);
pInterpFunc
->
node
.
requireDataOrder
=
DATA_ORDER_LEVEL_IN_GROUP
;
pInterpFunc
->
node
.
requireDataOrder
=
getRequireDataOrder
(
true
,
pSelect
)
;
pInterpFunc
->
node
.
resultDataOrder
=
pInterpFunc
->
node
.
requireDataOrder
;
int32_t
code
=
nodesCollectFuncs
(
pSelect
,
SQL_CLAUSE_SELECT
,
fmIsInterpFunc
,
&
pInterpFunc
->
pFuncs
);
...
...
@@ -668,8 +672,10 @@ static int32_t createWindowLogicNodeByState(SLogicPlanContext* pCxt, SStateWindo
pWindow
->
winType
=
WINDOW_TYPE_STATE
;
pWindow
->
node
.
groupAction
=
getGroupAction
(
pCxt
,
pSelect
);
pWindow
->
node
.
requireDataOrder
=
pCxt
->
pPlanCxt
->
streamQuery
?
DATA_ORDER_LEVEL_IN_BLOCK
:
DATA_ORDER_LEVEL_IN_GROUP
;
pWindow
->
node
.
resultDataOrder
=
DATA_ORDER_LEVEL_IN_GROUP
;
pWindow
->
node
.
requireDataOrder
=
pCxt
->
pPlanCxt
->
streamQuery
?
DATA_ORDER_LEVEL_IN_BLOCK
:
getRequireDataOrder
(
true
,
pSelect
);
pWindow
->
node
.
resultDataOrder
=
pCxt
->
pPlanCxt
->
streamQuery
?
DATA_ORDER_LEVEL_GLOBAL
:
pWindow
->
node
.
requireDataOrder
;
pWindow
->
pStateExpr
=
nodesCloneNode
(
pState
->
pExpr
);
pWindow
->
pTspk
=
nodesCloneNode
(
pState
->
pCol
);
if
(
NULL
==
pWindow
->
pStateExpr
||
NULL
==
pWindow
->
pTspk
)
{
...
...
@@ -691,8 +697,10 @@ static int32_t createWindowLogicNodeBySession(SLogicPlanContext* pCxt, SSessionW
pWindow
->
sessionGap
=
((
SValueNode
*
)
pSession
->
pGap
)
->
datum
.
i
;
pWindow
->
windowAlgo
=
pCxt
->
pPlanCxt
->
streamQuery
?
SESSION_ALGO_STREAM_SINGLE
:
SESSION_ALGO_MERGE
;
pWindow
->
node
.
groupAction
=
getGroupAction
(
pCxt
,
pSelect
);
pWindow
->
node
.
requireDataOrder
=
pCxt
->
pPlanCxt
->
streamQuery
?
DATA_ORDER_LEVEL_IN_BLOCK
:
DATA_ORDER_LEVEL_IN_GROUP
;
pWindow
->
node
.
resultDataOrder
=
DATA_ORDER_LEVEL_IN_GROUP
;
pWindow
->
node
.
requireDataOrder
=
pCxt
->
pPlanCxt
->
streamQuery
?
DATA_ORDER_LEVEL_IN_BLOCK
:
getRequireDataOrder
(
true
,
pSelect
);
pWindow
->
node
.
resultDataOrder
=
pCxt
->
pPlanCxt
->
streamQuery
?
DATA_ORDER_LEVEL_GLOBAL
:
pWindow
->
node
.
requireDataOrder
;
pWindow
->
pTspk
=
nodesCloneNode
((
SNode
*
)
pSession
->
pCol
);
if
(
NULL
==
pWindow
->
pTspk
)
{
...
...
@@ -720,8 +728,12 @@ static int32_t createWindowLogicNodeByInterval(SLogicPlanContext* pCxt, SInterva
(
NULL
!=
pInterval
->
pSliding
?
((
SValueNode
*
)
pInterval
->
pSliding
)
->
unit
:
pWindow
->
intervalUnit
);
pWindow
->
windowAlgo
=
pCxt
->
pPlanCxt
->
streamQuery
?
INTERVAL_ALGO_STREAM_SINGLE
:
INTERVAL_ALGO_HASH
;
pWindow
->
node
.
groupAction
=
(
NULL
!=
pInterval
->
pFill
?
GROUP_ACTION_KEEP
:
getGroupAction
(
pCxt
,
pSelect
));
pWindow
->
node
.
requireDataOrder
=
pSelect
->
hasTimeLineFunc
?
DATA_ORDER_LEVEL_IN_GROUP
:
DATA_ORDER_LEVEL_IN_BLOCK
;
pWindow
->
node
.
resultDataOrder
=
DATA_ORDER_LEVEL_IN_GROUP
;
pWindow
->
node
.
requireDataOrder
=
pCxt
->
pPlanCxt
->
streamQuery
?
DATA_ORDER_LEVEL_IN_BLOCK
:
(
pSelect
->
hasTimeLineFunc
?
getRequireDataOrder
(
true
,
pSelect
)
:
DATA_ORDER_LEVEL_IN_BLOCK
);
pWindow
->
node
.
resultDataOrder
=
pCxt
->
pPlanCxt
->
streamQuery
?
DATA_ORDER_LEVEL_GLOBAL
:
getRequireDataOrder
(
true
,
pSelect
);
pWindow
->
pTspk
=
nodesCloneNode
(
pInterval
->
pCol
);
if
(
NULL
==
pWindow
->
pTspk
)
{
...
...
@@ -768,8 +780,8 @@ static int32_t createFillLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect
}
pFill
->
node
.
groupAction
=
getGroupAction
(
pCxt
,
pSelect
);
pFill
->
node
.
requireDataOrder
=
DATA_ORDER_LEVEL_IN_GROUP
;
pFill
->
node
.
resultDataOrder
=
DATA_ORDER_LEVEL_IN_GROUP
;
pFill
->
node
.
requireDataOrder
=
getRequireDataOrder
(
true
,
pSelect
)
;
pFill
->
node
.
resultDataOrder
=
pFill
->
node
.
requireDataOrder
;
pFill
->
inputTsOrder
=
ORDER_ASC
;
int32_t
code
=
nodesCollectColumns
(
pSelect
,
SQL_CLAUSE_WINDOW
,
NULL
,
COLLECT_COL_TYPE_ALL
,
&
pFill
->
node
.
pTargets
);
...
...
source/libs/planner/src/planPhysiCreater.c
浏览文件 @
c08f1ea2
...
...
@@ -985,7 +985,7 @@ static bool projectCanMergeDataBlock(SProjectLogicNode* pProject) {
return
true
;
}
if
(
1
!=
LIST_LENGTH
(
pProject
->
node
.
pChildren
))
{
return
fals
e
;
return
tru
e
;
}
SLogicNode
*
pChild
=
(
SLogicNode
*
)
nodesListGetNode
(
pProject
->
node
.
pChildren
,
0
);
return
DATA_ORDER_LEVEL_GLOBAL
==
pChild
->
resultDataOrder
?
true
:
false
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录