Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b6728082
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看板
未验证
提交
b6728082
编写于
7月 20, 2022
作者:
S
shenglian-zhou
提交者:
GitHub
7月 20, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #15131 from taosdata/szhou/fix/td-17505
fix: keep only tag related scan cols and scan targets when tag scan
上级
bd301d04
4901b595
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
36 addition
and
2 deletion
+36
-2
source/libs/planner/src/planOptimizer.c
source/libs/planner/src/planOptimizer.c
+34
-1
tests/script/tsim/valgrind/checkError1.sim
tests/script/tsim/valgrind/checkError1.sim
+2
-1
未找到文件。
source/libs/planner/src/planOptimizer.c
浏览文件 @
b6728082
...
@@ -1378,6 +1378,22 @@ static bool planOptNodeListHasCol(SNodeList* pKeys) {
...
@@ -1378,6 +1378,22 @@ static bool planOptNodeListHasCol(SNodeList* pKeys) {
return
hasCol
;
return
hasCol
;
}
}
static
EDealRes
partTagsOptHasTbname
(
SNode
*
pNode
,
void
*
pContext
)
{
if
(
QUERY_NODE_COLUMN
==
nodeType
(
pNode
))
{
if
(
COLUMN_TYPE_TBNAME
==
((
SColumnNode
*
)
pNode
)
->
colType
)
{
*
(
bool
*
)
pContext
=
true
;
return
DEAL_RES_END
;
}
}
return
DEAL_RES_CONTINUE
;
}
static
bool
planOptNodeListHasTbname
(
SNodeList
*
pKeys
)
{
bool
hasCol
=
false
;
nodesWalkExprs
(
pKeys
,
partTagsOptHasTbname
,
&
hasCol
);
return
hasCol
;
}
static
bool
partTagsIsOptimizableNode
(
SLogicNode
*
pNode
)
{
static
bool
partTagsIsOptimizableNode
(
SLogicNode
*
pNode
)
{
return
((
QUERY_NODE_LOGIC_PLAN_PARTITION
==
nodeType
(
pNode
)
||
return
((
QUERY_NODE_LOGIC_PLAN_PARTITION
==
nodeType
(
pNode
)
||
(
QUERY_NODE_LOGIC_PLAN_AGG
==
nodeType
(
pNode
)
&&
NULL
!=
((
SAggLogicNode
*
)
pNode
)
->
pGroupKeys
&&
(
QUERY_NODE_LOGIC_PLAN_AGG
==
nodeType
(
pNode
)
&&
NULL
!=
((
SAggLogicNode
*
)
pNode
)
->
pGroupKeys
&&
...
@@ -2129,7 +2145,8 @@ static bool tagScanMayBeOptimized(SLogicNode* pNode) {
...
@@ -2129,7 +2145,8 @@ static bool tagScanMayBeOptimized(SLogicNode* pNode) {
}
}
SAggLogicNode
*
pAgg
=
(
SAggLogicNode
*
)(
pNode
->
pParent
);
SAggLogicNode
*
pAgg
=
(
SAggLogicNode
*
)(
pNode
->
pParent
);
if
(
NULL
==
pAgg
->
pGroupKeys
||
NULL
!=
pAgg
->
pAggFuncs
||
planOptNodeListHasCol
(
pAgg
->
pGroupKeys
))
{
if
(
NULL
==
pAgg
->
pGroupKeys
||
NULL
!=
pAgg
->
pAggFuncs
||
planOptNodeListHasCol
(
pAgg
->
pGroupKeys
)
||
!
planOptNodeListHasTbname
(
pAgg
->
pGroupKeys
))
{
return
false
;
return
false
;
}
}
...
@@ -2143,6 +2160,22 @@ static int32_t tagScanOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubp
...
@@ -2143,6 +2160,22 @@ static int32_t tagScanOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubp
}
}
pScanNode
->
scanType
=
SCAN_TYPE_TAG
;
pScanNode
->
scanType
=
SCAN_TYPE_TAG
;
SNode
*
pTarget
=
NULL
;
FOREACH
(
pTarget
,
pScanNode
->
node
.
pTargets
)
{
if
(
PRIMARYKEY_TIMESTAMP_COL_ID
==
((
SColumnNode
*
)(
pTarget
))
->
colId
)
{
ERASE_NODE
(
pScanNode
->
node
.
pTargets
);
break
;
}
}
NODES_DESTORY_LIST
(
pScanNode
->
pScanCols
);
SLogicNode
*
pAgg
=
pScanNode
->
node
.
pParent
;
int32_t
code
=
replaceLogicNode
(
pLogicSubplan
,
pAgg
,
(
SLogicNode
*
)
pScanNode
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
NODES_CLEAR_LIST
(
pAgg
->
pChildren
);
}
nodesDestroyNode
((
SNode
*
)
pAgg
);
pCxt
->
optimized
=
true
;
pCxt
->
optimized
=
true
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
...
tests/script/tsim/valgrind/checkError1.sim
浏览文件 @
b6728082
...
@@ -7,6 +7,7 @@ system sh/exec.sh -n dnode1 -s start -v
...
@@ -7,6 +7,7 @@ system sh/exec.sh -n dnode1 -s start -v
system sh/exec.sh -n dnode2 -s start -v
system sh/exec.sh -n dnode2 -s start -v
sql connect
sql connect
print =============== step1: create alter drop show user
print =============== step1: create alter drop show user
sql create user u1 pass 'taosdata'
sql create user u1 pass 'taosdata'
sql show users
sql show users
...
@@ -158,4 +159,4 @@ endi
...
@@ -158,4 +159,4 @@ endi
if $system_content == $null then
if $system_content == $null then
return -1
return -1
endi
endi
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录