Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
920eac30
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看板
提交
920eac30
编写于
12月 01, 2022
作者:
S
slzhou
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'enh/3.0_planner_optimize' of github.com:taosdata/TDengine into szhou/table-count-scan
上级
cf604cc5
eea8d7be
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
18 addition
and
11 deletion
+18
-11
source/libs/parser/test/mockCatalog.cpp
source/libs/parser/test/mockCatalog.cpp
+1
-1
source/libs/planner/src/planOptimizer.c
source/libs/planner/src/planOptimizer.c
+17
-10
未找到文件。
source/libs/parser/test/mockCatalog.cpp
浏览文件 @
920eac30
...
...
@@ -66,8 +66,8 @@ void generateInformationSchema(MockCatalogService* mcs) {
.
addColumn
(
"stable_name"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_TABLE_NAME_LEN
)
.
done
();
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_TABLES
,
TSDB_SYSTEM_TABLE
,
3
)
.
addColumn
(
"db_name"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_DB_NAME_LEN
)
.
addColumn
(
"table_name"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_TABLE_NAME_LEN
)
.
addColumn
(
"db_name"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_DB_NAME_LEN
)
.
addColumn
(
"stable_name"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_TABLE_NAME_LEN
)
.
done
();
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_TABLE_DISTRIBUTED
,
TSDB_SYSTEM_TABLE
,
2
)
...
...
source/libs/planner/src/planOptimizer.c
浏览文件 @
920eac30
...
...
@@ -2630,10 +2630,8 @@ static int32_t tbCntScanOptRewriteScan(STbCntScanOptInfo* pInfo) {
pInfo
->
pScan
->
scanType
=
SCAN_TYPE_TABLE_COUNT
;
strcpy
(
pInfo
->
pScan
->
tableName
.
dbname
,
pInfo
->
table
.
dbname
);
strcpy
(
pInfo
->
pScan
->
tableName
.
tname
,
pInfo
->
table
.
tname
);
if
(
NULL
==
pInfo
->
pAgg
->
pGroupKeys
)
{
NODES_DESTORY_LIST
(
pInfo
->
pScan
->
node
.
pTargets
);
NODES_DESTORY_LIST
(
pInfo
->
pScan
->
pScanCols
);
}
NODES_DESTORY_LIST
(
pInfo
->
pScan
->
node
.
pTargets
);
NODES_DESTORY_LIST
(
pInfo
->
pScan
->
pScanCols
);
NODES_DESTORY_NODE
(
pInfo
->
pScan
->
node
.
pConditions
);
NODES_DESTORY_LIST
(
pInfo
->
pScan
->
pScanPseudoCols
);
int32_t
code
=
nodesListMakeStrictAppend
(
&
pInfo
->
pScan
->
pScanPseudoCols
,
tbCntScanOptCreateTableCountFunc
());
...
...
@@ -2642,8 +2640,14 @@ static int32_t tbCntScanOptRewriteScan(STbCntScanOptInfo* pInfo) {
}
SNode
*
pGroupKey
=
NULL
;
FOREACH
(
pGroupKey
,
pInfo
->
pAgg
->
pGroupKeys
)
{
code
=
nodesListMakeStrictAppend
(
&
pInfo
->
pScan
->
pGroupTags
,
nodesCloneNode
(
nodesListGetNode
(((
SGroupingSetNode
*
)
pGroupKey
)
->
pParameterList
,
0
)));
SNode
*
pGroupCol
=
nodesListGetNode
(((
SGroupingSetNode
*
)
pGroupKey
)
->
pParameterList
,
0
);
code
=
nodesListMakeStrictAppend
(
&
pInfo
->
pScan
->
pGroupTags
,
nodesCloneNode
(
pGroupCol
));
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
nodesListMakeStrictAppend
(
&
pInfo
->
pScan
->
pScanCols
,
nodesCloneNode
(
pGroupCol
));
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
nodesListMakeStrictAppend
(
&
pInfo
->
pScan
->
node
.
pTargets
,
nodesCloneNode
(
pGroupCol
));
}
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
break
;
}
...
...
@@ -2671,14 +2675,17 @@ static int32_t tbCntScanOptCreateSumFunc(SFunctionNode* pCntFunc, SNode* pParam,
}
static
int32_t
tbCntScanOptRewriteAgg
(
SAggLogicNode
*
pAgg
)
{
S
Node
*
pSum
=
NULL
;
int32_t
code
=
tbCntScanOptCreateSumFunc
(
(
SFunctionNode
*
)
nodesListGetNode
(
pAgg
->
pAggFuncs
,
0
),
nodesListGetNode
(((
SScanLogicNode
*
)
nodesListGetNode
(
pAgg
->
node
.
pChildren
,
0
))
->
pScanPseudoCols
,
0
),
&
pSum
);
S
ScanLogicNode
*
pScan
=
(
SScanLogicNode
*
)
nodesListGetNode
(
pAgg
->
node
.
pChildren
,
0
)
;
SNode
*
pSum
=
NULL
;
int32_t
code
=
tbCntScanOptCreateSumFunc
(
(
SFunctionNode
*
)
nodesListGetNode
(
pAgg
->
pAggFuncs
,
0
),
nodesListGetNode
(
pScan
->
pScanPseudoCols
,
0
),
&
pSum
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
NODES_DESTORY_LIST
(
pAgg
->
pAggFuncs
);
code
=
nodesListMakeStrictAppend
(
&
pAgg
->
pAggFuncs
,
pSum
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
partTagsRewriteGroupTagsToFuncs
(
pScan
->
pGroupTags
,
0
,
pAgg
);
}
NODES_DESTORY_LIST
(
pAgg
->
pGroupKeys
);
return
code
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录